this->m_VesselnessThreshold * this->m_VesselnessMax / TScalar( 100 );
// Composite image
- typename TScalarImage::Pointer composite = TScalarImage::New( );
- composite->CopyInformation( vesselness );
- composite->SetBufferedRegion( vesselness->GetBufferedRegion( ) );
- composite->Allocate( );
+ typename TScalarImage::Pointer composite;
this->_Composite( composite, labels, vesselness );
// Extract slices
} // rof
// Random walker slice-by-slice
- this->_GoDown( binaryTree, data3D, fusion, numSlices );
- this->_GoUp( binaryTree, data3D, fusion, numSlices );
+ this->_RandomWalker( binaryTree, data3D, fusion, true );
+ this->_RandomWalker( binaryTree, data3D, fusion, false );
// Join results
typedef itk::JoinSeriesImageFilter< _TSliceImage, TImage > _TJoin;
typename TScalarImage::RegionType region = labels->GetRequestedRegion( );
// Composite image
- typename TScalarImage::Pointer composite = TScalarImage::New( );
+ composite = TScalarImage::New( );
composite->CopyInformation( vesselness );
composite->SetBufferedRegion( vesselness->GetBufferedRegion( ) );
composite->Allocate( );
template< class _TBinaryTree, class _TData3D, class _TFusion >
void
fpa::Common::SliceBySliceRandomWalker< _TImage, _TLabels, _TScalarImage >::
-_GoDown(
+_RandomWalker(
_TBinaryTree& binaryTree,
const _TData3D& data3D,
const _TFusion& fusion,
- int numSlices
+ bool down
)
{
typedef typename _TBinaryTree::value_type _TSliceBinaryPtr;
typedef typename _TSliceFusionPtr::ObjectType _TSliceFusion;
typedef typename _TSliceFusion::PixelType _TSliceScalar;
- int z = -1;
- while( z < numSlices - 2 )
+ int numSlices = binaryTree.size( );
+ int z = ( down )? -1: numSlices;
+ int o = ( down )? 1: -1;
+ while( ( down && z < numSlices - 2 ) || ( !down && z > 1 ) )
{
- z++;
+ z += o;
_TSliceBinaryPtr tmp = binaryTree[ z ];
- _TSliceBinaryPtr next = binaryTree[ z + 1 ];
- _TSliceData3DPtr data = data3D[ z + 1 ];
- _TSliceFusionPtr vess = fusion[ z + 1 ];
+ _TSliceBinaryPtr next = binaryTree[ z + o ];
+ _TSliceData3DPtr data = data3D[ z + o ];
+ _TSliceFusionPtr vess = fusion[ z + o ];
typename _TSliceBinary::RegionType region = tmp->GetRequestedRegion( );
// Create seeds and background
rw->SetEdgeFunction( edge );
// Keep maximum
- /* TODO
- typedef itk::MaximumImageFilter<SliceType> MaxFilterType;
- MaxFilterType::Pointer maxFilter = MaxFilterType::New();
- maxFilter->SetInput(0, img2);
- maxFilter->SetInput(1, next);
- maxFilter->Update();
-
- SliceType::Pointer sth = maxFilter->GetOutput();
- ImageAlgorithm::Copy(sth.GetPointer(), binaryTree[z + 1].GetPointer(), sth->GetRequestedRegion(), binaryTree[z + 1]->GetRequestedRegion());
- delete[] probs;
- */
- }
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage, class _TLabels, class _TScalarImage >
-template< class _TBinaryTree, class _TData3D, class _TFusion >
-void
-_GoUp(
- _TBinaryTree& binaryTree,
- const _TData3D& data3D,
- const _TFusion& fusion,
- int numSlices
- )
-{
+ typedef itk::MaximumImageFilter< _TSliceBinary > _TMax;
+ _TMax::Pointer max = _TMax::New();
+ max->SetInput( 0, rw->GetOutput( ) );
+ max->SetInput( 1, next );
+ max->Update( );
+ binaryTree[ z + o ] = max->GetOutput( );
+ binaryTree[ z + o ]->DisconnectPipeline( );
+
+ } // elihw
}
#endif // __fpa__Common__SliceBySliceRandomWalker__hxx__