Hi, everyone<br>
<br>
I'm trying to use watershed segmetation filter. The input is a 3D volume, which is defined as:<br>
typedef itk::Image< short, 3 > ShortVolumeType;<br>
The expected output is defined as <br>
typedef itk::Image< unsigned char, 3 > UCharVolumeType;<br>
<br>
My operating system is red hat linux and the program is
coded by using g++. The code I'm writing is as follows:<br>
<br>
typedef itk::Functor::ScalarToRGBPixelFunctor<short> ColorMapFunctorType;<br>
typedef itk::UnaryFunctorImageFilter<
ShortVolumeType, RGBVolumeType, ColorMapFunctorType>
CColorMapFilterType;<br>
typedef itk::VectorCastImageFilter<RGBVolumeType, VectorVolumeType> CastFilterType;<br>
typedef
itk::VectorGradientAnisotropicDiffusionImageFilter<VectorVolumeType,
VectorVolumeType> DiffusionFilterType;<br>
typedef itk::VectorGradientMagnitudeImageFilter<VectorVolumeType> GradientMagnitudeFilterType; <br>
typedef itk::WatershedImageFilter<ScalarVolumeType> WatershedFilterType;<br>
typedef itk::Image<unsigned long, 3> LabeledImageType;<br>
typedef itk::CastImageFilter<LabeledImageType, UCharVolumeType> CastImageFilterType;<br>
<br>
CColorMapFilterType::Pointer ccolormapper = CColorMapFilterType::New();<br>
ccolormapper->SetInput(v);<br>
<br>
CastFilterType::Pointer caster = CastFilterType::New();<br>
caster->SetInput(ccolormapper->GetOutput());<br>
<br>
DiffusionFilterType::Pointer diffusion = DiffusionFilterType::New();<br>
diffusion->SetNumberOfIterations( 5 );<br>
diffusion->SetConductanceParameter( 2.5 );<br>
diffusion->SetTimeStep(0.1);<br>
diffusion->SetInput(caster->GetOutput());<br>
<br>
GradientMagnitudeFilterType::Pointer gradient = GradientMagnitudeFilterType::New();<br>
gradient->SetUsePrincipleComponents(false);<br>
gradient->SetInput(diffusion->GetOutput());<br>
<br>
WatershedFilterType::Pointer watershed = WatershedFilterType::New();<br>
watershed->SetLevel( 0.4 );<br>
watershed->SetThreshold( 0.5 );<br>
watershed->SetInput(gradient->GetOutput());<br>
<br>
CastImageFilterType::Pointer cast = CastImageFilterType::New();<br>
cast->SetInput(watershed->GetOutput());<br>
cast->Update();<br>
segvolume = cast->GetOutput();<br>
<br>
When I compiled the program, it's running fine except the
last step: building the executable. Here are the error information:<br>
<br>
Building executable /home/jliu1/illustrative/exampApp...<br>
VtkCanvas.o(.gnu.linkonce.t._ZN3itk20WatershedImageFilterINS_5ImageIfLj3EEEE12GenerateDataEv+0x117):
In function `itk::WatershedImageFilter<itk::Image<float,
(unsigned)3> >::GenerateData()':<br>
/home/krs/src/InsightToolkit-2.2.0/Code/Common/itkDerivativeOperator.txx:48:
undefined reference to `typeinfo for
itk::WatershedMiniPipelineProgressCommand'<br>
VtkCanvas.o(.gnu.linkonce.t._ZN3itk36WatershedMiniPipelineProgressCommandC1Ev+0x19):
In function
`itk::WatershedMiniPipelineProgressCommand::WatershedMiniPipelineProgressCommand[in-charge]()':<br>
/usr/include/c++/3.2.2/bits/stl_vector.h:891: undefined reference to `vtable for itk::WatershedMiniPipelineProgressCommand'<br>
VtkCanvas.o(.gnu.linkonce.t._ZN3itk13ObjectFactoryINS_36WatershedMiniPipelineProgressCommandEE6CreateEv+0x11):
In function
`itk::ObjectFactory<itk::WatershedMiniPipelineProgressCommand>::Create()':<br>
/usr/include/c++/3.2.2/bits/stl_vector.h:967: undefined reference to `typeinfo for itk::WatershedMiniPipelineProgressCommand'<br>
VtkCanvas.o(.gnu.linkonce.t._ZN3itk13ObjectFactoryINS_36WatershedMiniPipelineProgressCommandEE6CreateEv+0x51):
In function
`itk::ObjectFactory<itk::WatershedMiniPipelineProgressCommand>::Create()':<br>
/home/krs/src/InsightToolkit-2.2.0/Code/Common/itkImportImageContainer.txx:64:
undefined reference to `typeinfo for
itk::WatershedMiniPipelineProgressCommand'<br>
collect2: ld returned 1 exit status<br>
gmake[1]: *** [/home/jliu1/illustrative/exampApp] Error 1<br>
gmake: *** [default_target] Error 2<br>
<br>
Can anyone tell me what's the error in my program or cmakelist.txt? Thanks..<br clear="all"><br>-- <br>Sincerly<br>Jianfei Liu<br><br>