I have written a little script that rotates an image based on a transform (.tfm) that I’ve obtained from the Slicer GUI:
def resample(image, transform):
# Output image Origin, Spacing, Size, Direction are taken from the reference
# image in this call to Resample
reference_image = image
interpolator = sitk.sitkCosineWindowedSinc
default_value = 100.0
return sitk.Resample(image, reference_image, transform,
interpolator, default_value)
fet_180 = resample(fet, rotation_180)
Works perfectly, except for the fact that the images get cut off after the rotation. Example (zoomed out for clarity:
Before rotation:
After Rotation:
This doesn’t happen when rotating in the Slicer GUI itself, what can I do to fix this?