I have 2 SimpleITK images, and I want to use their package's ExpandImageFilter to upsample one of my images to match the other.
Does anyone have any idea on how to use this?
I took a look at their documentation (https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1ExpandImageFilter.html) and I don't really understand it... and I couldn't find any examples of it either.
The ExpandImageFilter will expand the size of an image in integer multiples. For instance you can expand a 100x100 image to 200x200. The new dimensions must be an integer multiple of the original. If that is not the case for your two images, then Expand will not work for you.
In the case of a non-integer change in dimensions you need to use the ResampleImageFilter. You can read about resampling in the following notebook:
Update: It sounds like you figured it out, but just for completeness, here's an example of how to use the ExpandImageFilter
import SimpleITK as sitk
img = sitk.Image(100,100,sitk.sitkUInt8)
expand = sitk.ExpandImageFilter()
expand.SetExpandFactors([2,2])
big_img = expand.Execute(img)
Also there is the procedural version, which I prefer:
another_big_img = sitk.Expand(img, [2,2])