diff --git a/hippunfold/workflow/rules/autotop.smk b/hippunfold/workflow/rules/autotop.smk index 3d884a2c..3920bec8 100644 --- a/hippunfold/workflow/rules/autotop.smk +++ b/hippunfold/workflow/rules/autotop.smk @@ -231,6 +231,7 @@ rule unflip_coords: hemi="{hemi}flip", **config["subj_wildcards"] ), + unflip_ref=get_nnunet_input, output: nii=bids( root=work, @@ -248,7 +249,8 @@ rule unflip_coords: group: "subj" shell: - "c3d {input} -flip x {output}" + "c3d {input.nii} -flip x -popas FLIPPED " + " {input.unflip_ref} -push FLIPPED -copy-transform -o {output.nii} " rule unflip_coords_equivol: @@ -264,6 +266,7 @@ rule unflip_coords_equivol: hemi="{hemi}flip", **config["subj_wildcards"] ), + unflip_ref=get_nnunet_input, output: nii=bids( root=work, @@ -281,4 +284,5 @@ rule unflip_coords_equivol: group: "subj" shell: - "c3d {input} -flip x {output}" + "c3d {input.nii} -flip x -popas FLIPPED " + " {input.unflip_ref} -push FLIPPED -copy-transform -o {output.nii} " diff --git a/hippunfold/workflow/rules/nnunet.smk b/hippunfold/workflow/rules/nnunet.smk index 98d9418b..9c00135f 100644 --- a/hippunfold/workflow/rules/nnunet.smk +++ b/hippunfold/workflow/rules/nnunet.smk @@ -158,6 +158,7 @@ rule unflip_nnunet_nii: space="corobl", hemi="{hemi}flip" ), + unflip_ref=get_nnunet_input, output: nnunet_seg=bids( root=work, @@ -173,7 +174,8 @@ rule unflip_nnunet_nii: group: "subj" shell: - "c3d {input} -flip x {output}" + "c3d {input.nnunet_seg} -flip x -popas FLIPPED " + " {input.unflip_ref} -push FLIPPED -copy-transform -o {output.nnunet_seg} " def get_f3d_ref(wildcards): diff --git a/hippunfold/workflow/rules/shape_inject.smk b/hippunfold/workflow/rules/shape_inject.smk index cc529e8e..c0d7318a 100644 --- a/hippunfold/workflow/rules/shape_inject.smk +++ b/hippunfold/workflow/rules/shape_inject.smk @@ -386,6 +386,7 @@ rule unflip_postproc: hemi="{hemi}flip", **config["subj_wildcards"] ), + unflip_ref=get_nnunet_input, output: nii=bids( root=work, @@ -401,4 +402,5 @@ rule unflip_postproc: group: "subj" shell: - "c3d {input} -flip x {output}" + "c3d {input.nii} -flip x -popas FLIPPED " + " {input.unflip_ref} -push FLIPPED -copy-transform -o {output.nii} "