本文整理汇总了C++中tracttype::Pointer::GetElement方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::GetElement方法的具体用法?C++ Pointer::GetElement怎么用?C++ Pointer::GetElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tracttype::Pointer
的用法示例。
在下文中一共展示了Pointer::GetElement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: length
void mitk::ConnectomicsNetworkCreator::LinearExtensionUntilGreyMatter(
std::vector<int> & indexVectorOfPointsToUse,
TractType::Pointer singleTract,
int & label,
itk::Index<3> & mitkIndex )
{
if( indexVectorOfPointsToUse.size() > singleTract->Size() )
{
MBI_WARN << mitk::ConnectomicsConstantsManager::CONNECTOMICS_WARNING_MORE_POINTS_THAN_PRESENT;
return;
}
if( indexVectorOfPointsToUse.size() < 2 )
{
MBI_WARN << mitk::ConnectomicsConstantsManager::CONNECTOMICS_WARNING_ESTIMATING_LESS_THAN_2;
return;
}
for( unsigned int index( 0 ); index < indexVectorOfPointsToUse.size(); index++ )
{
if( indexVectorOfPointsToUse[ index ] < 0 )
{
MBI_WARN << mitk::ConnectomicsConstantsManager::CONNECTOMICS_WARNING_ESTIMATING_BEYOND_START;
return;
}
if( (unsigned int)indexVectorOfPointsToUse[ index ] > singleTract->Size() )
{
MBI_WARN << mitk::ConnectomicsConstantsManager::CONNECTOMICS_WARNING_ESTIMATING_BEYOND_END;
return;
}
}
mitk::Point3D startPoint, endPoint;
std::vector< double > differenceVector;
differenceVector.resize( singleTract->front().Size() );
{
// which points to use, currently only last two //TODO correct using all points
int endPointIndex = indexVectorOfPointsToUse.size() - 1;
int startPointIndex = indexVectorOfPointsToUse.size() - 2;
// convert to segmentation coords
mitk::Point3D startFiber, endFiber;
for( unsigned int index = 0; index < singleTract->front().Size(); index++ )
{
endFiber.SetElement( index, singleTract->GetElement( indexVectorOfPointsToUse[ endPointIndex ] ).GetElement( index ) );
startFiber.SetElement( index, singleTract->GetElement( indexVectorOfPointsToUse[ startPointIndex ] ).GetElement( index ) );
}
FiberToSegmentationCoords( endFiber, endPoint );
FiberToSegmentationCoords( startFiber, startPoint );
// calculate straight line
for( unsigned int index = 0; index < singleTract->front().Size(); index++ )
{
differenceVector[ index ] = endPoint.GetElement( index ) - startPoint.GetElement( index );
}
// normalizing direction vector
double length( 0.0 );
double sum( 0.0 );
for( unsigned int index = 0; index < differenceVector.size() ; index++ )
{
sum = sum + differenceVector[ index ] * differenceVector[ index ];
}
length = std::sqrt( sum );
for( unsigned int index = 0; index < differenceVector.size() ; index++ )
{
differenceVector[ index ] = differenceVector[ index ] / length;
}
// follow line until first non white matter label
itk::Index<3> tempIndex;
int tempLabel( label );
bool keepOn( true );
itk::ImageRegion<3> itkRegion = m_SegmentationItk->GetLargestPossibleRegion();
for( int parameter( 0 ) ; keepOn ; parameter++ )
{
if( parameter > 1000 )
{
MBI_WARN << mitk::ConnectomicsConstantsManager::CONNECTOMICS_WARNING_DID_NOT_FIND_WHITE;
break;
}
for( int index( 0 ); index < 3; index++ )
{
tempIndex.SetElement( index, endPoint.GetElement( index ) + parameter * differenceVector[ index ] );
}
if( itkRegion.IsInside( tempIndex ) )
{
tempLabel = m_SegmentationItk->GetPixel( tempIndex );
//.........这里部分代码省略.........
示例2: retractionStartIndex
void mitk::ConnectomicsNetworkCreator::RetractionUntilBrainMatter( bool retractFront, TractType::Pointer singleTract,
int & label, itk::Index<3> & mitkIndex )
{
int retractionStartIndex( singleTract->Size() - 1 );
int retractionStepIndexSize( -1 );
int retractionTerminationIndex( 0 );
if( retractFront )
{
retractionStartIndex = 0;
retractionStepIndexSize = 1;
retractionTerminationIndex = singleTract->Size() - 1;
}
int currentRetractionIndex = retractionStartIndex;
bool keepRetracting( true );
mitk::Point3D currentPoint, nextPoint;
std::vector< double > differenceVector;
differenceVector.resize( singleTract->front().Size() );
while( keepRetracting && ( currentRetractionIndex != retractionTerminationIndex ) )
{
// convert to segmentation coords
mitk::Point3D currentPointFiberCoord, nextPointFiberCoord;
for( unsigned int index = 0; index < singleTract->front().Size(); index++ )
{
currentPointFiberCoord.SetElement( index, singleTract->GetElement( currentRetractionIndex ).GetElement( index ) );
nextPointFiberCoord.SetElement( index, singleTract->GetElement( currentRetractionIndex + retractionStepIndexSize ).GetElement( index ) );
}
FiberToSegmentationCoords( currentPointFiberCoord, currentPoint );
FiberToSegmentationCoords( nextPointFiberCoord, nextPoint );
// calculate straight line
for( unsigned int index = 0; index < singleTract->front().Size(); index++ )
{
differenceVector[ index ] = nextPoint.GetElement( index ) - currentPoint.GetElement( index );
}
// calculate length of direction vector
double length( 0.0 );
double sum( 0.0 );
for( unsigned int index = 0; index < differenceVector.size() ; index++ )
{
sum = sum + differenceVector[ index ] * differenceVector[ index ];
}
length = std::sqrt( sum );
// retract
itk::Index<3> tempIndex;
int tempLabel( label );
for( int parameter( 0 ) ; parameter < length ; parameter++ )
{
for( int index( 0 ); index < 3; index++ )
{
tempIndex.SetElement( index,
currentPoint.GetElement( index ) + ( 1.0 + parameter ) / ( 1.0 + length ) * differenceVector[ index ] );
}
tempLabel = m_SegmentationItk->GetPixel( tempIndex );
if( !IsBackgroundLabel( tempLabel ) )
{
// check whether result is within the search space
{
mitk::Point3D endPoint, foundPointSegmentation, foundPointFiber;
for( unsigned int index = 0; index < singleTract->front().Size(); index++ )
{
// this is in fiber (world) coordinates
endPoint.SetElement( index, singleTract->GetElement( retractionStartIndex ).GetElement( index ) );
}
for( int index( 0 ); index < 3; index++ )
{
foundPointSegmentation.SetElement( index,
currentPoint.GetElement( index ) + ( 1.0 + parameter ) / ( 1.0 + length ) * differenceVector[ index ] );
}
SegmentationToFiberCoords( foundPointSegmentation, foundPointFiber );
std::vector< double > finalDistance;
finalDistance.resize( singleTract->front().Size() );
for( unsigned int index = 0; index < singleTract->front().Size(); index++ )
{
finalDistance[ index ] = foundPointFiber.GetElement( index ) - endPoint.GetElement( index );
}
// calculate length of direction vector
double finalLength( 0.0 );
double finalSum( 0.0 );
//.........这里部分代码省略.........
示例3: retractionStartIndex
void mitk::ConnectomicsNetworkCreator::RetractionUntilBrainMatter( bool retractFront, TractType::Pointer singleTract,
int & label, mitk::Index3D & mitkIndex )
{
int retractionStartIndex( singleTract->Size() - 1 );
int retractionStepIndexSize( -1 );
int retractionTerminationIndex( 0 );
if( retractFront )
{
retractionStartIndex = 0;
retractionStepIndexSize = 1;
retractionTerminationIndex = singleTract->Size() - 1;
}
int currentRetractionIndex = retractionStartIndex;
bool keepRetracting( true );
mitk::Point3D currentPoint, nextPoint;
std::vector< double > differenceVector;
differenceVector.resize( singleTract->front().Size() );
while( keepRetracting && ( currentRetractionIndex != retractionTerminationIndex ) )
{
// convert to segmentation coords
mitk::Point3D currentPointFiberCoord, nextPointFiberCoord;
for( int index = 0; index < singleTract->front().Size(); index++ )
{
currentPointFiberCoord.SetElement( index, singleTract->GetElement( currentRetractionIndex ).GetElement( index ) );
nextPointFiberCoord.SetElement( index, singleTract->GetElement( currentRetractionIndex + retractionStepIndexSize ).GetElement( index ) );
}
FiberToSegmentationCoords( currentPointFiberCoord, currentPoint );
FiberToSegmentationCoords( nextPointFiberCoord, nextPoint );
// calculate straight line
for( int index = 0; index < singleTract->front().Size(); index++ )
{
differenceVector[ index ] = nextPoint.GetElement( index ) - currentPoint.GetElement( index );
}
// calculate length of direction vector
double length( 0.0 );
double sum( 0.0 );
for( int index = 0; index < differenceVector.size() ; index++ )
{
sum = sum + differenceVector[ index ] * differenceVector[ index ];
}
length = std::sqrt( sum );
// retract
mitk::Index3D tempIndex;
int tempLabel( label );
for( int parameter( 0 ) ; parameter < length ; parameter++ )
{
for( int index( 0 ); index < 3; index++ )
{
tempIndex.SetElement( index,
currentPoint.GetElement( index ) + ( 1.0 + parameter ) / ( 1.0 + length ) * differenceVector[ index ] );
}
tempLabel = m_Segmentation->GetPixelValueByIndex( tempIndex );
if( !IsBackgroundLabel( tempLabel ) )
{
label = tempLabel;
mitkIndex = tempIndex;
return;
}
// hit next point without finding brain matter
currentRetractionIndex = currentRetractionIndex + retractionStepIndexSize;
if( ( currentRetractionIndex < 1 ) || ( currentRetractionIndex > ( singleTract->Size() - 2 ) ) )
{
keepRetracting = false;
}
}
}
}