[Insight-users] itkGradientVectorFlowImageFilter problems at compilation
Julien Jomier
jjomier at cs.unc.edu
Sun, 11 Apr 2004 14:24:13 -0400
Hi Julien,
GradientVectorFlowImageFilter is taking a image of Covariant Vectors as
input and not an image of scalars.
therefore, you should replace
typedef itk::GradientVectorFlowImageFilter<ImageType,GradientImageType>
GradientVectorFlowFilterType;
by
typedef
itk::GradientVectorFlowImageFilter<GradientImageType,GradientImageType>
GradientVectorFlowFilterType;
and instead of using the gradient magnitude filter wich produces a scalar
value at each pixel, use the itkGradientImageFilter or the
itkGradientRecursiveGaussianImageFilter.
You can take a look at itkGradientVectorFlowImageFilterTest.cxx in the
Testing/Code/Algorithms directory for an example.
Hope this helps,
Julien
> -----Original Message-----
> From: insight-users-admin at itk.org
> [mailto:insight-users-admin at itk.org] On Behalf Of Julien Mercenier
> Sent: Sunday, April 11, 2004 1:41 PM
> To: Luis Ibanez
> Cc: insight-users at itk.org
> Subject: Re: [Insight-users] itkGradientVectorFlowImageFilter
> problems at compilation
>
>
> Hi Luis,
>
> sorry, I forgot to describe the materials I use...
>
> The version of ITK I use is release 1.4.0 (september 2003)
> The compiler Microsoft Visual C++6.0 Win32/Debug
> Athlon 1.4Ghz
>
> This code conducts to the same compilation error.
>
> Thank you so much for answering so quickly (just the time to
> have a cup of tea)...
>
> Best regards,
>
> Julien, Belgium
>
>
>
> #ifdef _MSC_VER
> #pragma warning ( disable : 4786 )
> #endif
>
>
> #include "itkGradientMagnitudeRecursiveGaussianImageFilter.h"
> // pour avoir les bords #include "itkGradientVectorFlowImageFilter.h"
>
>
> #include "itkImage.h"//serait necessaire mais je sais pas pourquoi
>
> #include "itkCovariantVector.h"//contient le champ de forces
>
> #include "itkImageFileReader.h" //lit l'image
>
> #include "itkRescaleIntensityImageFilter.h"
>
> #include "itkPoint.h"
>
>
> int main()
> {
>
>
> /***** Calcul des forces externes (utilisation de classes
> ITK) *****/
>
> const unsigned int Dimension = 3;
> typedef double PixelType;
> typedef itk::Image<PixelType, Dimension> ImageType;
>
> typedef itk::CovariantVector< double, Dimension >
> GradientPixelType; typedef itk::Image< GradientPixelType,
> Dimension > GradientImageType;
>
> typedef
> itk::GradientMagnitudeRecursiveGaussianImageFilter<ImageType,I
> mageType>
> GradientMagnitudeFilterType;
> typedef itk::GradientVectorFlowImageFilter<ImageType,
> GradientImageType>
> GradientVectorFlowFilterType;
>
> typedef itk::ImageFileReader< ImageType > ReaderType;
> ReaderType::Pointer imageReader = ReaderType::New();
>
> imageReader->SetFileName( "cible2.img");
>
> GradientMagnitudeFilterType::Pointer gradientMagnitudeFilter
> = GradientMagnitudeFilterType::New();
>
> GradientVectorFlowFilterType::Pointer gradientVectorFlowFilter
> = GradientVectorFlowFilterType::New();
>
> gradientMagnitudeFilter->SetInput( imageReader->GetOutput()
> ); gradientMagnitudeFilter->SetSigma( 1.0 );
>
> gradientVectorFlowFilter->SetInput(
> gradientMagnitudeFilter->GetOutput());
> gradientVectorFlowFilter->SetTimeStep(1.0);
> gradientVectorFlowFilter->SetNoiseLevel(0.1);
> gradientVectorFlowFilter->SetIterationNum(20);
>
>
>
> gradientVectorFlowFilter->Update();
>
> std::cout << "The gradient map created!" << std::endl;
>
> GradientImageType *ChampForce;
> ChampForce = gradientVectorFlowFilter->GetOutput();
>
> typedef itk::Point< double,
> GradientImageType::ImageDimension > PointType; PointType point;
>
> GradientImageType::IndexType pixelIndex;
>
>
> return EXIT_SUCCESS;
> }
>
>
>
>
> ----- Original Message -----
> From: "Luis Ibanez" <luis.ibanez at kitware.com>
> To: "Julien Mercenier" <itk_julienmercenier at hotmail.com>
> Cc: <insight-users at itk.org>
> Sent: Sunday, April 11, 2004 7:13 PM
> Subject: Re: [Insight-users] itkGradientVectorFlowImageFilter
> problems at compilation
>
>
> >
> >
> > Hi Julien,
> >
> > What version of ITK are you using ?
> >
> > The current test for this filter is working
> > fine on the Dashboard...
> >
> > Could you please post a minimal (but complete)
> > example of code that is producing this compiler
> > error.
> >
> >
> > Thanks
> >
> >
> > Luis
> >
> >
> > -------------------------
> > Julien Mercenier wrote:
> >
> > > Hi everyone,
> > >
> > > I've got problems with
> itkGradientVectorFlowImageFilter.
> > > I've tried many things but do not understand the error
> message.
> > >
> > > Here is the part of my code related to this filter :
> > >
> > > #include
> "itkGradientMagnitudeRecursiveGaussianImageFilter.h" //egdes
> > > #include "itkGradientVectorFlowImageFilter.h"
> > >
> > > #include "itkImage.h"
> > >
> > > #include "itkCovariantVector.h"
> > >
> > > #include "itkImageFileReader.h"
> > >
> > > #include "itkRescaleIntensityImageFilter.h"
> > >
> > > #include "itkPoint.h"
> > >
> > > *main*...
> > > ...
> > >
> > > const unsigned int Dimension = 3;
> > > typedef double PixelType;
> > > typedef itk::Image<PixelType, Dimension> ImageType;
> > >
> > > typedef itk::CovariantVector< double, Dimension >
> > > GradientPixelType; typedef itk::Image<
> GradientPixelType, Dimension
> > > > GradientImageType;
> > >
> > > typedef
> > >
> itk::GradientMagnitudeRecursiveGaussianImageFilter<ImageType,I
> mageType>
> > > GradientMagnitudeFilterType;
> > > typedef itk::GradientVectorFlowImageFilter<ImageType,
> GradientImageType>
> > > GradientVectorFlowFilterType;
> > >
> > > typedef itk::ImageFileReader< ImageType > ReaderType;
> > > ReaderType::Pointer imageReader = ReaderType::New();
> > >
> > > imageReader->SetFileName( "cible2.img");
> > >
> > > GradientMagnitudeFilterType::Pointer
> > > gradientMagnitudeFilter
> > > = GradientMagnitudeFilterType::New();
> > >
> > > GradientVectorFlowFilterType::Pointer gradientVectorFlowFilter
> > > = GradientVectorFlowFilterType::New();
> > >
> > > gradientMagnitudeFilter->SetInput( imageReader->GetOutput() );
> > > gradientMagnitudeFilter->SetSigma( 1.0 );
> > >
> > > gradientVectorFlowFilter->SetInput(
> gradientMagnitudeFilter->GetOutput());
> > > gradientVectorFlowFilter->SetTimeStep(1.0);
> > > gradientVectorFlowFilter->SetNoiseLevel(0.1);
> > > gradientVectorFlowFilter->SetIterationNum(20);
> > >
> > > gradientVectorFlowFilter->Update();
> > >
> > >
> > >
> > > the first lignes of the error message is :
> > >
> > > --------------------Configuration: ferrantsansfixeGVF - Win32
> > > Debug--------------------
> > > Compiling...
> > > ferrantsansfixeGVF.cxx
> > > J:\Documents and Settings\Administrateur\Mes
> > >
> documents\cours\TFE\ITK\Code\Algorithms\itkGradientVectorFlowI
> mageFilter.txx
> (115)
> > > : error C2109: subscript requires array or pointer type
> > > J:\Documents and Settings\Administrateur\Mes
> > > documents\cours\TFE\ITK\Code\Common\itkSize.h(177) :
> while compiling
> > > class-template member function 'void __thiscall
> > > itk::GradientVectorFlowImageFilter<class
> itk::Image<double,3>,class
> > > itk::Image< class itk::CovariantVector<double,3>,3>
> > > >::InitInterImage(void)' J:\Documents and
> > > Settings\Administrateur\Mes
> > >
> documents\cours\TFE\ITK\Code\Algorithms\itkGradientVectorFlowI
> mageFilter.txx
> (135)
> > > : error C2109: subscript requires array or pointer type
> > > J:\Documents and Settings\Administrateur\Mes
> > > documents\cours\TFE\ITK\Code\Common\itkSize.h(177) :
> while compiling
> > > class-template member function 'void __thiscall
> > > itk::GradientVectorFlowImageFilter<class
> itk::Image<double,3>,class
> > > itk::Image< class itk::CovariantVector<double,3>,3>
> > > >::InitInterImage(void)'
> > >
> > >
> > > Thanks in advance for your answers...
> > >
> > > Best regards.
> > >
> > > Julien, Belgium.
> >
> >
> >
> >
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-> users
>