Show changes in Crop Volume interface

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 :slight_smile:

If you want to see the changes that you make in the new parameter set node that you created then choose that node as “Parameter set” in the Crop Volume module GUI.

This was what I needed.
I write the line of code in case so anyone may find it useful
slicer.modules.cropvolume.widgetRepresentation().setParametersNode(cropVolumeNode)