make a set of 3D images into a 4D image

Hi I am trying to stitch together a series of 100 3D (512, 128, 200) images into a single 4D (512, 128, 200, 100) image using simpleITK. I have tried using the TileImageFilter but I only get an image that is 512, 128, 200 if I set the layout to (1,1,1,0), and the JoinSeriesImageFilter but when I combine the first two images I get a 4D image, which means that when I try to join the combination of the first 2 images with the 3rd image, they don’t have the same dimensionality so the filter fails. Any Ideas?

Thanks,

Juan

1 Like

Hello Juan,

You should be able to pass all 100 3D image to JoinSeriesImageFilter to create the desired 4D image. Please provide some sample code, if you need further assistance.

Per Brad’s pointer to the JoinSeriesFilter, below is procedural code to do it:

import SimpleITK as sitk

img = sitk.Image([512,128,200], sitk.sitkUInt8)
print(img.GetSize())
res = sitk.JoinSeries([img]*3) #join list of three images
print(res.GetSize())
1 Like

Thank you, that worked!

Juan

1 Like