[Insight-users] NthElementImageAdaptor can't be used for DiscreteGaussianImageFilter?
Luis Ibanez
luis.ibanez at kitware.com
Fri Dec 10 05:28:14 EST 2010
Hi David,
The filters that use Neighborhood operators do not
support ImageAdaptors.
You can use the SmoothingRecursiveGaussianImageFilter
instead of the DiscreteGaussian.
Here is the modified version that compiles fine for me:
#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkDiscreteGaussianImageFilter.h"
#include "itkSmoothingRecursiveGaussianImageFilter.h"
#include "itkCovariantVector.h"
#include "itkNthElementImageAdaptor.h"
int main(int argc, char * argv[])
{
const unsigned int Dimension = 2;
typedef unsigned char PixelComponentType;
typedef itk::Image<itk::CovariantVector< PixelComponentType, 3>,
Dimension > ColorImageType;
typedef itk::Image<PixelComponentType, Dimension > ScalarImageType;
ColorImageType::Pointer image = ColorImageType::New();
typedef itk::NthElementImageAdaptor<ColorImageType,
PixelComponentType> ImageAdaptorType;
ImageAdaptorType::Pointer adaptor = ImageAdaptorType::New();
adaptor->SelectNthElement(0);
adaptor->SetImage(image);
typedef itk::SmoothingRecursiveGaussianImageFilter<
ImageAdaptorType, ScalarImageType > filterType;
filterType::Pointer gaussianFilter = filterType::New();
gaussianFilter->SetInput(adaptor);
gaussianFilter->Update();
return EXIT_SUCCESS;
}
Regards,
Luis
-----------------------------------------------------------------------
On Mon, Dec 6, 2010 at 11:46 AM, David Doria <daviddoria at gmail.com> wrote:
> 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
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.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