Created
September 7, 2021 18:17
-
-
Save sarthakpati/bad14ddd604f612469fabb156164ce27 to your computer and use it in GitHub Desktop.
Copy image information
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SimpleITK as sitk | |
# read image to copy information from | |
image_reference = sitk.ReadImage('/path/to/reference.nii.gz') | |
image_to_copy_from = sitk.ReadImage('/path/to/image_to_change.nii.gz') | |
image_to_copy_from.CopyInformation(image_reference) | |
# write the image | |
sitk.WriteImage(image_to_copy_from, '/path/to/result.nii.gz') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment