[Insight-users] input error for ----geodesicActiveContour->SetAdvectionImage(m_GVFFilter->GetOutput())

Amardeep Singh amar.singh at gmx.de
Thu Mar 5 13:59:06 EST 2009


Dear Baoyun

You have to cast the output of the GradientVectorFlowImageFilter to the 
AdvectionImageType of the GeodesicActiveContourLevelSetImageFilter.

//the following two lines you probably already have somewhere in your code
typedef itk::GeodesicActiveContourLevelSetImageFilter<InternalImageType, 
InternalImageType> GeodesicActiveContourFilterType;
GeodesicActiveContourFilterType::Pointer geodesicActiveContour = 
GeodesicActiveContourFilterType::New();

//add these...
typedef GeodesicActiveContourFilterType::VectorImageType AdvectionImageType;
typedef itk::CastImageFilter<myGradientImageType,AdvectionImageType> 
gvfCastFilterType;

Before you set the output of the gvfFilter, you do the cast:
castFilter->SetInput(m_GVFFilter->GetOutput());
geodesicActiveContour->SetAdvectionImage(castFilter->GetOutput());

Hope this helps.

Best regards
Amardeep


Baoyun Li wrote:
> Dear All:
>  
> I am trying to use the output of GradientVectorflowImageFilter to set 
> the AdvectionImage for  for geodesidcAcitveContour level set filter as :
>  
> geodesicActiveContour->SetAdvectionImage(m_GVFFilter->GetOutput())
>  
> But I got the bleow errors. I have seen somebody caster the output 
> of GradientVectorflowImageFilter, then feed into 
> geodesicActiveContour->SetAdvectionImage.
>  
> Can somebody tell me how to set the input of 
> geodesicActiveContour->SetAdvectionImage? My current input is vector 
> image obtained from GradientVectorflowImageFilter. Seems ok, what is 
> wrong?
>  
> I attatached the error messages and part of my code.
>  
> Thanks, and your help is highly appreciated.
>  
> Baoyun
>  
>  
>  
> *************************Error message
>  
>  
>  
> no matching function for call to 
> 'itk::GeodesicActiveContourLevelSetImageFilter<itk::Image<float, 3u>, 
> itk::Image<float, 3u>, 
> float>::SetAdvectionImage(itk::SmartPointer<itk::Image<itk::CovariantVector<float, 
> 3u>, 3u> >&)'
> /home/gtao/tools/ITK/Source/Code/Algorithms/itkSegmentationLevelSetImageFilter.h:228: 
> note: candidates are: void 
> itk::SegmentationLevelSetImageFilter<TInputImage, TFeatureImage, 
> TOutputPixelType>::SetAdvectionImage(typename 
> itk::SegmentationLevelSetFunction<itk::Image<TOutputPixelType, 
> itk::SegmentationLevelSetImageFilter<TInputImage,TFeatureImage,TOutputPixelType>::InputImageDimension>, 
> TFeatureImage>::VectorImageType*) [with TInputImage = 
> itk::Image<float, 3u>, TFeatureImage = itk::Image<floa
>  
> **************code
>  ///I have defined Dim=3;
>  typedef itk::CovariantVector<float, Dim> myGradientType;
>   typedef itk::Image<myGradientType, Dim>   myGradientImageType;
>   typedef itk::GradientVectorFlowImageFilter<myGradientImageType, 
> myGradientImageType>
>                                               myGVFFilterType;
>   typedef itk::GradientImageFilter<InternalImageType, float,float>
>                                               myGFilterType;
>
>   typedef itk::GradientRecursiveGaussianImageFilter<
>                                             InternalImageType,
>                                             myGradientImageType
>                                                   >  myFilterType;
>   typedef itk::LaplacianImageFilter<InternalImageType, 
> InternalImageType> myLaplacianFilterType;
>   typename myFilterType::Pointer filter = myFilterType::New();
>   typename myLaplacianFilterType::Pointer m_LFilter = 
> myLaplacianFilterType::New();
>   typename myGVFFilterType::Pointer m_GVFFilter = myGVFFilterType::New();
>  
>  //caster12 convert input int type to float type
>   filter->SetInput( caster12->GetOutput() );
>   filter->SetSigma( 1.0);
>   filter->Update();
>   m_GVFFilter->SetInput(filter->GetOutput());
>   m_GVFFilter->SetNoiseLevel(500);
>   m_GVFFilter->SetTimeStep(0.001);
>   m_GVFFilter->SetIterationNum(2);
>   m_GVFFilter->Update();
>   geodesicActiveContour->SetAutoGenerateSpeedAdvection(false);
>   typename myGradientImageType::Pointer m_GVFField;
>   m_GVFField = m_GVFFilter->GetOutput();
> ****************error happend
>   geodesicActiveContour->SetAdvectionImage(m_GVFField);
>
> ------------------------------------------------------------------------
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>   


More information about the Insight-users mailing list