# CropVolumeSequence does not respect transforms

**URL:** <https://discourse.slicer.org/t/cropvolumesequence-does-not-respect-transforms/8864>\
**Category:** Support\
**Created:** [October 22, 2019, 6:35pm UTC](https://discourse.slicer.org/t/cropvolumesequence-does-not-respect-transforms/8864 "2019-10-22T18:35:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [October 22, 2019, 6:35pm UTC](https://discourse.slicer.org/t/cropvolumesequence-does-not-respect-transforms/8864/1 "2019-10-22T18:35:23Z")

</div>

Hello, I have used the CropVolumeSequence module in the past to successfully crop a volume sequence into a new sequence. However, in my current use case, I have a transformed volume sequence and a transformed cropping ROI, and the output crop volume sequence is empty, I believe because the CropVolumeSequence code does not properly account for one or both of the transforms. Interestingly, the CropVolume module does just fine for each individual frame of the sequence, and I was able to achieve the desired effect by simply stepping through the frames and pressing the Apply button in the CropVolume module (after first checking the Save Changes checkbox in the sequence browser for the cropped sequence). I was surprised this worked because I thought the CropVolumeSequence module probably just used the logic of the CropVolume module, but it also means that this bug should be very easy to fix.

---

<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 22, 2019, 9:05pm UTC](https://discourse.slicer.org/t/cropvolumesequence-does-not-respect-transforms/8864/2 "2019-10-22T21:05:49Z")

</div>

CropVolumeSequence is just a simple scripted module that iterates through the sequence and uses Crop Volume module on each frame. It should work well with any transformation combination.

The actual cropping operation is just [70 lines](https://github.com/SlicerRt/Sequences/blob/master/CropVolumeSequence/CropVolumeSequence.py#L170-L241). It would be great if you could have a look at it yourself, maybe [step through it using a Python debugger](https://www.slicer.org/wiki/Documentation/Nightly/Extensions/DebuggingTools) to see why it is not working for you.
