# Padding a volume with CropVolume requires "Interpolated Cropping"

**URL:** <https://discourse.slicer.org/t/padding-a-volume-with-cropvolume-requires-interpolated-cropping/8750>\
**Category:** Support\
**Created:** [October 11, 2019, 8:11pm UTC](https://discourse.slicer.org/t/padding-a-volume-with-cropvolume-requires-interpolated-cropping/8750 "2019-10-11T20:11:26Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [October 11, 2019, 8:11pm UTC](https://discourse.slicer.org/t/padding-a-volume-with-cropvolume-requires-interpolated-cropping/8750/1 "2019-10-11T20:11:26Z")

</div>

This is more of a comment than a bug.

I just want to expanded a volume to accommodate a larger volume during registration. I know I can use padImage in Simple Filters, but I wanted to do it interactively with Crop Volume (as the changes are not uniform). It worked, but only if I chose the 'interpolated cropping", which made the intensity values of the output volume different than original volume, and also more fuzzy.

---

<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 12, 2019, 4:12am UTC](https://discourse.slicer.org/t/padding-a-volume-with-cropvolume-requires-interpolated-cropping/8750/2 "2019-10-12T04:12:30Z")

</div>

> [@muratmaga](#):
>
> I just want to expanded a volume to accommodate a larger volume during registration.

Adding empty regions around a volume should not affect the registration (and there is a chance that it makes the registration worse).

> [@muratmaga](#):
>
> It worked, but only if I chose the 'interpolated cropping", which made the intensity values of the output volume different than original volume, and also more fuzzy.

It was slightly easier to implement voxel-based cropping so that it does not make volume extents larger, but I agree that it would be more consistent to allow growing of the volume in both interpolated and non-interpolated mode. I’ll update the module.

---

<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 12, 2019, 4:13pm UTC](https://discourse.slicer.org/t/padding-a-volume-with-cropvolume-requires-interpolated-cropping/8750/3 "2019-10-12T16:13:56Z")

</div>

Crop volume module can grow the volume extent in both interpolated and non-interpolated modes in Slicer Preview Release (from rev28544).

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [October 12, 2019, 5:44pm UTC](https://discourse.slicer.org/t/padding-a-volume-with-cropvolume-requires-interpolated-cropping/8750/4 "2019-10-12T17:44:13Z")

</div>

Thanks Andras!!!

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [October 13, 2019, 6:47pm UTC](https://discourse.slicer.org/t/padding-a-volume-with-cropvolume-requires-interpolated-cropping/8750/5 "2019-10-13T18:47:53Z")

</div>

Hi Andras,  
I gave a quick try and there seems two issues:

1. Interpolated cropping now flips the X and Z dimensions somehow (only with interpolated checked)
2. Without interpolation, dimensions are not expanded, but the origin is modified  
This is with 28544 on WIndows 10.  
To replicate  
download MRHead  
go to crop volume and set a the ROI to volume extends and do a interpolated cropping to see dimension value flipped in the volumes module for the new cropped volume.  
enlarge the ROI a bit and now do an voxel based cropping to see the dimensions remain the same but origin is shifted.

---

<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 13, 2019, 6:58pm UTC](https://discourse.slicer.org/t/padding-a-volume-with-cropvolume-requires-interpolated-cropping/8750/6 "2019-10-13T18:58:49Z")

</div>

> [@muratmaga](#):
>
> Interpolated cropping now flips the X and Z dimensions somehow (only with interpolated checked)

When performing interpolated cropping, axis directions are determined by ROI’s axis directions. Order of input volume axes has no effect (as they may not even aligned with any of the ROI’s axes).

> [@muratmaga](#):
>
> Without interpolation, dimensions are not expanded, but the origin is modified

It works well for me. Please try again. You can set a fill value of 100 to make the padded region more visible.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [October 13, 2019, 10:43pm UTC](https://discourse.slicer.org/t/padding-a-volume-with-cropvolume-requires-interpolated-cropping/8750/7 "2019-10-13T22:43:29Z")

</div>

OK. I see voxel-based cropping is indeed working. What threw me off was the fields didn’t get updated in the volume information tab. I didn’t cross-checked in the volumes module.

However, the behavior for interpolated cropping seems a little awkward, I don’t recall being it like that.  
This is the original volume properties:  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/5/652ae997316ec9602f6353ac3f24cee3dcc0f82b.png)

This is what I see after enlarging the ROI

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/c/8c3f38977da508192c7157f9ea2420a7fd030b62.png)

Scan order is property is changed, and when I look at the volume outside of Slicer, I see a different plane being shown in slices.

---

<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 14, 2019, 1:52pm UTC](https://discourse.slicer.org/t/padding-a-volume-with-cropvolume-requires-interpolated-cropping/8750/8 "2019-10-14T13:52:27Z")

</div>

> [@muratmaga](#):
>
> behavior for interpolated cropping seems a little awkward

Interpolated cropping behavior changed a few years ago, when support for cropping with arbitrarily transformed ROIs was added. The original volume may be non-linearly warped and arbitrarily rotated, so in general there is no clear correspondence between the original and the cropped volume axes, while there is clear correspondence between the cropping ROI and the cropping volume axes. By implementing some heuristics that would try to find the closest match between the original and resampled cropped volume, we would introduce an ambiguity. Implementing this would take some effort and adding one more option would further complicate the GUI.

> [@muratmaga](#):
>
> the fields didn’t get updated in the volume information tab

Good catch, I’ve fixed this now.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [October 14, 2019, 4:01pm UTC](https://discourse.slicer.org/t/padding-a-volume-with-cropvolume-requires-interpolated-cropping/8750/9 "2019-10-14T16:01:27Z")

</div>

Thank you for the clarification and adding padding option.
