GetTransformBetweenNodes seems to be what I need! I saw one of your earlier post on GetTransformBetweenNodes here, 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!