Creating an array to use in: volumeNode.GetIJKToRASDirections (array)

Hello,

I’m trying to use the function GetIJKToRASDirections on a volume to get its IJK to RAS direction matrix. I previously transformed this image, and will now use the matrix to transform (using the set functions) another image that was acquired at about the same time. Unfortunately, I did not save the transform matrix.

The GetIJKToRASDirections function requires an output array with type ‘double’ and dimensions “dirs[3][3]” (Slicer: vtkMRMLVolumeNode Class Reference). I was not able to use normal python methods to create a 3 by 3 array. I also think there’s probably a simple way to do this Slicer, but I can’t find it on the script repositories.

TLDR: how do I create a 3 by 3 array of type ‘double’ to use in volumeNode.GetIJKToRASDirections (array).

Thank you for your help.

PS: I’m slicer Slicer 4.9

Here is a post with some example code that should help:

Did not answer the question directly but got me where I should have been looking.

Thanks!

1 Like