# ROI to IJK coordinates

**URL:** https://discourse.slicer.org/t/roi-to-ijk-coordinates/2589
**Category:** Support
**Created:** [April 14, 2018, 9:36pm UTC](https://discourse.slicer.org/t/roi-to-ijk-coordinates/2589 "2018-04-14T21:36:14Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![zjx1805](https://avatars.discourse-cdn.com/v4/letter/z/f08c70/32.png) [@zjx1805](https://discourse.slicer.org/u/zjx1805)
#### Post date: [April 15, 2018, 5:08pm UTC](https://discourse.slicer.org/t/roi-to-ijk-coordinates/2589/4 "2018-04-15T17:08:10Z")

</div>

GetTransformBetweenNodes seems to be what I need! I saw one of your earlier post on GetTransformBetweenNodes [here](https://discourse.slicer.org/t/transformation-graph-for-quick-calculation-of-concatenated-transforms/326/3), so my code should probably look like this:

```
transformMatrix = vtk.vtkMatrix4x4() # I think transforms between these coordinate systems should be linear?
a = getNode('myROI').GetParentTransformNode()
b = ?
slicer.vtkMRMLTransformNode().GetMatrixTransformBetweenNodes(a, b, transformMatrix)
ijkCoordinates = transformMatrix.MultiplyPoint(rasCoordinates of ROI points appended by 1)

```

But how should I define b? Since it represents the ijk coordinates to index the data matrix and it does not have a corresponding node in Slicer…

To your second question, the reason why I didn’t want to use Crop volumes module is that I will do some calculation on the cropped volume, change its value, and eventually put it back to the original volume (so I need to get the ijk coordinates to know where to put it back)

Thanks!

---

_[View the full topic](https://discourse.slicer.org/t/roi-to-ijk-coordinates/2589)._
