[Insight-users] NthElementImageAdaptor can't be used for DiscreteGaussianImageFilter?

David Doria daviddoria at gmail.com
Mon Dec 6 11:46:10 EST 2010


DiscreteGaussianImageFilter seems to suffer the same "doesn't work
with CovariantVector images" that we've been discussing. I thought
NthElementImageAdaptor would do the trick, and I think I'm using it
correctly now, but I'm getting:

error: no type named ‘NeighborhoodAccessorFunctorType’ in ‘class
itk::NthElementImageAdaptor<itk::Image<itk::CovariantVector<unsigned
char, 3u>, 2u>, unsigned char>’

with this simple demo:

#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkDiscreteGaussianImageFilter.h"
#include "itkCovariantVector.h"
#include "itkNthElementImageAdaptor.h"

int main(int argc, char * argv[])
{
  typedef itk::Image<itk::CovariantVector< unsigned char, 3>, 2 >
ColorImageType;
  typedef itk::Image<unsigned char, 2 >   ScalarImageType;
  ColorImageType::Pointer image = ColorImageType::New();

  typedef itk::NthElementImageAdaptor<ColorImageType,
                              unsigned char> ImageAdaptorType;

  ImageAdaptorType::Pointer adaptor = ImageAdaptorType::New();
  adaptor->SelectNthElement(0);
  adaptor->SetImage(image);

  typedef itk::DiscreteGaussianImageFilter<
      ImageAdaptorType, ScalarImageType >  filterType;

  filterType::Pointer gaussianFilter = filterType::New();
  gaussianFilter->SetInput(adaptor);
  gaussianFilter->Update();

  return EXIT_SUCCESS;
}

Is there a different way to do this?

Thanks,

David


More information about the Insight-users mailing list