<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><div id="yiv223038066"><table cellspacing="0" cellpadding="0" border="0" id="yiv223038066bodyDrftID" class="yiv223038066"><tbody><tr><td id="yiv223038066drftMsgContent" style="font:inherit;font-family:arial;font-size:10pt;">Hi Mohammed,<div><br></div><div>1. Try to change your internal pixel type from float to unsigned char or unsigned short </div><div><br></div><div>(or RGB if they are colored).</div><div><br></div><div>2. Correct, 99.9% :), fast marching segmentation is used to produce the initial level set.</div><div><br></div><div>The initial distance approximates the distance between the seed points and the level set.</div><div><br></div><div>3. The threshold is assigned by the user and finding an optimum value depends on the</div><div><br></div><div>intensity values of the region to be
segmented.</div><div><br></div><div>HTH,</div><div><br></div><div>Dawood</div><div><br></div><div><br></div></td></tr></tbody></table>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</div><div id="yiv223038066"><br></div><div id="yiv223038066">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<</div><div id="yiv223038066"><br></div><div id="yiv223038066"><br></div><div id="yiv223038066"><span class="Apple-style-span" style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; line-height: 19px; ">Dear all,<br
style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "><br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">Actually the code that is shown in this message for you is used for segment a 3D image based on Threshold Level Set Segmentation Filter, what I did is just copy this code from Examples/Segmentation/ThresholdSegmentationLevelSetImageFilter.cxx<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">I did it adjustable for my image. which means: the seed point position I used is completely inside the ROI, file is the file name of my input image it just 1024 x 1024 x 2 gray scale tif image for testing, aaa.tif is the output image, and [30, 50] are the lower and upper threshold interval.<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "><br style="line-height: 1.2em;
outline-style: none; outline-width: initial; outline-color: initial; "><br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "><br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef float InternalPixelType;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">const unsigned int Dimension = 3;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef itk::Image< InternalPixelType, Dimension > InternalImageType;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef unsigned
char OutputPixelType;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef itk::Image< OutputPixelType, Dimension > OutputImageType;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef itk::BinaryThresholdImageFilter<InternalImageType, OutputImageType> ThresholdingFilterType;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">ThresholdingFilterType::Pointer thresholder = ThresholdingFilterType::New(); <br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholder->SetLowerThreshold( -1000.0 );<br style="line-height: 1.2em;
outline-style: none; outline-width: initial; outline-color: initial; ">thresholder->SetUpperThreshold( 0.0 );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholder->SetOutsideValue( 0 );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholder->SetInsideValue( 255 );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef itk::ImageFileReader< InternalImageType > ReaderType;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef itk::ImageFileWriter< OutputImageType > WriterType;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">ReaderType::Pointer reader = ReaderType::New();<br style="line-height:
1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">WriterType::Pointer writer = WriterType::New();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">reader->SetFileName( file );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">reader->Update();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">writer->SetFileName( "aaa.tif" );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef itk::FastMarchingImageFilter< InternalImageType, InternalImageType > FastMarchingFilterType;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">FastMarchingFilterType::Pointer fastMarching = FastMarchingFilterType::New();<br style="line-height: 1.2em;
outline-style: none; outline-width: initial; outline-color: initial; ">const InternalImageType * inputImage = reader->GetOutput();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">fastMarching->SetOutputRegion( inputImage->GetBufferedRegion() );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">fastMarching->SetOutputSpacing( inputImage->GetSpacing() );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">fastMarching->SetOutputOrigin( inputImage->GetOrigin() );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">fastMarching->SetOutputDirection( inputImage->GetDirection() );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef
itk::ThresholdSegmentationLevelSetImageFilter< InternalImageType, InternalImageType > ThresholdSegmentationLevelSetImageFilterType;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">ThresholdSegmentationLevelSetImageFilterType::Pointer thresholdSegmentation = ThresholdSegmentationLevelSetImageFilterType::New();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholdSegmentation->SetPropagationScaling( 1.0 );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholdSegmentation->SetCurvatureScaling( 1.0 );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholdSegmentation->SetMaximumRMSError( 0.02 );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial;
">thresholdSegmentation->SetNumberOfIterations( 1200 );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholdSegmentation->SetUpperThreshold( 250 );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholdSegmentation->SetLowerThreshold( 30 );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholdSegmentation->SetIsoSurfaceValue(0.0);<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef FastMarchingFilterType::NodeContainer NodeContainer;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef
FastMarchingFilterType::NodeType NodeType;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">NodeContainer::Pointer seeds = NodeContainer::New();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">InternalImageType::IndexType seedPosition;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">seedPosition[0] = 358;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">seedPosition[1] = 529;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">seedPosition[2] = 2;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">const double initialDistance = 5.0;<br style="line-height:
1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">NodeType node;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">const double seedValue = - initialDistance;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">node.SetValue( seedValue );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">node.SetIndex( seedPosition );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">seeds->Initialize();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">seeds->InsertElement( 0, node );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">fastMarching->SetTrialPoints( seeds );<br style="line-height: 1.2em; outline-style: none;
outline-width: initial; outline-color: initial; ">fastMarching->SetSpeedConstant( 1.0 );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">fastMarching->Update();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholdSegmentation->SetInput( fastMarching->GetOutput() );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholdSegmentation->SetFeatureImage( reader->GetOutput() );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholdSegmentation->Update();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholder->SetInput( thresholdSegmentation->GetOutput() );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial;
">thresholder->Update();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">writer->SetInput( thresholder->GetOutput() );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">writer->Update();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "><br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "><br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">Firstly, There is no error messange. However, the output image "aaa.tif" is black. so I don't have interperation about what's the error. I just want to make it works. your help is really appericiated about this.<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "><br style="line-height: 1.2em; outline-style:
none; outline-width: initial; outline-color: initial; ">Secondly, the purpose of using Fast Marching segmentation is generate the initial countor based on the seed point to use it as the countor image (or the zero level set image) to use it as input to the ThresholdLevelSet Filter. is it right?. Also, I cann't understand what is the purpose of initialDistance for the fast marching. I'm sorry I'm not familar with Level Set and ITK documentation is not enough for me to understand everything. <br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "><br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">Thirdly, I know that the purpose of ThresholdLevelSet is find the optimal lower and upper thresholds for segment the image using Level Set which this filter is the extension of the Connected Threshold method. is it right?. How is it?.<br
style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "><br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">Best Regards,<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; "> Mohammed</span></div></td></tr></table><br>