[BUG]: Merge parcellations fail with extra dimensions #331
2 changed files with 4 additions and 1 deletions
1
docs/changes/newsfragments/331.bugfix
Normal file
1
docs/changes/newsfragments/331.bugfix
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Remove extra dimension from parcellations warped via ANTs when merging parcellations by `Synchon Mandal`_
|
||||||
|
|
@ -326,7 +326,9 @@ def get_parcellation(
|
||||||
# Call antsApplyTransforms
|
# Call antsApplyTransforms
|
||||||
run_ext_cmd(name="antsApplyTransforms", cmd=apply_transforms_cmd)
|
run_ext_cmd(name="antsApplyTransforms", cmd=apply_transforms_cmd)
|
||||||
|
|
||||||
img = nib.load(warped_parcellation_path)
|
raw_img = nib.load(warped_parcellation_path)
|
||||||
|
# Remove extra dimension added by ANTs
|
||||||
|
img = image.math_img("np.squeeze(img)", img=raw_img)
|
||||||
|
|
||||||
# Resample parcellation to target image
|
# Resample parcellation to target image
|
||||||
img_to_merge = image.resample_to_img(
|
img_to_merge = image.resample_to_img(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue