# Apply transformation change the image size

**URL:** <https://discourse.slicer.org/t/apply-transformation-change-the-image-size/17768>\
**Category:** Support\
**Created:** [May 24, 2021, 5:20pm UTC](https://discourse.slicer.org/t/apply-transformation-change-the-image-size/17768 "2021-05-24T17:20:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marianaslicer](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/marianaslicer/32/8555_2.png) [@marianaslicer](https://discourse.slicer.org/u/marianaslicer)\
**Post date:** [May 24, 2021, 5:20pm UTC](https://discourse.slicer.org/t/apply-transformation-change-the-image-size/17768/1 "2021-05-24T17:20:27Z")

</div>

Hi everyone,

I’m using the 3D Slicer version 4.13 and when I apply a b-spline transformation to an image it changes the original size.

Original size = 512 x 512 x 140

After apply the transformation:

```
    transformLogic = slicer.modules.transforms.logic()
    ctNode.SetAndObserveTransformNodeID(transform.GetID())
    transformLogic.hardenTransform(ctNode)

```

The final image size becomes = 513 x 513 x 140

I don’t want to change the original image size. Is it possible to maintain the original image size after transformation without cropping?

The transformation is saved in .txt file with the following parameters:

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

I would appreciate some help. 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:** [May 25, 2021, 3:50am UTC](https://discourse.slicer.org/t/apply-transformation-change-the-image-size/17768/2 "2021-05-25T03:50:26Z")

</div>

Deformable transforms can translate volumes and make parts of the volume bulge out, therefore in general you don’t want the resampled volume to have the same geometry (origin, spacing, axis directions, extents) as the non-transformed volume. Slicer automatically expands the volume extents to ensure that the complete warped volume is preserved.

If you want to enforce a particular image geometry then you can use a resampling module (for example, “Resample scalar/vector/dwi volume”) to create a transformed volume resampled to a chosen reference volume. In your case, the “Reference volume” will be your input volume.

---

<div class="post-metadata">

**Author:** ![marianaslicer](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/marianaslicer/32/8555_2.png) [@marianaslicer](https://discourse.slicer.org/u/marianaslicer)\
**Post date:** [May 25, 2021, 10:37am UTC](https://discourse.slicer.org/t/apply-transformation-change-the-image-size/17768/3 "2021-05-25T10:37:35Z")

</div>

Thank you for your answer
