# Resampling a volume and Image Spacing

**URL:** <https://discourse.slicer.org/t/resampling-a-volume-and-image-spacing/12066>\
**Category:** Support\
**Tags:** resample, image-dimensions\
**Created:** [June 17, 2020, 7:39am UTC](https://discourse.slicer.org/t/resampling-a-volume-and-image-spacing/12066 "2020-06-17T07:39:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deepa](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/deepa/32/5634_2.png) [@Deepa](https://discourse.slicer.org/u/Deepa)\
**Post date:** [June 17, 2020, 7:39am UTC](https://discourse.slicer.org/t/resampling-a-volume-and-image-spacing/12066/1 "2020-06-17T07:39:48Z")

</div>

Hi All,  
I have got a volume with the following dimensions 1702 x1678 x 251.

 ![Untitled](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/3/d3cf2a93669feb7d7b65ec6062ca39274812cac2.png)

I want to reduce the resolution in xy direction and leave z unaltered. May I know which module can be used to do the above?  
I’ve checked the crop volume module, the `Spacing scale` option allows us to scale in all 3 dimensions.  
I don’t want to scale in z dimension. May I know if it is a good idea to use `Resample Scalar Volume` module’s `Scaling` (2,2,0) if I want to use a `Spacing Scale` of 2 in x,y dimensions and leave it unaltered in z?

I get the following output :

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

Could someone explain how the image spacing is computed here?  
To be honest, I don’t clearly understand what the x,y,z (If I am not wrong, z is the slice thickness) coordinates in the `Imaging Spacing ` tab refer to.

For instance, “the voxel size in this study (pixel size of 0.81 mm)” is mentioned in the documentation of dataset from which I have used the 2D slices to reconstruct 3D volume. If my understanding is right, 0.81mm has to be set for Image Spacing in x,y,z dimensions. May I know if this is correct?

---

<div class="post-metadata">

**Author:** ![timeanddoctor](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/timeanddoctor/32/5839_2.png) [@timeanddoctor](https://discourse.slicer.org/u/timeanddoctor)\
**Post date:** [June 17, 2020, 7:46am UTC](https://discourse.slicer.org/t/resampling-a-volume-and-image-spacing/12066/2 "2020-06-17T07:46:56Z")

</div>

I think the esayest way is covert the volume to numpy data，and then you can do what you want.

---

<div class="post-metadata">

**Author:** ![Deepa](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/deepa/32/5634_2.png) [@Deepa](https://discourse.slicer.org/u/Deepa)\
**Post date:** [June 17, 2020, 7:59am UTC](https://discourse.slicer.org/t/resampling-a-volume-and-image-spacing/12066/3 "2020-06-17T07:59:38Z")

</div>

Thank you. Could you please let me know if such examples are available?

---

<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:** [June 17, 2020, 4:17pm UTC](https://discourse.slicer.org/t/resampling-a-volume-and-image-spacing/12066/4 "2020-06-17T16:17:14Z")

</div>

> [@Deepa](#):
>
> I’ve checked the crop volume module, the `Spacing scale` option allows us to scale in all 3 dimensions.  
> I don’t want to scale in z dimension. May I know if it is a good idea to use `Resample Scalar Volume` module’s `Scaling` (2,2,0) if I want to use a `Spacing Scale` of 2 in x,y dimensions and leave it unaltered in z?

`ResampleScalarVolume` takes physical values. So if you want to reduce xy by 50% and your voxel spacing is 0.81, you should enter 1.62, 1.62, 0 (not 2,2,0)

---

<div class="post-metadata">

**Author:** ![Deepa](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/deepa/32/5634_2.png) [@Deepa](https://discourse.slicer.org/u/Deepa)\
**Post date:** [June 17, 2020, 4:22pm UTC](https://discourse.slicer.org/t/resampling-a-volume-and-image-spacing/12066/5 "2020-06-17T16:22:05Z")

</div>

Thank you very much for the clarification. Could you please suggest which interpolation method will be apt for resampling? I tried spline interpolation that was mentioned in Luca Antiga’s paper. But, in my opinion, that didn’t work fine. I could find disconnected fragments in 3D volume. Would it be a good idea to use Nearest neighbors?

---

<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:** [June 17, 2020, 4:25pm UTC](https://discourse.slicer.org/t/resampling-a-volume-and-image-spacing/12066/6 "2020-06-17T16:25:13Z")

</div>

If your data is a labelmap you should use nearest neighbor so that you have exactly the same number of classes that you begin with, otherwise linear is fairly safe.

---

<div class="post-metadata">

**Author:** ![Deepa](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/deepa/32/5634_2.png) [@Deepa](https://discourse.slicer.org/u/Deepa)\
**Post date:** [June 17, 2020, 5:13pm UTC](https://discourse.slicer.org/t/resampling-a-volume-and-image-spacing/12066/7 "2020-06-17T17:13:42Z")

</div>

Thanks a lot. I would like to confirm if labelmap refers to the volume generated from segment.
