Skip to content

Commit a340e60

Browse files
committed
allow the reference image has a different size
1 parent 73a3c5d commit a340e60

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pymic/io/image_read_write.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ def save_array_as_nifty_volume(data, image_name, reference_name = None):
7979
img = sitk.GetImageFromArray(data)
8080
if(reference_name is not None):
8181
img_ref = sitk.ReadImage(reference_name)
82-
img.CopyInformation(img_ref)
82+
#img.CopyInformation(img_ref)
83+
img.SetSpacing(img_ref.GetSpacing())
84+
img.SetOrigin(img_ref.GetOrigin())
85+
img.SetDirection(img_ref.GetDirection())
8386
sitk.WriteImage(img, image_name)
8487

8588
def save_array_as_rgb_image(data, image_name):

0 commit comments

Comments
 (0)