[Insight-users] VectorImageToImageAdaptor and iterators: compilation error

Dr. Uwe Köhler U.Koehler at gmx.de
Fri Mar 10 02:47:09 EST 2006


HiYa,

Iam still playing around with the VectorImage class and tried to access a 
component image using VectorImageToImageAdaptor and a ImageRegionIterator:

	typedef itk::VectorImageToImageAdaptor< IntPixelType, Dimension > 
	    VectorImageToImageAdaptorType;
	VectorImageToImageAdaptorType::Pointer 
	    vectorImageToImageAdaptor = VectorImageToImageAdaptorType::New();
	vectorImageToImageAdaptor->SetImage( int_vector_image );
	for( int i = 0;i < int_vector_image->GetImageDimension(); i++ ) {
	    vectorImageToImageAdaptor->SetExtractComponentIndex( i );
	    vectorImageToImageAdaptor->Update();
	    if( vectorImageToImageAdaptor->GetExtractComponentIndex() != i ) {
		success = false;
		test_series.addCurrentTestErrorMessage(
		    "SetExtractComponentIndex() failed" );
	    } 
	    typedef itk::ImageRegionIterator< VectorImageToImageAdaptorType > 
		ComponentImageIteratorType;
	    ComponentImageIteratorType component_iter( 
		vectorImageToImageAdaptor,
		vectorImageToImageAdaptor->GetLargestPossibleRegion() );
...

This stops compiling with the following error message:
/usr/local/include/InsightToolkit/Common/itkImageAdaptor.txx: In member 
function ‘const typename itk::ImageAdaptor<TImage, 
TAccessor>::InternalPixelType* itk::ImageAdaptor<TImage, 
TAccessor>::GetBufferPointer() const [with TImage = 
itk::VectorImage<main::IntPixelType, 2u>, TAccessor = 
itk::Accessor::VectorImageToImagePixelAccessor<main::IntPixelType>]’:
/usr/local/include/InsightToolkit/Common/itkImageConstIterator.h:173:   
instantiated from ‘itk::ImageConstIterator<TImage>::ImageConstIterator(const 
TImage*, const typename TImage::RegionType&) [with TImage = main(int, 
char**)::VectorImageToImageAdaptorType]’
/usr/local/include/InsightToolkit/Common/itkImageRegionConstIterator.h:167:   
instantiated from 
‘itk::ImageRegionConstIterator<TImage>::ImageRegionConstIterator(const 
typename itk::ImageConstIterator<TImage>::ImageType*, const typename 
itk::ImageConstIterator<TImage>::RegionType&) [with TImage = main(int, 
char**)::VectorImageToImageAdaptorType]’
/usr/local/include/InsightToolkit/Common/itkImageRegionIterator.txx:41:   
instantiated from 
‘itk::ImageRegionIterator<TImage>::ImageRegionIterator(typename 
itk::ImageRegionConstIterator<TImage>::ImageType*, const typename 
itk::ImageRegionConstIterator<TImage>::RegionType&) [with TImage = main(int, 
char**)::VectorImageToImageAdaptorType]’
/home/ukoehler/devel/C++/ITK/VectorImageTest/VectorImageTest.cxx:554:   
instantiated from here
/usr/local/include/InsightToolkit/Common/itkImageAdaptor.txx:364: error: 
cannot convert ‘main::IntPixelType*’ to ‘const 
itk::VariableLengthVector<int>*’ in return

I cannot find my mistake. Can anybody help me, please?

Cheers

Uwe

-- 
 |                                                                 |
-+-----------------------------------------------------------------+-
 |  Dr. Uwe Köhler              MR - Physics                       | 
 |                              German Heart Institute Berlin      |
 |                              Augustenburger Platz 1             |
 |                              D - 13353 Berlin                   |
 |          ////                Germany                            |
 |         (@ @)                Phone: +49 172 98 11 598           |
-+-----oOO--(_)--OOo-----------------------------------------------+-
 | <URL:http://www.ed.ac.uk/~ukoehler>   <mailto:UKoehler at dhzb.de> |


More information about the Insight-users mailing list