[BUG]: Merge parcellations fail with extra dimensions #331

Merged
synchon merged 3 commits from fix/extra-parc-dim-in-merge into main 2024-05-06 10:28:28 +00:00
2 changed files with 4 additions and 1 deletions

View file

@ -0,0 +1 @@
Remove extra dimension from parcellations warped via ANTs when merging parcellations by `Synchon Mandal`_

View file

@ -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(