[Insight-users] a question about watershed

liu jianfei flair.liu at gmail.com
Fri Apr 7 17:21:11 EDT 2006


Hi, everyone

    I'm trying to use watershed segmetation filter. The input is a 3D
volume, which is defined as:
    typedef itk::Image< short, 3 >   ShortVolumeType;
    The expected output is defined as
     typedef itk::Image< unsigned char, 3 >   UCharVolumeType;

    My operating system is red hat linux and the program is coded by using
g++.  The code I'm writing is as follows:

    typedef itk::Functor::ScalarToRGBPixelFunctor<short>
ColorMapFunctorType;
    typedef itk::UnaryFunctorImageFilter< ShortVolumeType, RGBVolumeType,
ColorMapFunctorType> CColorMapFilterType;
    typedef itk::VectorCastImageFilter<RGBVolumeType, VectorVolumeType>
CastFilterType;
    typedef
itk::VectorGradientAnisotropicDiffusionImageFilter<VectorVolumeType,
VectorVolumeType>  DiffusionFilterType;
    typedef itk::VectorGradientMagnitudeImageFilter<VectorVolumeType>
GradientMagnitudeFilterType;
    typedef itk::WatershedImageFilter<ScalarVolumeType> WatershedFilterType;
    typedef itk::Image<unsigned long, 3>   LabeledImageType;
    typedef itk::CastImageFilter<LabeledImageType, UCharVolumeType>
CastImageFilterType;

    CColorMapFilterType::Pointer ccolormapper = CColorMapFilterType::New();
    ccolormapper->SetInput(v);

    CastFilterType::Pointer caster = CastFilterType::New();
    caster->SetInput(ccolormapper->GetOutput());

    DiffusionFilterType::Pointer diffusion = DiffusionFilterType::New();
    diffusion->SetNumberOfIterations( 5 );
    diffusion->SetConductanceParameter( 2.5 );
    diffusion->SetTimeStep(0.1);
    diffusion->SetInput(caster->GetOutput());

    GradientMagnitudeFilterType::Pointer gradient =
GradientMagnitudeFilterType::New();
    gradient->SetUsePrincipleComponents(false);
    gradient->SetInput(diffusion->GetOutput());

    WatershedFilterType::Pointer watershed = WatershedFilterType::New();
    watershed->SetLevel( 0.4 );
    watershed->SetThreshold( 0.5 );
    watershed->SetInput(gradient->GetOutput());

    CastImageFilterType::Pointer cast = CastImageFilterType::New();
    cast->SetInput(watershed->GetOutput());
    cast->Update();
    segvolume = cast->GetOutput();

   When I compiled the program, it's running fine except the last step:
building the executable. Here are the error information:

   Building executable /home/jliu1/illustrative/exampApp...
VtkCanvas.o(.gnu.linkonce.t._ZN3itk20WatershedImageFilterINS_5ImageIfLj3EEEE12GenerateDataEv+0x117):
In function `itk::WatershedImageFilter<itk::Image<float, (unsigned)3>
>::GenerateData()':
/home/krs/src/InsightToolkit-2.2.0/Code/Common/itkDerivativeOperator.txx:48:
undefined reference to `typeinfo for
itk::WatershedMiniPipelineProgressCommand'
VtkCanvas.o(.gnu.linkonce.t._ZN3itk36WatershedMiniPipelineProgressCommandC1Ev+0x19):
In function
`itk::WatershedMiniPipelineProgressCommand::WatershedMiniPipelineProgressCommand[in-charge]()':
/usr/include/c++/3.2.2/bits/stl_vector.h:891: undefined reference to `vtable
for itk::WatershedMiniPipelineProgressCommand'
VtkCanvas.o(.gnu.linkonce.t._ZN3itk13ObjectFactoryINS_36WatershedMiniPipelineProgressCommandEE6CreateEv+0x11):
In function
`itk::ObjectFactory<itk::WatershedMiniPipelineProgressCommand>::Create()':
/usr/include/c++/3.2.2/bits/stl_vector.h:967: undefined reference to
`typeinfo for itk::WatershedMiniPipelineProgressCommand'
VtkCanvas.o(.gnu.linkonce.t._ZN3itk13ObjectFactoryINS_36WatershedMiniPipelineProgressCommandEE6CreateEv+0x51):
In function
`itk::ObjectFactory<itk::WatershedMiniPipelineProgressCommand>::Create()':
/home/krs/src/InsightToolkit-2.2.0/Code/Common/itkImportImageContainer.txx:64:
undefined reference to `typeinfo for
itk::WatershedMiniPipelineProgressCommand'
collect2: ld returned 1 exit status
gmake[1]: *** [/home/jliu1/illustrative/exampApp] Error 1
gmake: *** [default_target] Error 2

Can anyone tell me what's the error in my program or cmakelist.txt? Thanks..

--
Sincerly
Jianfei Liu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20060407/f40a2449/attachment.html


More information about the Insight-users mailing list