This is great! Thank you so much for your help. I noticed that the ROI which is added by default is already aligned with the RAS axes. So I have a two step procedure: 1) Crop the volume 2) ACPC transform to make the alignment perfect.
Here is what I am doing for cropping -
volumeNode = slicer.util.getNode(‘Sagittal resampled’)
roiNode = slicer.mrmlScene.AddNewNodeByClass(“vtkMRMLAnnotationROINode”)
crop_module = slicer.vtkMRMLCropVolumeParametersNode()
slicer.mrmlScene.AddNode(crop_module)
crop_module.SetInputVolumeNodeID(volumeNode.GetID())
crop_module.SetROINodeID(roiNode.GetID())
slicer.modules.cropvolume.logic().FitROIToInputVolume(crop_module)
slicer.modules.cropvolume.logic().Apply(crop_module)
And it works mostly as I expect it to. But I have one question: The ijk2ras direction matrices are set to identity for all my volumes after cropping. So if I start with a volume like this:
Why does the ijk2ras get reset to identity instead of [[-1,0,0],[0,-1,0],[0,0,1]]?
Also, I know this is minor - but I am so grateful to the people of Slicer development for having added a human orientation marker which adjusts itself according to the oblique acquisition matrices. It really helps beginners like me.
Best,
Sharada

