# Problem while resizing an image

**URL:** <https://discourse.itk.org/t/problem-while-resizing-an-image/3104>\
**Category:** Algorithms\
**Created:** [May 22, 2020, 2:22am UTC](https://discourse.itk.org/t/problem-while-resizing-an-image/3104 "2020-05-22T02:22:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Felippe\_Trigueiro\_An](https://discourse.itk.org/user_avatar/discourse.itk.org/felippe_trigueiro_an/32/1015_2.png) [@Felippe\_Trigueiro\_An](https://discourse.itk.org/u/Felippe_Trigueiro_An)\
**Post date:** [May 22, 2020, 2:22am UTC](https://discourse.itk.org/t/problem-while-resizing-an-image/3104/1 "2020-05-22T02:22:42Z")

</div>

Hi, I have two volumes with different size Fixed(240, 240, 180) and Moving(182, 218, 182), and registering them I apply a resizing with the function resample(). But when I visualize the images with an overlay of them, the axial view does not show the part of the moving volume.

Did someone have a similar problem?

I’m using this code to resample():

```
output = sitk::Resample(moving, Fixed_Image.GetSize(), bspline_trans, sitk::sitkNearestNeighbor, Fixed_Image.GetOrigin(), Fixed_Image.GetSpacing(), Fixed_Image.GetDirection(), 0, moving.GetPixelID());
```

---

<div class="post-metadata">

**Author:** ![zivy](https://discourse.itk.org/user_avatar/discourse.itk.org/zivy/32/1726_2.png) [@zivy](https://discourse.itk.org/u/zivy)\
**Post date:** [May 22, 2020, 12:54pm UTC](https://discourse.itk.org/t/problem-while-resizing-an-image/3104/2 "2020-05-22T12:54:06Z")

</div>

Hello @Felippe_Trigueiro_An,

There are many reasons why you don’t see what you expect:

1. The registration failed and the two volumes don’t overlap, or the transformation is in the other direction (in both cases the `bspline_trans` is mapping all points from the fixed image outside the moving image bounds).
2. The visualization is off, combining two images from different modalities may require modifications of the intensities beforehand if you are alpha-blending the two.

Please provide additional details so that we can better identify the issue (possibly provide images?)

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [May 22, 2020, 1:28pm UTC](https://discourse.itk.org/t/problem-while-resizing-an-image/3104/3 "2020-05-22T13:28:27Z")

</div>

When you are resampling to the fixed image grid, any part which does not fit within it gets cut off. If you want to see the rest of the moving volume, resample to enlarged fixed image. You could use pad filter to get that enlargement.

---

<div class="post-metadata">

**Author:** ![Felippe\_Trigueiro\_An](https://discourse.itk.org/user_avatar/discourse.itk.org/felippe_trigueiro_an/32/1015_2.png) [@Felippe\_Trigueiro\_An](https://discourse.itk.org/u/Felippe_Trigueiro_An)\
**Post date:** [May 25, 2020, 10:32pm UTC](https://discourse.itk.org/t/problem-while-resizing-an-image/3104/4 "2020-05-25T22:32:07Z")

</div>

Thanks for your answers. I did the modifications suggested by @dzenanz and the problem was solved. Thanks!!!
