<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&nbsp;</div><div><br></div><div>(or RGB&nbsp;if&nbsp;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&nbsp;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>&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;</div><div id="yiv223038066"><br></div><div id="yiv223038066">&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;</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&nbsp;&nbsp; float&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InternalPixelType;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">const&nbsp;&nbsp;&nbsp;&nbsp; unsigned int&nbsp;&nbsp;&nbsp; Dimension = 3;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef itk::Image&lt; InternalPixelType, Dimension &gt;&nbsp; InternalImageType;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef unsigned
 char&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OutputPixelType;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef itk::Image&lt; OutputPixelType, Dimension &gt; OutputImageType;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef itk::BinaryThresholdImageFilter&lt;InternalImageType, OutputImageType&gt; ThresholdingFilterType;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">ThresholdingFilterType::Pointer thresholder = ThresholdingFilterType::New();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholder-&gt;SetLowerThreshold( -1000.0 );<br style="line-height: 1.2em;
 outline-style: none; outline-width: initial; outline-color: initial; ">thresholder-&gt;SetUpperThreshold(&nbsp;&nbsp;&nbsp;&nbsp; 0.0 );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholder-&gt;SetOutsideValue(&nbsp; 0&nbsp; );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholder-&gt;SetInsideValue(&nbsp; 255 );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef&nbsp; itk::ImageFileReader&lt; InternalImageType &gt; ReaderType;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef&nbsp; itk::ImageFileWriter&lt;&nbsp; OutputImageType&nbsp; &gt; 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-&gt;SetFileName( file );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">reader-&gt;Update();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">writer-&gt;SetFileName( "aaa.tif" );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef&nbsp; itk::FastMarchingImageFilter&lt; InternalImageType, InternalImageType &gt;&nbsp; FastMarchingFilterType;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">FastMarchingFilterType::Pointer&nbsp; fastMarching = FastMarchingFilterType::New();<br style="line-height: 1.2em;
 outline-style: none; outline-width: initial; outline-color: initial; ">const InternalImageType * inputImage = reader-&gt;GetOutput();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">fastMarching-&gt;SetOutputRegion( inputImage-&gt;GetBufferedRegion() );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">fastMarching-&gt;SetOutputSpacing( inputImage-&gt;GetSpacing() );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">fastMarching-&gt;SetOutputOrigin( inputImage-&gt;GetOrigin() );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">fastMarching-&gt;SetOutputDirection( inputImage-&gt;GetDirection() );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef&nbsp;
 itk::ThresholdSegmentationLevelSetImageFilter&lt; InternalImageType, InternalImageType &gt; ThresholdSegmentationLevelSetImageFilterType;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">ThresholdSegmentationLevelSetImageFilterType::Pointer thresholdSegmentation =&nbsp; ThresholdSegmentationLevelSetImageFilterType::New();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholdSegmentation-&gt;SetPropagationScaling( 1.0 );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholdSegmentation-&gt;SetCurvatureScaling( 1.0 );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholdSegmentation-&gt;SetMaximumRMSError( 0.02 );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial;
 ">thresholdSegmentation-&gt;SetNumberOfIterations( 1200 );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholdSegmentation-&gt;SetUpperThreshold( 250 );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholdSegmentation-&gt;SetLowerThreshold( 30 );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholdSegmentation-&gt;SetIsoSurfaceValue(0.0);<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef FastMarchingFilterType::NodeContainer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NodeContainer;<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">typedef
 FastMarchingFilterType::NodeType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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&nbsp; 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-&gt;Initialize();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">seeds-&gt;InsertElement( 0, node );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">fastMarching-&gt;SetTrialPoints(&nbsp; seeds&nbsp; );<br style="line-height: 1.2em; outline-style: none;
 outline-width: initial; outline-color: initial; ">fastMarching-&gt;SetSpeedConstant( 1.0 );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">fastMarching-&gt;Update();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholdSegmentation-&gt;SetInput( fastMarching-&gt;GetOutput() );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholdSegmentation-&gt;SetFeatureImage( reader-&gt;GetOutput() );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholdSegmentation-&gt;Update();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">thresholder-&gt;SetInput( thresholdSegmentation-&gt;GetOutput() );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial;
 ">thresholder-&gt;Update();<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">writer-&gt;SetInput( thresholder-&gt;GetOutput() );<br style="line-height: 1.2em; outline-style: none; outline-width: initial; outline-color: initial; ">writer-&gt;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.&nbsp;&nbsp;<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&nbsp; 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; ">&nbsp;Mohammed</span></div></td></tr></table><br>