[Insight-users] VariableLengthVector and ConstIterator

Julien Michel julien.michel at c-s.cnes.fr
Fri Sep 12 05:00:58 EDT 2008

Dear itk users and developpers,

Lets consider the following code :

typedef itk::VectorImage<double> ImageType;
typedef ImageType::PixelType     PixelType;


   PixelType v = it.Get();

I was expecting v to be a local copy of the vector pixel returned by 
it.Get(). But this is not what happens : v will contain a pointer to the 
image internal buffer (due to itk::VariableLengthVector memory 
management), so v.Fill(0) allows me to write into myImage, even if the 
iterator is a ConstIterator. Might also work with an 

Isn't it some kind of bug ?

Best regards,


Julien MICHEL - Ingénieur d'études - Traitement d'images
CS Systèmes d'Information - Division ESPACE
Département Information Géographique & Image
Téléphone : +33 561 17 64 27
Email : julien.michel at c-s.fr


More information about the Insight-users mailing list