# Nrrd vs vtp model coordinate systems in Python

**URL:** <https://discourse.slicer.org/t/nrrd-vs-vtp-model-coordinate-systems-in-python/44323>\
**Category:** Support\
**Tags:** python, nrrd\
**Created:** [September 3, 2025, 3:46am UTC](https://discourse.slicer.org/t/nrrd-vs-vtp-model-coordinate-systems-in-python/44323 "2025-09-03T03:46:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![elisedl1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/elisedl1/32/80344_2.png) [@elisedl1](https://discourse.slicer.org/u/elisedl1)\
**Post date:** [September 3, 2025, 3:46am UTC](https://discourse.slicer.org/t/nrrd-vs-vtp-model-coordinate-systems-in-python/44323/1 "2025-09-03T03:46:28Z")

</div>

Hello,

My model (.vtp) and image (.nrrd) align in slicer correctly. I am trying to use the model and image information in Python, but they do not visually align when plotted; they are in different coordinate systems (world vs physical)? Is there an easy way to convert the vtp mesh to align with the nrrd CT image in Python?

TLDR: what is the conversion that slicer does internally to a model to align it with a given reference image?

Thanks!

---

<div class="post-metadata">

**Author:** ![elisedl1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/elisedl1/32/80344_2.png) [@elisedl1](https://discourse.slicer.org/u/elisedl1)\
**Post date:** [September 3, 2025, 4:07am UTC](https://discourse.slicer.org/t/nrrd-vs-vtp-model-coordinate-systems-in-python/44323/2 "2025-09-03T04:07:24Z")

</div>

As an update - I was able to get it aligned by the following steps:

- mesh points are world coordinates in LPS

- NRRD image are in voxels

- slicer applies image origin and direction to mesh → converts mesh coordinates to voxel space?

- world → voxel: voxel=(mesh\_points−origin)\*inv(direction)/spacing

- shift mesh so image origin is (0,0,0)

- apply inverse of image direction

- convert physical to voxel indices (divide by spacing)

If I am using the mesh information inside a registration algorithm, should I do this conversion within Python?

 ![Screenshot 2025-09-03 at 12.06.19 AM](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/f/6f4884388a07f0966fb01337901d4d13e1d65fc2.png)
