[Insight-users] Iterating over an adaptor?
David Doria
daviddoria at gmail.com
Tue Nov 1 09:11:47 EDT 2011
If I create an adaptor to represent one channel of a vector image:
typedef itk::VectorImage<float, 2> VectorImageType;
VectorImageType::Pointer image = VectorImageType::New();
... Create image ...
typedef itk::VectorImageToImageAdaptor<float, 2> ImageAdaptorType;
ImageAdaptorType::Pointer adaptor = ImageAdaptorType::New();
adaptor->SetExtractComponentIndex(0);
adaptor->SetImage(image);
And then try to create an iterator:
itk::ImageRegionIterator<ImageAdaptorType> imageIterator(adaptor,
adaptor->GetLargestPossibleRegion());
I get this error:
itkImageAdaptor.hxx:334:36: error: cannot convert ‘itk::VectorImage<float,
2u>::InternalPixelType* {aka float*}’ to ‘const InternalPixelType* {aka
const itk::VariableLengthVector<float>*}’ in return
I also tried using the resulting scalar image type for the iterator:
typedef itk::Image<float, 2> ScalarImageType;
itk::ImageRegionIterator<ScalarImageType> imageIterator(adaptor,
adaptor->GetLargestPossibleRegion());
but of course I get this error:
VectorImageToImageAdaptor.cxx:35:103: error: no matching function for call
to ‘itk::ImageRegionIterator<itk::Image<float, 2u>
>::ImageRegionIterator(itk::VectorImageToImageAdaptor<float, 2u>::Pointer&,
const RegionType&)’
Is it not possible to iterate over an adaptor like this?
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20111101/20015e15/attachment.htm>
More information about the Insight-users
mailing list