<div>Hi,</div>
<div>I segment the image with watershedImageFilter. But only the top-half&nbsp;of the&nbsp;image has result after watershed segmentation, the bottom-half of the image is blank. </div>
<div>There are two parameters in watershedImageFilter, is there any rough rule to set the level and theshold for a given image?</div>
<div>My code is as follows:</div>
<div>//******code</div>
<div>
<p>typedef float InternalPixelType;<br>&nbsp;const unsigned int Dimension = 2;<br>&nbsp;typedef itk::Image&lt; InternalPixelType, Dimension &gt; InternalImageType;</p>
<p>&nbsp;typedef unsigned char OutputPixelType;<br>&nbsp;typedef itk::Image&lt; OutputPixelType, Dimension &gt; OutputImageType;</p>
<p>&nbsp;typedef unsigned long&nbsp; tempPixelType;<br>&nbsp;typedef itk::Image&lt;tempPixelType,Dimension&gt; tempImageType;</p>
<p>&nbsp;typedef itk::ImageFileReader&lt; InternalImageType &gt; ReaderType;<br>&nbsp;typedef itk::ImageFileWriter&lt; InternalImageType&gt; WriterType;</p>
<p><br>&nbsp;ReaderType::Pointer reader=ReaderType::New();<br>&nbsp;typedef itk::GDCMImageIO DCMIamgeIo;<br>&nbsp;&nbsp;&nbsp; DCMIamgeIo::Pointer gdcmImageIO=DCMIamgeIo::New();<br>&nbsp;&nbsp;&nbsp; reader-&gt;SetFileName(&quot;BrainProtonDensitySlice.png&quot;);
<br>&nbsp;&nbsp; // reader-&gt;SetImageIO(gdcmImageIO);</p>
<p>&nbsp;/*<br>&nbsp;WriterType::Pointer writer1=WriterType::New();<br>&nbsp;&nbsp;writer1-&gt;SetInput(reader-&gt;GetOutput());<br>&nbsp;&nbsp;writer1-&gt;SetFileName(&quot;shuchu.dcm&quot;);<br>&nbsp;&nbsp;writer1-&gt;SetImageIO(gdcmImageIO);<br>&nbsp;&nbsp;writer1-&gt;Update();*/
</p>
<p>//*****above writer setences also have error when execute the pragram???<br>&nbsp;<br>&nbsp;typedef itk::GradientAnisotropicDiffusionImageFilter&lt;InternalImageType,InternalImageType&gt;<br>&nbsp;&nbsp;diffusionFilterType;<br>&nbsp;diffusionFilterType::Pointer diffusion=diffusionFilterType::New();
</p>
<p>&nbsp;typedef itk::GradientMagnitudeImageFilter&lt;InternalImageType,InternalImageType&gt; gradientMagnitudeFilterType;<br>&nbsp;gradientMagnitudeFilterType::Pointer gradientMagnitude=gradientMagnitudeFilterType::New();<br>&nbsp;typedef itk::WatershedImageFilter&lt;InternalImageType&gt; watershedFilterType;
<br>&nbsp;watershedFilterType::Pointer watershed=watershedFilterType::New();</p>
<p>&nbsp;diffusion-&gt;SetNumberOfIterations(5);<br>&nbsp;diffusion-&gt;SetConductanceParameter(9);<br>&nbsp;diffusion-&gt;SetTimeStep(0.125);</p>
<p>&nbsp;watershed-&gt;SetLevel(0.15);//control the lower thresholding of the input&nbsp;<br>&nbsp;watershed-&gt;SetThreshold(0.06);//control watershed depth<br><br>&nbsp;typedef itk::RescaleIntensityImageFilter&lt;tempImageType,InternalImageType&gt; RescaleFilterType;&nbsp;
<br>&nbsp;RescaleFilterType::Pointer rescaler = RescaleFilterType::New();</p>
<p><br>&nbsp;//Pipeline<br>&nbsp;diffusion-&gt;SetInput(reader-&gt;GetOutput());<br>&nbsp;gradientMagnitude-&gt;SetInput(diffusion-&gt;GetOutput());<br>&nbsp;watershed-&gt;SetInput(gradientMagnitude-&gt;GetOutput());<br>&nbsp;rescaler-&gt;SetInput(watershed-&gt;GetOutput());
<br>&nbsp;rescaler-&gt;Update();</p>
<p>//*******end</p>
<p>thanks a lot</p></div>