Hi,<br><br>I want to filter some 3D dicom data (512x512, 4 slices, short data) with the WatershedImageFilter, but if I call Update() then there occurs an infinite loop. Is there something wrong with my code?<br>(Maybe it has something to do with 2D vs. 3D image data ?!)<br>
<br>Regards, Michael<br><br><br><br> typedef itk::Image< short, 3> ShortImageType;<br> typedef itk::RGBPixel<unsigned char> RGBPixelType;<br> typedef itk::Image<RGBPixelType, 3> RGBImageType;<br>
typedef itk::Vector<float, 4> VectorPixelType;<br> typedef itk::Image<VectorPixelType, 3> VectorImageType;<br> typedef itk::Image<unsigned long, 3> LabeledImageType;<br> typedef itk::Image<float, 3> ScalarImageType;<br>
<br> typedef itk::CastImageFilter <ShortImageType,RGBImageType> CastingFilterType0;<br> typedef itk::VectorCastImageFilter <RGBImageType, VectorImageType> CastFilterType;<br>
typedef itk::VectorGradientAnisotropicDiffusionImageFilter <VectorImageType, VectorImageType> DiffusionFilterType;<br> typedef itk::VectorGradientMagnitudeImageFilter <VectorImageType> GradientMagnitudeFilterType; <br>
typedef itk::WatershedImageFilter <ScalarImageType> WatershedFilterType;<br> typedef itk::Functor::ScalarToRGBPixelFunctor <unsigned long> ColorMapFunctorType;<br>
typedef itk::UnaryFunctorImageFilter <LabeledImageType, RGBImageType, ColorMapFunctorType> ColorMapFilterType;<br><br> CastingFilterType0::Pointer caster0 = CastingFilterType0::New();<br>
CastFilterType::Pointer caster = CastFilterType::New();<br> DiffusionFilterType::Pointer diffusion = DiffusionFilterType::New();<br> GradientMagnitudeFilterType::Pointer gradient = GradientMagnitudeFilterType::New();<br>
WatershedFilterType::Pointer watershed = WatershedFilterType::New();<br> ColorMapFilterType::Pointer colormapper = ColorMapFilterType::New();<br><br> diffusion->SetNumberOfIterations( 10 );<br>
diffusion->SetConductanceParameter( 2.0 );<br> diffusion->SetTimeStep(0.0625);<br><br> watershed->SetLevel( 0.05);<br> watershed->SetThreshold(0.0 );<br><br> gradient->SetUsePrincipleComponents(true);<br>
<br> caster0->SetInput(m_Dicomreader->GetITKOutput());<br> caster->SetInput(caster0->GetOutput());<br> diffusion->SetInput(caster->GetOutput());<br> gradient->SetInput(diffusion->GetOutput());<br>
watershed->SetInput(gradient->GetOutput());<br> colormapper->SetInput(watershed->GetOutput());<br><br> colormapper->Update();<br>