[Insight-users] itkGradientMagnitudeImageFilter

Miller, James V (Research) millerjv at crd . ge . com
Thu, 22 May 2003 16:13:55 -0400


Chad,

Can you try to make a change to your copy of GradientMagnitudeImageFilter?

I don't know what version of the GradientMagnitudeImageFilter you have but 
around line 123 (which is inside the ThreadedGenerateData method), there is 
a line of code that reads

  // Set up operators
  DerivativeOperator<OutputPixelType, ImageDimension> op[ImageDimension];

Can you try changing this to read

  // Set up operators
  DerivativeOperator<InputPixelType, ImageDimension> op[ImageDimension];




-----Original Message-----
From: Chad Washington [mailto:chad . w . washington at vanderbilt . edu]
Sent: Thursday, May 22, 2003 3:59 PM
To: insight-users at public . kitware . com
Subject: [Insight-users] itkGradientMagnitudeImageFilter


I am trying to use the GradientMagnitudeImageFilter with the following 
definitions:
typedef itk::Image<int, 2> InputImageType;
typedef itk::Image<float, 2> OutputImageType;
typedef itk::GradientMagnitudeImageFilter< InputImageType, OutputImageType >

FilterType;

In my code I try to instantiate two objects of FilterType,
FilterType::Pointer filter1 = FilterType::New();
FilterType::Pointer filter2 = FilterType::New();

I receive the following errors at compilation:
Insight/Code/BasicFilters/itkGradientMagnitudeImageFilter.txx: In
   member function `void itk::GradientMagnitudeImageFilter<TInputImage,
   TOutputImage>::ThreadedGenerateData(itk::ImageToImageFilter<TInputImage,
   TOutputImage>::OutputImageRegionType&, int) [with TInputImage =
ImageType,
   TOutputImage = FloatImageType]':
Insight/Code/Common/itkPointLocator.txx:161:   instantiated from here
Insight/Code/BasicFilters/itkGradientMagnitudeImageFilter.txx:163: no
   match for call to `(itk::NeighborhoodInnerProduct<ImageType, PixelType,
   PixelType>) (std::slice&, itk::ConstNeighborhoodIterator<ImageType,
   itk::ZeroFluxNeumannBoundaryCondition<ImageType> >&,
   itk::DerivativeOperator<float, 2, itk::NeighborhoodAllocator<float> >&)'
Insight/Code/Common/itkNeighborhoodInnerProduct.txx:32: candidates
   are: TComputation itk::NeighborhoodInnerProduct<TImage, TOperator,
   TComputation>::operator()(const std::slice&, const
   itk::ConstNeighborhoodIterator<TImage,
   itk::ZeroFluxNeumannBoundaryCondition<TImage> >&, const
   itk::Neighborhood<TOperator, itk::NeighborhoodInnerProduct<TImage,
   TOperator, TComputation>::ImageDimension,
   itk::NeighborhoodAllocator<TOperator> >&) const [with TImage = ImageType,
   TOperator = PixelType, TComputation = PixelType]
Insight/Code/Common/itkNeighborhoodInnerProduct.h:68:
            TComputation itk::NeighborhoodInnerProduct<TImage, TOperator,
   TComputation>::operator()(const itk::ConstNeighborhoodIterator<TImage,
   itk::ZeroFluxNeumannBoundaryCondition<TImage> >&, const
   itk::Neighborhood<TOperator, itk::NeighborhoodInnerProduct<TImage,
   TOperator, TComputation>::ImageDimension,
   itk::NeighborhoodAllocator<TOperator> >&) const [with TImage = ImageType,
   TOperator = PixelType, TComputation = PixelType]

To check to make sure this error was not a result of my implementation I 
edited 
Insight/Testing/Code/BasicFilters/itkGradientMagnitudeImageFilterTest.cxx by

adding the line
typedef itk::Image<int, 2> InputImageType;
and editing the line
itk::GradientMagnitudeImageFilter<ImageType, ImageType>::Pointer 
        filter =
        itk::GradientMagnitudeImageFilter<ImageType, ImageType>::New();
to be
itk::GradientMagnitudeImageFilter<InputImageType, ImageType>::Pointer 
        filter =
        itk::GradientMagnitudeImageFilter<InputImageType, ImageType>::New();
I received the same errors.  I understand the reason for requiring the 
OutputImageType to be of PixelType float, but why does the InputImage have 
this requirement?
Thanks for your help,
Chad Washington
Biomedical Modeling Laboratory
Department of Biomedical Engineering
Vanderbilt University
_______________________________________________
Insight-users mailing list
Insight-users at public . kitware . com
http://public . kitware . com/mailman/listinfo/insight-users