# How to enable/disable the option of "interpolated cropped" inside "cropvolume" via python coding?

**URL:** <https://discourse.slicer.org/t/how-to-enable-disable-the-option-of-interpolated-cropped-inside-cropvolume-via-python-coding/32128>\
**Category:** Development\
**Tags:** python\
**Created:** [October 10, 2023, 5:18am UTC](https://discourse.slicer.org/t/how-to-enable-disable-the-option-of-interpolated-cropped-inside-cropvolume-via-python-coding/32128 "2023-10-10T05:18:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aiden.zhu](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/aiden.zhu/32/67145_2.png) [@aiden.zhu](https://discourse.slicer.org/u/aiden.zhu)\
**Post date:** [October 10, 2023, 5:18am UTC](https://discourse.slicer.org/t/how-to-enable-disable-the-option-of-interpolated-cropped-inside-cropvolume-via-python-coding/32128/1 "2023-10-10T05:18:47Z")

</div>

Operating system: windows 10  
Slicer version: 4.11  
Expected behavior: would like to control enable/disable the option of “interpolated cropped”  
Actual behavior:

I am doing cropping volumes via python coding, use the following code to reach “cropvolume” ==\>  
cropVolumeNode = slicer.vtkMRMLCropVolumeParametersNode()  
cropVolumeNode.SetScene(slicer.mrmlScene)  
cropVolumeNode.SetIsotropicResampling(True)  
cropVolumeNode.SetSpacingScalingConst(1.0)  
slicer.mrmlScene.AddNode(cropVolumeNode)  
cropVolumeNode.SetName(‘NewlyCropped’)

so here how disable/enable the interpolation option for the cropvolume?

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:** [October 10, 2023, 10:41am UTC](https://discourse.slicer.org/t/how-to-enable-disable-the-option-of-interpolated-cropped-inside-cropvolume-via-python-coding/32128/2 "2023-10-10T10:41:44Z")

</div>

You can get the list of all available parameters as described [here](https://slicer.readthedocs.io/en/latest/developer_guide/python_faq.html#get-list-of-parameter-names).

---

<div class="post-metadata">

**Author:** ![aiden.zhu](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/aiden.zhu/32/67145_2.png) [@aiden.zhu](https://discourse.slicer.org/u/aiden.zhu)\
**Post date:** [September 11, 2025, 1:36pm UTC](https://discourse.slicer.org/t/how-to-enable-disable-the-option-of-interpolated-cropped-inside-cropvolume-via-python-coding/32128/3 "2025-09-11T13:36:06Z")

</div>

Still get some issues with cropvolume while applying it via python-coding.

So what’s the best way or is there a quick way for users to check some ENUM or dictionary values? For example here, self.cropVolumeParametersNode.SetInterpolationMode(v\_interpolation)

v\_interpolation might be 0, 1, 2, 3, 4

How/where to check what interpolate-method each value represents? Say, here

value of 1 means “nearest neighbor” or “linear”?

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![aiden.zhu](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/aiden.zhu/32/67145_2.png) [@aiden.zhu](https://discourse.slicer.org/u/aiden.zhu)\
**Post date:** [September 26, 2025, 2:53pm UTC](https://discourse.slicer.org/t/how-to-enable-disable-the-option-of-interpolated-cropped-inside-cropvolume-via-python-coding/32128/4 "2025-09-26T14:53:59Z")

</div>

> <https://github.com/Slicer/Slicer/blob/main/Modules/Loadable/CropVolume/MRML/vtkMRMLCropVolumeParametersNode.h>

public:  
enum  
{  
InterpolationNearestNeighbor = 1,  
InterpolationLinear = 2,  
InterpolationWindowedSinc = 3,  
InterpolationBSpline = 4  
};

enum  
{  
FitROIAlignToVolume = 0, ///\< Before resizing the ROI, ROI orientation is adjusted to align with the axes of the input volume  
FitROIAlignToWorld = 1, ///\< Before resizing the ROI, ROI orientation is adjusted to align with the world coordinate system axes  
FitROIKeepOrientation = 2, ///\< The ROI orientation is not modified during fitting  
FitROI\_Last ///\< PositionStatus\_Last: indicates the end of the enum (int first = 0, int last = FitROI\_Last)  
};
