[Insight-users] infinite loop in watershed filter
Michael Xanadu
xanadu.michael at googlemail.com
Fri Aug 21 08:52:13 EDT 2009
Hi,
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?
(Maybe it has something to do with 2D vs. 3D image data ?!)
Regards, Michael
typedef itk::Image< short, 3> ShortImageType;
typedef itk::RGBPixel<unsigned char> RGBPixelType;
typedef itk::Image<RGBPixelType, 3> RGBImageType;
typedef itk::Vector<float, 4> VectorPixelType;
typedef itk::Image<VectorPixelType, 3> VectorImageType;
typedef itk::Image<unsigned long, 3> LabeledImageType;
typedef itk::Image<float, 3> ScalarImageType;
typedef itk::CastImageFilter
<ShortImageType,RGBImageType>
CastingFilterType0;
typedef itk::VectorCastImageFilter
<RGBImageType, VectorImageType> CastFilterType;
typedef itk::VectorGradientAnisotropicDiffusionImageFilter
<VectorImageType, VectorImageType> DiffusionFilterType;
typedef itk::VectorGradientMagnitudeImageFilter
<VectorImageType>
GradientMagnitudeFilterType;
typedef itk::WatershedImageFilter
<ScalarImageType> WatershedFilterType;
typedef itk::Functor::ScalarToRGBPixelFunctor <unsigned
long> ColorMapFunctorType;
typedef itk::UnaryFunctorImageFilter
<LabeledImageType, RGBImageType, ColorMapFunctorType> ColorMapFilterType;
CastingFilterType0::Pointer caster0 =
CastingFilterType0::New();
CastFilterType::Pointer caster =
CastFilterType::New();
DiffusionFilterType::Pointer diffusion =
DiffusionFilterType::New();
GradientMagnitudeFilterType::Pointer gradient =
GradientMagnitudeFilterType::New();
WatershedFilterType::Pointer watershed =
WatershedFilterType::New();
ColorMapFilterType::Pointer colormapper =
ColorMapFilterType::New();
diffusion->SetNumberOfIterations( 10 );
diffusion->SetConductanceParameter( 2.0 );
diffusion->SetTimeStep(0.0625);
watershed->SetLevel( 0.05);
watershed->SetThreshold(0.0 );
gradient->SetUsePrincipleComponents(true);
caster0->SetInput(m_Dicomreader->GetITKOutput());
caster->SetInput(caster0->GetOutput());
diffusion->SetInput(caster->GetOutput());
gradient->SetInput(diffusion->GetOutput());
watershed->SetInput(gradient->GetOutput());
colormapper->SetInput(watershed->GetOutput());
colormapper->Update();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090821/37be70ab/attachment.htm>
More information about the Insight-users
mailing list