#include <string>
#include <tclap/CmdLine.h>
+#include <itkBinaryThresholdImageFilter.h>
#include <itkImage.h>
#include <fpa/Filters/Image/RandomWalker.h>
#include <fpa/Functors/Dijkstra/Image/Gaussian.h>
double t = CTBronchi::MeasureTime( filter );
std::cout << "FastRandomWalk executed in " << t << " s" << std::endl;
+ // Extract label
+ typedef itk::BinaryThresholdImageFilter< TLabels, TLabels > _TExtract;
+ typename _TExtract::Pointer extract = _TExtract::New( );
+ extract->SetInput( filter->GetOutputLabels( ) );
+ extract->SetInsideValue( 1 );
+ extract->SetOutsideValue( 0 );
+ extract->SetLowerThreshold( 1 );
+ extract->SetUpperThreshold( 1 );
+ t = CTBronchi::MeasureTime( extract );
+ std::cout << "Extract labels executed in " << t << " s" << std::endl;
+
// Write result
- CTBronchi::WriteImage( filter->GetOutputLabels( ), out.getValue( ) );
+ CTBronchi::WriteImage( extract->GetOutput( ), out.getValue( ) );
}
catch( std::exception& err )
{
#define __fpa__Common__SliceBySliceRandomWalker__hxx__
#include <vector>
+#include <itkBinaryThresholdImageFilter.h>
#include <itkExtractImageFilter.h>
#include <itkImageRegionConstIterator.h>
#include <itkImageRegionIterator.h>
// Create seeds and background
_TSliceBinaryPtr seeds = _TSliceBinary::New( );
seeds->CopyInformation( tmp );
- seeds->SetRequestedRegion( region );
+ seeds->SetBufferedRegion( region );
seeds->Allocate( );
seeds->FillBuffer( 0 );
rw->SetInputLabels( seeds );
rw->SetEdgeFunction( edge );
+ // Extract label
+ typedef itk::BinaryThresholdImageFilter< _TSliceBinary, _TSliceBinary > _TExtract;
+ typename _TExtract::Pointer extract = _TExtract::New( );
+ extract->SetInput( rw->GetOutput( ) );
+ extract->SetInsideValue( 1 );
+ extract->SetOutsideValue( 0 );
+ extract->SetLowerThreshold( 1 );
+ extract->SetUpperThreshold( 1 );
+
// Keep maximum
typedef itk::MaximumImageFilter< _TSliceBinary > _TMax;
typename _TMax::Pointer max = _TMax::New();
- max->SetInput( 0, rw->GetOutput( ) );
+ max->SetInput( 0, extract->GetOutput( ) );
max->SetInput( 1, next );
max->Update( );
binaryTree[ z + o ] = max->GetOutput( );