Relationship between pixels and mm from Matlab

It is defined in img.ijkToLpsTransform as a 4x4 homogeneous transformation matrix. From nrrdread.m:

 img.ijkToLpsTransform: pixel (IJK) to physical (LPS, assuming 'space' is 'left-posterior-superior')
  coordinate system transformation, the origin of the IJK coordinate system is (1,1,1) to match Matlab matrix indexing

Note that this matrix include origin, spacing, and axis directions of the volume.

You can convert a coordinate from IJK (voxel) to LPS (physical, in mm) coordinate system by multiplying the coordinate by ijkToLpsTransform from the left. Spacing is the norm of column vectors of ijkToLpsTransform.

See more information for example here: https://www.slicer.org/wiki/Coordinate_systems

1 Like