Hi all,
I am writing my own code to crop a volume. What I have is:
#Input volume
slicer.util.selectModule('CropVolume')
cropVolumeNode = slicer.vtkMRMLCropVolumeParametersNode()
cropVolumeNode.SetScene(slicer.mrmlScene)
cropVolumeNode.SetInputVolumeNodeID(volumeNode.GetID())
# specify desired roi's dimensions in voxels
radiusIJK = [400, 400, 200]
# assign roi node to a variable
roiNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLAnnotationROINode")
cropVolumeNode.SetROINodeID(roiNode.GetID())
roiNode.Initialize(slicer.mrmlScene)
slicer.modules.cropvolume.logic().FitROIToInputVolume(cropVolumeNode)
# get the size of the volume voxels
spacing = volumeNode.GetSpacing()
# convert the number of pixels to measurements in mm
radiusRAS = [(radiusIJK[0]*spacing[0])/2, (radiusIJK[1]*spacing[1])/2, (radiusIJK[2]*spacing[2])/2]
# change the size of the ROI
roiNode.SetRadiusXYZ(radiusRAS)
#Manually put ROI in the desired place
I cannot see changes in the interface of Crop Volume module. For example, if I change the input volume, in the interface I always see the same. How can I reflect those changes in the interface?
Thanks