# Changing the origin of a volume

**URL:** <https://discourse.slicer.org/t/changing-the-origin-of-a-volume/637>\
**Category:** Support\
**Created:** [July 6, 2017, 3:59pm UTC](https://discourse.slicer.org/t/changing-the-origin-of-a-volume/637 "2017-07-06T15:59:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![lpott005](https://avatars.discourse-cdn.com/v4/letter/l/ea5d25/32.png) [@lpott005](https://discourse.slicer.org/u/lpott005)\
**Post date:** [July 6, 2017, 3:59pm UTC](https://discourse.slicer.org/t/changing-the-origin-of-a-volume/637/1 "2017-07-06T15:59:03Z")

</div>

Hey everyone!

I’m having a spot of trouble with a DICOM volume. I used the resample module to change its spacing, but now I’m trying to place the origin of the whole volume so all the coordinates are positive.

I’m currently trying to use the reformat module \< [https://www.slicer.org/wiki/Documentation/4.0/Modules/Reformat](https://www.slicer.org/wiki/Documentation/4.0/Modules/Reformat) \> to change the origin, but the documentation says I can only do that slice by slice. So do I have to change every slice manually? Or is there a way to effect the change on the volume all at once?

Thanks!

---

<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:** [July 6, 2017, 4:00pm UTC](https://discourse.slicer.org/t/changing-the-origin-of-a-volume/637/2 "2017-07-06T16:00:44Z")

</div>

You can use Transforms module to translate a volume.

Why would you like to have positive coordinate values?

---

<div class="post-metadata">

**Author:** ![lpott005](https://avatars.discourse-cdn.com/v4/letter/l/ea5d25/32.png) [@lpott005](https://discourse.slicer.org/u/lpott005)\
**Post date:** [July 6, 2017, 4:59pm UTC](https://discourse.slicer.org/t/changing-the-origin-of-a-volume/637/3 "2017-07-06T16:59:10Z")

</div>

I need to generate landmarks for another bit of code I’m working with, and it’s throwing some strange errors about spacing when I use negative landmarks (I’ve already converting the volume to isotropic spacing, so it’s not that). And I’m not sure if transforms is the right thing to use- not that I don’t trust your judgement. I’d just like to shift the coordinate system, not move the volume around within it. Can I do that with the transforms module?

---

<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:** [July 6, 2017, 5:22pm UTC](https://discourse.slicer.org/t/changing-the-origin-of-a-volume/637/4 "2017-07-06T17:22:33Z")

</div>

Maybe what you need is landmark coordinates in voxel space (IJK) and you are wondering how to get that from landmark coordinates in physical (RAS) space?

See this discussion for information about RAS-\>IJK conversion: [Relationship between pixels and mm from Matlab](https://discourse.slicer.org/t/relationship-between-pixels-and-mm-from-matlab/427/2)

---

<div class="post-metadata">

**Author:** ![lpott005](https://avatars.discourse-cdn.com/v4/letter/l/ea5d25/32.png) [@lpott005](https://discourse.slicer.org/u/lpott005)\
**Post date:** [July 6, 2017, 5:23pm UTC](https://discourse.slicer.org/t/changing-the-origin-of-a-volume/637/5 "2017-07-06T17:23:58Z")

</div>

This looks helpful, thanks! Will update if it works.

---

<div class="post-metadata">

**Author:** ![lpott005](https://avatars.discourse-cdn.com/v4/letter/l/ea5d25/32.png) [@lpott005](https://discourse.slicer.org/u/lpott005)\
**Post date:** [July 6, 2017, 6:08pm UTC](https://discourse.slicer.org/t/changing-the-origin-of-a-volume/637/6 "2017-07-06T18:08:53Z")

</div>

Quick side question- If I have a landmark file in one set of coordinates, does slicer support converting it to another coordinate system, or will I have to go through the registration process?

---

<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:** [July 6, 2017, 6:11pm UTC](https://discourse.slicer.org/t/changing-the-origin-of-a-volume/637/7 "2017-07-06T18:11:00Z")

</div>

You can easily convert between coordinates defined in any coordinate system, but of course you need to know the transformation between these coordinate systems.

---

<div class="post-metadata">

**Author:** ![JoostJM](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/joostjm/32/1091_2.png) [@JoostJM](https://discourse.slicer.org/u/JoostJM)\
**Post date:** [July 7, 2017, 7:41am UTC](https://discourse.slicer.org/t/changing-the-origin-of-a-volume/637/8 "2017-07-07T07:41:43Z")

</div>

You can read the volumeNode as a SimpleITK image object (`image = sitkUtils.GetSlicerITKReadWriteAddress(<volumeNodeName>`), after which you can access the transformation matrix by calling `GetDirection()` on the image object.

Alternatively, you can use `image.TransformContinuousIndexToPhysicalPoint(<INDEX>)` and `TransformPhysicalPointToContinuousIndex(<POINT>)` to calculate coordinates in the different coordinate systems.
