[Insight-users] Image Coordinate Directions

Leila Baghdadi baghdadi at sickkids.ca
Tue Mar 7 17:13:53 EST 2006


Mark,

I have written a fair bit of imaging code and I can tell you ignoring
direction cosines has always got me into trouble! so I suggest you do
*not* do that!
Last we had a discussion about this issue on the list, I am pretty sure
some bugs were fixed on the main itk Imaging classes and you could
easily retrieve your direction cosines from your image header (or
however the information is stored depending on the image format) and
pass it to itk even if the direction cosines are identity

i.e, 
this->SetDirection(0, {1, 0, 0});
this->SetDirection(1, {0, 1, 0});
this->SetDirection(2, {0, 0, 1});

HTH

Leila

On Tue, 2006-07-03 at 16:58 -0500, Mark Foskey wrote:
> I am trying to write an input filter for a format in which the  y 
> physical coordinate decreases as the  j  index increases, whereas the  x 
>   and  z  coordinates move in the same direction as their corresponding 
> index coordinates.  I am not sure of the best general way to indicate 
> the relationship between the voxel and world coordinates.
> 
> It appears that the correct thing, according to the design of ITK, is to 
>   use the three Direction vectors accessible by Set/GetDirection to 
> indicate the directions of the three (voxel) coordinate axes in space. 
> So the Reader code could do something like
> 
>    this->SetDirection(0, {1, 0, 0});
>    this->SetDirection(0, {0, -1, 0});
>    this->SetDirection(0, {0, 0, 1});
> 
> modulo corrections to the syntax.
> 
> However, calling
> 
>    grep GetDirection `find . -name "*.cxx"`
> 
> from the InsightApplications top directory yields no hits, leading me to 
> believe that nobody is going to look at the direction vectors.
> 
> Is there a better, standard solution?
> 
> Thanks for any ideas,
> Mark
> 



More information about the Insight-users mailing list