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

Amardeep Singh amar.singh at gmx.de
Thu Mar 5 14:36:21 EST 2009


Dear Baoyun

If you look at the code of the GradientVectorFlowImageFilter, you will 
see that the code follows the part "C. Numerical Implementation" of the 
paper "Snakes, Shapes, and Gradient Vector Flow", IEEE Transactions on 
Image Processing, vol. 7, nr. 3, March 1998. quite strictly.
So, the way, the gradient vector flow is calculated is indeed the same. 
No reason there to reinvent the wheel, I would say.
You should, however, be aware of the subtle, but important difference, 
that the mentioned paper refers to snakes. Snakesrefer to parametrized 
deformable models. You might think of it as "knots" that are moved by 
external forces. This is sometimes called a Lagrangian formulation (you 
are sitting on the knots that are moving according to the forces).
You are using a level set formulation. The level set is purely intrinsic 
and independent of the parameterization of the final surface. Your final 
contour is given by the 0 isosurface of the evolved level set (Eulerian 
formulation, i.e. the grid is fixed).
I would suggest that you look at the introduction of the paper. You will 
see that the difference that I have mentioned is talked about there, as 
well.
So, you should judge from your application if the results may be the 
same, keeping in mind the difference between the two approaches 
(consider e.g. if you expect topological changes of the level set). I 
would say the chances are pretty high.

Regards
Amardeep

Baoyun Li wrote:
>
> Dear Amardeep:
>  
> Thanks. Now it is working well.
>  
> Can you please tell me, once the AdvectionImage is set by gradient 
> vector flow output, is the geodesicActiveContour method equivalent to 
> the GVF snake proposed by Changyang Xu.
>  
> thanks
>  
> Baoyun
> ------------------------------------------------------------------------
> *From:* Amardeep Singh <amar.singh at gmx.de>
> *To:* Baoyun Li <baoyun_li123 at yahoo.com>
> *Cc:* insight-users at itk.org
> *Sent:* Thursday, March 5, 2009 12:59:06 PM
> *Subject:* Re: [Insight-users] input error for 
> ----geodesicActiveContour->SetAdvectionImage(m_GVFFilter->GetOutput())
>
> 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 <http://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