[Insight-users] itkGradientVectorFlowImageFilter problems at compilation

Julien Mercenier itk_julienmercenier at hotmail.com
Sun, 11 Apr 2004 19:40:47 +0200


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,ImageType>
  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,ImageType>
> >   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\itkGradientVectorFlowImageFilter.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\itkGradientVectorFlowImageFilter.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.
>
>
>
>