<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt">Dear all,<br><br>I've tried to segment a 3D image using Threshold Level Set Segmentation filter.<br>I used the following code:<br><br><br>typedef float InternalPixelType;<br> const unsigned int Dimension = 3;<br> typedef itk::Image< InternalPixelType, Dimension > InternalImageType;<br> typedef unsigned char OutputPixelType;<br> typedef itk::Image< OutputPixelType, Dimension > OutputImageType;<br> typedef itk::BinaryThresholdImageFilter<InternalImageType,
OutputImageType> ThresholdingFilterType;<br> ThresholdingFilterType::Pointer thresholder = ThresholdingFilterType::New(); <br> thresholder->SetLowerThreshold( -1000.0 );<br> thresholder->SetUpperThreshold( 0.0 );<br> thresholder->SetOutsideValue( 0 );<br> thresholder->SetInsideValue( 255 );<br> typedef itk::ImageFileReader< InternalImageType > ReaderType;<br> typedef itk::ImageFileWriter< OutputImageType > WriterType;<br> ReaderType::Pointer reader = ReaderType::New();<br> WriterType::Pointer writer = WriterType::New();<br> reader->SetFileName( file );<br> reader->Update();<br> writer->SetFileName( "aaa.tif" );<br> typedef itk::FastMarchingImageFilter< InternalImageType, InternalImageType >
FastMarchingFilterType;<br> FastMarchingFilterType::Pointer fastMarching = FastMarchingFilterType::New();<br> const InternalImageType * inputImage = reader->GetOutput();<br> fastMarching->SetOutputRegion( inputImage->GetBufferedRegion() );<br> fastMarching->SetOutputSpacing( inputImage->GetSpacing() );<br> fastMarching->SetOutputOrigin( inputImage->GetOrigin() );<br> fastMarching->SetOutputDirection( inputImage->GetDirection() );<br> typedef itk::ThresholdSegmentationLevelSetImageFilter< InternalImageType, InternalImageType > ThresholdSegmentationLevelSetImageFilterType;<br> ThresholdSegmentationLevelSetImageFilterType::Pointer thresholdSegmentation = ThresholdSegmentationLevelSetImageFilterType::New();<br> thresholdSegmentation->SetPropagationScaling( 1.0 );<br>
thresholdSegmentation->SetCurvatureScaling( 1.0 );<br> thresholdSegmentation->SetMaximumRMSError( 0.02 );<br> thresholdSegmentation->SetNumberOfIterations( 1200 );<br> thresholdSegmentation->SetUpperThreshold( 30 );<br> thresholdSegmentation->SetLowerThreshold( 250 );<br> thresholdSegmentation->SetIsoSurfaceValue(0.0);<br> typedef FastMarchingFilterType::NodeContainer NodeContainer;<br> typedef FastMarchingFilterType::NodeType NodeType;<br> NodeContainer::Pointer seeds = NodeContainer::New();<br> InternalImageType::IndexType seedPosition;<br> seedPosition[0] = 358;<br> seedPosition[1] = 529;<br> seedPosition[2] = 2;<br> const double initialDistance = 5.0;<br>
NodeType node;<br> const double seedValue = - initialDistance;<br> node.SetValue( seedValue );<br> node.SetIndex( seedPosition );<br> seeds->Initialize();<br> seeds->InsertElement( 0, node );<br> fastMarching->SetTrialPoints( seeds );<br> fastMarching->SetSpeedConstant( 1.0 );<br> fastMarching->Update();<br> thresholdSegmentation->SetInput( fastMarching->GetOutput() );<br> thresholdSegmentation->SetFeatureImage( reader->GetOutput() );<br> thresholdSegmentation->Update();<br> thresholder->SetInput( thresholdSegmentation->GetOutput() );<br> thresholder->Update();<br> writer->SetInput( thresholder->GetOutput() );<br> writer->Update();<br><br><br>There is no error messange. However, the output image "aaa.tif" is black.<br>note the seed point I used is completely inside the object that I'd like to segment.
<br>Why the output image is black!. your help is really appericiated for making this code work properly.<br><br>Best Regards,<br> Mohammed<br></div><br>
</body></html>