# Resampling a 3D CT Image

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

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

@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.

1 Like

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

2 Likes

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?)

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`

1 Like

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)?

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

1 Like

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?

1 Like

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)

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?

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.

1 Like

So spacing of 0.375mm. 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)?

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).

1 Like