[Insight-users] TransformPhysicalPointToIndex-method in Image class

Luis Ibanez luis.ibanez at kitware.com
Wed, 07 Apr 2004 12:25:27 -0400


Hi Janne,

Thanks for pointing this out.

You are right, the conversion between physical coordinates
and indices doesn't seem to match the description on the
SoftwareGuide.  We will have to correct one or the other.

This issue has been entered as Bug # 738:
http://www.itk.org/Bug/bug.php?op=show&bugid=738&pos=0


You may want to create your account with the bug
tracker in order to follow the evolution of this
bug.



   Regards,


      Luis



-----------------------
Hämäläinen Janne wrote:

> Hi,
> 
> I suspect that this question has been debated before, but I wasn't able find
> anything about it from the archives. 
> 
> We use the TransformPhysicalPointToIndex-method of itk::Image-class to get
> the index of single voxel inside an image object. The index is exploited for
> tracing the scalar value of a single pixel. However, the transforming
> function doesn't seem to behave as we thought it would, so we kindly ask
> your assistance for how to interpret the behavior. First of all, the ITK
> Software Guide specifies (in p. 40) that the coverage of a voxel is the
> Voronoi region around the physical position of the voxel. In our
> implementation we noticed anyhow that the behavior of the
> TransformPhysicalPointToIndex-method seems a bit different. Here is a clip
> from the method:
> 
> /****** From itk::Image-class (itkImage.h, lines 314-318) ***********/
> 
>     // Update the output index
>     for (unsigned int i = 0 ; i < VImageDimension ; i++)
>       {
>       index[i] = static_cast<IndexValueType>( (point[i]- m_Origin[i]) /
> m_Spacing[i] );
>       }
> 
> /***************************************************************************
> /
> 
> In short, you first calculate the continouos index
> ((point[i]-m_Origin[i]/m_Spacing[i]) from the physical point, and then cast
> the acquired floating point value to an integer value (value type of the
> index is a long integer according to the Index-class). But in our
> understanding this causes half a voxel shift compared to the Voronoi region
> interpretation, because the cast operation just truncates the floating point
> value, instead of rounding it. We think that rounding of the continuous
> index before the cast would give the index according to the Voronoi region
> interpretation. Is this a bug, or is it the intended behavior?
> 
> -Janne
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>