# Resampling a 3D CT Image

**URL:** <https://discourse.slicer.org/t/resampling-a-3d-ct-image/618>\
**Category:** Support\
**Tags:** resample\
**Created:** [July 3, 2017, 5:10pm UTC](https://discourse.slicer.org/t/resampling-a-3d-ct-image/618 "2017-07-03T17:10:55Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan\_Hidrovo](https://avatars.discourse-cdn.com/v4/letter/i/d78d45/32.png) [@Ivan\_Hidrovo](https://discourse.slicer.org/u/Ivan_Hidrovo)\
**Post date:** [July 3, 2017, 5:10pm UTC](https://discourse.slicer.org/t/resampling-a-3d-ct-image/618/1 "2017-07-03T17:10:56Z")

</div>

Hello,

Can someone please inform me what module I need to use if I want to downsample a 3D CT image of dimensions 592X 592X 560 to be of dimensions 236X 236X 224 ?

Thank you,  
Ivan

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [July 3, 2017, 7:06pm UTC](https://discourse.slicer.org/t/resampling-a-3d-ct-image/618/2 "2017-07-03T19:06:06Z")

</div>

Hi Ivan -

Probably the easiest is to figure out what spacing you need and then use the Resample Scalar Volume module. You need to multiply the current sizes by the spacing in each dimension and then divide by the desired size in each dimension to get the resampling spacing needed.

HTH,  
Steve

---

<div class="post-metadata">

**Author:** ![Ivan\_Hidrovo](https://avatars.discourse-cdn.com/v4/letter/i/d78d45/32.png) [@Ivan\_Hidrovo](https://discourse.slicer.org/u/Ivan_Hidrovo)\
**Post date:** [July 3, 2017, 7:22pm UTC](https://discourse.slicer.org/t/resampling-a-3d-ct-image/618/3 "2017-07-03T19:22:29Z")

</div>

@pieper Thank you for your response.However, I used the resample image (BRAINS) module and it worked pretty nicely. All you need is a reference image to define the new resolution, and it also let me choose the interpolation method.

---

<div class="post-metadata">

**Author:** ![Lorensen](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lorensen/32/31_2.png) [@Lorensen](https://discourse.slicer.org/u/Lorensen)\
**Post date:** [July 3, 2017, 8:39pm UTC](https://discourse.slicer.org/t/resampling-a-3d-ct-image/618/4 "2017-07-03T20:39:40Z")

</div>

I wrote this a long time ago…  
[https://itk.org/Wiki/ITK/Examples/DICOM/ResampleDICOM](https://itk.org/Wiki/ITK/Examples/DICOM/ResampleDICOM)

---

<div class="post-metadata">

**Author:** ![arumiat](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@arumiat](https://discourse.slicer.org/u/arumiat)\
**Post date:** [April 9, 2018, 3:46pm UTC](https://discourse.slicer.org/t/resampling-a-3d-ct-image/618/5 "2018-04-09T15:46:24Z")

</div>

I can’t figure out how to do this from the written description. Could I trouble you to run through a calculation with me.

My images are 720 x 720px and 1871 images ‘long’ (with a slice thickness of 2mm).

If I wanted to _halve_ the number of images in the length (z-axis) which I think is equivalent to doubling the slice thickness, what is current size I need to multiply (for the z-axis?)

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [April 9, 2018, 4:01pm UTC](https://discourse.slicer.org/t/resampling-a-3d-ct-image/618/6 "2018-04-09T16:01:40Z")

</div>

Yes, if you double the spacing you’ll get half the number of slices.

If you want N slices, then the spacing needs to be `1871 * 2mm / N`

---

<div class="post-metadata">

**Author:** ![arumiat](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@arumiat](https://discourse.slicer.org/u/arumiat)\
**Post date:** [April 9, 2018, 4:11pm UTC](https://discourse.slicer.org/t/resampling-a-3d-ct-image/618/7 "2018-04-09T16:11:02Z")

</div>

Thanks Steve, so

1871\*2 = 3742  
I want half the number of z-slices (rounds up to 936)  
So 3742/936 = 4

So in the resample scalar volume module I use (0,0,4)?

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [April 9, 2018, 4:57pm UTC](https://discourse.slicer.org/t/resampling-a-3d-ct-image/618/8 "2018-04-09T16:57:46Z")

</div>

Yes, except you want to use the current spacing for the first two numbers so the number of rows and columns stays the same.

---

<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:** [April 9, 2018, 6:26pm UTC](https://discourse.slicer.org/t/resampling-a-3d-ct-image/618/9 "2018-04-09T18:26:22Z")

</div>

I would recommend `Crop volume` module. It allows cropping and adds many convenience features around resampling. For example, you can preview the output image size in `Volume information` section.

By the way, why do you need exactly 236 x 236 x 224 size? Do you need to match your volume’s geometry (size, origin, spacing, axis directions) to another volume’s geometry?

---

<div class="post-metadata">

**Author:** ![arumiat](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@arumiat](https://discourse.slicer.org/u/arumiat)\
**Post date:** [April 10, 2018, 10:20am UTC](https://discourse.slicer.org/t/resampling-a-3d-ct-image/618/10 "2018-04-10T10:20:03Z")

</div>

By current spacing 720x720px so (720, 720, 4) ?

* * *

Hi Andras, I don’t need an exact output size, I’m just trying to work on getting my volume down to a smaller size so I can serve it across the internet. ([Working with large datasets](https://discourse.slicer.org/t/working-with-large-datasets/2469/11))

One method I haven’t tried yet which would I imagine help a lot is reducing the number of images in the z-plane, hence the above discussion.

So in summary my overall pipeline is to

1. reduce number of images in the z-plane using above method
2. crop the volume to just the region of interest
3. rescale images to a more reasonable size (around 256x256 or 300x300 px)
4. save as nrrd or mrda

and see where that gets me =)  
PS I didn’t realise crop volume could also resize, any tutorials on using?

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [April 10, 2018, 11:40am UTC](https://discourse.slicer.org/t/resampling-a-3d-ct-image/618/11 "2018-04-10T11:40:10Z")

</div>

> [@arumiat](#):
>
> By current spacing 720x720px so (720, 720, 4) ?

No, 720 is the dimension (number of voxels) but the spacing is the distance between the voxels. You can see these in the Volumes module information tab for your volume. So desired spacing would be something like (2,2,4). You can experiment with different options to trade off resolution for file size.

---

<div class="post-metadata">

**Author:** ![arumiat](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@arumiat](https://discourse.slicer.org/u/arumiat)\
**Post date:** [April 10, 2018, 11:49am UTC](https://discourse.slicer.org/t/resampling-a-3d-ct-image/618/12 "2018-04-10T11:49:37Z")

</div>

So spacing of **0.375** mm.

![spacing](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/2/2283abb4175b29a920f4b85060cc18ef252325d9.png)

I need to multiply current size by spacing (720\*0.375 = 270) and then divide by desired size = 270/256 for instance = 1.05

So (1,1,4)?

Or if I wanted to only reduce to 512x512 xy then I could use (0.5, 0.5, 4)?

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [April 10, 2018, 12:08pm UTC](https://discourse.slicer.org/t/resampling-a-3d-ct-image/618/13 "2018-04-10T12:08:22Z")

</div>

Yes, that looks right. You could start with the Resample Scalar Volume module to reduce the number of slices (increase Z spacing) and then use CropVolume to explore the size/resolution tradeoffs. Look in the Volume Information tab as you adjust the parameters.

(unless I’ve forgotten or missed something Crop Volume doesn’t support per-axis scaling which is why you need Resample Scalar Volume).
