# Show changes in Crop Volume interface

**URL:** <https://discourse.slicer.org/t/show-changes-in-crop-volume-interface/21250>\
**Category:** Development\
**Tags:** python, cropping\
**Created:** [December 28, 2021, 12:29pm UTC](https://discourse.slicer.org/t/show-changes-in-crop-volume-interface/21250 "2021-12-28T12:29:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bserrano](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/bserrano/32/17034_2.png) [@bserrano](https://discourse.slicer.org/u/bserrano)\
**Post date:** [December 28, 2021, 12:29pm UTC](https://discourse.slicer.org/t/show-changes-in-crop-volume-interface/21250/1 "2021-12-28T12:29:08Z")

</div>

Hi all,

I am writing my own code to crop a volume. What I have is:

```python
#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 🙂

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 30, 2021, 5:17am UTC](https://discourse.slicer.org/t/show-changes-in-crop-volume-interface/21250/2 "2021-12-30T05:17:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bserrano](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/bserrano/32/17034_2.png) [@bserrano](https://discourse.slicer.org/u/bserrano)\
**Post date:** [December 30, 2021, 9:49am UTC](https://discourse.slicer.org/t/show-changes-in-crop-volume-interface/21250/3 "2021-12-30T09:49:21Z")

</div>

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)
