[Insight-users] Definition of Image Origin

Miller, James V (Research) millerjv at crd.ge.com
Tue Oct 25 09:52:43 EDT 2005


Didier, 

I think the origin should be shifted when writing an image whose start 
index in NOT [0,0,0].  Like you said, the readers do not have access to
the region start index and assume that it is [0,0,0].

Can you log an entry in the bug tracker?  You can paste the contents
of your email message as the body of the bug description.

Thanks
Jim



-----Original Message-----
From: insight-users-bounces+millerjv=crd.ge.com at itk.org
[mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of
Didier Rajon
Sent: Tuesday, October 25, 2005 8:49 AM
To: Luis Ibanez
Cc: insight-users at itk.org
Subject: Re: [Insight-users] Definition of Image Origin


Thanks Luis for your answer.

I do have a little concern about one filter.  That's the ImageFileWriter.
Since the index is not saved with the image in most cases, should the 
filter shift the origin to the first pixel of the dataset before writing 
the image so that the ImageFileReader can assume an image index of (0,0) 
when it reads the image.

If I do the following:
  1) read a vtk file using itk::ImageFileReader
  2) crop the image by one pixel using itk::ExtractImageFilter
  3) write the result into a vtk file using itk::ImageFileWriter
  4) read the file just writen in step 3) using itk::ImageFileReader
then, my image is shifted by one pixel.

I also use VTK and they do shift the image origin before they save the 
image into a file.

Thanks,

Didier.


Luis Ibanez wrote:

>
> Hi Didier,
>
> The origin is associated with the pixel of Index (0,0).
>
> However, as you pointed out, an image may actually start
> in an index (15,25), and therefore the origin may be
> "outside" of the sampling grid of the image.
>
> That's fine because at the end, the purpose of the origin
> is to be able to compute the coordinates of every pixel
> in the sampling grid of the image.
>
> Note that not all filters may be doing the right thing
> when managing images that have a Start index different
> from (0,0).  If you find any suspicious behavior please
> let us know, so we can check if this is the result of a
> bug in a particular filter.
>
>
>   Thanks
>
>
>      Luis
>
>
>
> ------------------
> Didier Rajon wrote:
>
>> Hello,
>> I'm a little confused about the definition of the Image Origin.
>> According to the definition that I found in the ITK Software Guide - 
>> Second Edition (August 30, 2005); p 40: "the image origin is 
>> associated with the coordinates of the first pixel of the image".
>> On page 224 of the same documentation I found Eq. (6.20) that 
>> suggests that the origin is associated with the coordinates of the 
>> pixel indexed by (0, 0).
>> On page 234 of the same documentation I found an expression to 
>> calculate the image center and that suggests that the origin is 
>> associated with the coordinates of the first pixel of the image, 
>> whatever the index of the image.
>> So, if my image has a LargestPossibleRegion().GetIndex() equal to 
>> (10,10), is my image origin the coordinates of the pixel indexed by 
>> (10,10) (my first pixel in this case) or the coordinates of the pixel 
>> indexed by (0,0) (which is out of my dataset in this case)?
>> Thanks,
>>
>> Didier.
>>
>>
>>
>
>
>

-- 
Didier Rajon
Department of Neurological Surgery
University of Florida
MBI, L2100 PO Box 100265
Gainesville, FL, 32610-0265
Tel: (352) 294 0144
Fax: (352) 392 8413


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


More information about the Insight-users mailing list