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

Miller, James V (Research) millerjv at crd.ge.com
Wed, 21 Apr 2004 12:59:15 -0400


The change in origin for PNG and RAW formats was to make all readers
consistent.  Some readers were putting the origin in the lower left
and some in the upper left.  

Since ITK's main application area is medical image analysis, we decided
to standardize on putting the origin at the upper left pixel. This is 
consistent with the DICOM standard.

Jim

-----Original Message-----
From: Sergio Andres [mailto:sergio at unizar.es]
Sent: Wednesday, April 21, 2004 12:30 PM
To: insight-users at itk.org
Subject: [Insight-users] Origin of an itk::Image



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.

_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users