<div>Hi,</div>
<div>I segment the image with watershedImageFilter. But only the top-half of the 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> const unsigned int Dimension = 2;<br> typedef itk::Image< InternalPixelType, Dimension > InternalImageType;</p>
<p> typedef unsigned char OutputPixelType;<br> typedef itk::Image< OutputPixelType, Dimension > OutputImageType;</p>
<p> typedef unsigned long tempPixelType;<br> typedef itk::Image<tempPixelType,Dimension> tempImageType;</p>
<p> typedef itk::ImageFileReader< InternalImageType > ReaderType;<br> typedef itk::ImageFileWriter< InternalImageType> WriterType;</p>
<p><br> ReaderType::Pointer reader=ReaderType::New();<br> typedef itk::GDCMImageIO DCMIamgeIo;<br> DCMIamgeIo::Pointer gdcmImageIO=DCMIamgeIo::New();<br> reader->SetFileName("BrainProtonDensitySlice.png");
<br> // reader->SetImageIO(gdcmImageIO);</p>
<p> /*<br> WriterType::Pointer writer1=WriterType::New();<br> writer1->SetInput(reader->GetOutput());<br> writer1->SetFileName("shuchu.dcm");<br> writer1->SetImageIO(gdcmImageIO);<br> writer1->Update();*/
</p>
<p>//*****above writer setences also have error when execute the pragram???<br> <br> typedef itk::GradientAnisotropicDiffusionImageFilter<InternalImageType,InternalImageType><br> diffusionFilterType;<br> diffusionFilterType::Pointer diffusion=diffusionFilterType::New();
</p>
<p> typedef itk::GradientMagnitudeImageFilter<InternalImageType,InternalImageType> gradientMagnitudeFilterType;<br> gradientMagnitudeFilterType::Pointer gradientMagnitude=gradientMagnitudeFilterType::New();<br> typedef itk::WatershedImageFilter<InternalImageType> watershedFilterType;
<br> watershedFilterType::Pointer watershed=watershedFilterType::New();</p>
<p> diffusion->SetNumberOfIterations(5);<br> diffusion->SetConductanceParameter(9);<br> diffusion->SetTimeStep(0.125);</p>
<p> watershed->SetLevel(0.15);//control the lower thresholding of the input <br> watershed->SetThreshold(0.06);//control watershed depth<br><br> typedef itk::RescaleIntensityImageFilter<tempImageType,InternalImageType> RescaleFilterType;
<br> RescaleFilterType::Pointer rescaler = RescaleFilterType::New();</p>
<p><br> //Pipeline<br> diffusion->SetInput(reader->GetOutput());<br> gradientMagnitude->SetInput(diffusion->GetOutput());<br> watershed->SetInput(gradientMagnitude->GetOutput());<br> rescaler->SetInput(watershed->GetOutput());
<br> rescaler->Update();</p>
<p>//*******end</p>
<p>thanks a lot</p></div>