[Insight-users] Origin of an itk::Image

Sergio Andres sergio at unizar.es
Wed, 21 Apr 2004 18:29:57 +0200


Hi all,

I have compiled ITK 1.6 and I am now using this release in my application,
but I realized that there is a 'little' difference between 1.4 and 1.6,
concerning to PNGImageIO class.

With ITK 1.4 Release, I read a png image into a itk::Image object, with 
the origin located
at the bottom left corner of the image.

However, with ITK 1.6, I get an itk::Image whose origin is at the top 
left corner of the image.

Thus, the physical positions of each pixel are different in each Release 
(1.4 and 1.6).

I have been looking for differences between 1.4 and 1.6 itk::PNGImageIO, 
and the differences are:

1.6: line 564.
----------------------
for (unsigned int ui = 0; ui < height; ui++)
    {
    row_pointers[ui] = (png_byte *)outPtr;

    outPtr = const_cast<unsigned char *>(outPtr) + rowInc;
    }


1.4: line 571
-------------------------
for (unsigned int ui = 0; ui < height; ui++)
    {
    row_pointers[height - ui - 1] = const_cast<png_byte *>(outPtr);
    //row_pointers[ui] = (png_byte *)outPtr;
    outPtr = const_cast<unsigned char *>(outPtr) + rowInc;
    }



When I started to use ITK I supposed that the origin was always at the 
bottom left corner..
but what can I suppose now??

Can anyone give me some help about this..? Is it a bug or am I using it 
in a wrong way?


Regards,
Sergio.