# Relationship between pixels and mm from Matlab

**URL:** <https://discourse.slicer.org/t/relationship-between-pixels-and-mm-from-matlab/427>\
**Category:** Development\
**Created:** [June 2, 2017, 4:14pm UTC](https://discourse.slicer.org/t/relationship-between-pixels-and-mm-from-matlab/427 "2017-06-02T16:14:30Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [June 2, 2017, 4:35pm UTC](https://discourse.slicer.org/t/relationship-between-pixels-and-mm-from-matlab/427/2 "2017-06-02T16:35:03Z")

</div>

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](https://www.slicer.org/wiki/Coordinate_systems)

---

_[View the full topic](https://discourse.slicer.org/t/relationship-between-pixels-and-mm-from-matlab/427)._
