Skip to content

Commit

Permalink
remove env7 and split rules reg_t2_to_t1/ref into 2 rules respectively
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhananjhay committed Jan 21, 2025
1 parent 4842076 commit b661b82
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 31 deletions.
9 changes: 0 additions & 9 deletions hippunfold/workflow/envs/env7.yaml

This file was deleted.

87 changes: 65 additions & 22 deletions hippunfold/workflow/rules/preproc_t2.smk
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def get_floating_n4_t2(wildcards):
return t2_imgs[int(wildcards.idx)]


rule reg_t2_to_ref:
rule reg_t2_to_ref_part1:
input:
ref=get_ref_n4_t2,
flo=get_floating_n4_t2,
Expand All @@ -93,33 +93,55 @@ rule reg_t2_to_ref:
desc="rigid",
type_="ras"
),
xfm_itk=bids(
warped=bids(
root=work,
datatype="anat",
suffix="T2w.nii.gz",
desc="aligned",
floating="{idx}",
**inputs.subj_wildcards,
),
container:
config["singularity"]["autotop"]
conda:
"../envs/niftyreg.yaml"
group:
"subj"
shell:
"reg_aladin -flo {input.flo} -ref {input.ref} -res {output.warped} -aff {output.xfm_ras} -rigOnly -nac"

rule reg_t2_to_ref_part2:
input:
xfm_ras=bids(
root=work,
datatype="warps",
**inputs.subj_wildcards,
suffix="xfm.txt",
from_="T2w{idx}",
to="T2w0",
desc="rigid",
type_="itk"
type_="ras"
),
warped=bids(
output:
xfm_itk=bids(
root=work,
datatype="anat",
suffix="T2w.nii.gz",
desc="aligned",
floating="{idx}",
datatype="warps",
**inputs.subj_wildcards,
suffix="xfm.txt",
from_="T2w{idx}",
to="T2w0",
desc="rigid",
type_="itk"
),
container:
config["singularity"]["autotop"]
conda:
"../envs/env7.yaml"
"../envs/c3d.yaml"
group:
"subj"
shell:
"reg_aladin -flo {input.flo} -ref {input.ref} -res {output.warped} -aff {output.xfm_ras} -rigOnly -nac && "
"c3d_affine_tool {output.xfm_ras} -oitk {output.xfm_itk}"
"c3d_affine_tool {input.xfm_ras} -oitk {output.xfm_itk}"



def get_aligned_n4_t2(wildcards):
Expand Down Expand Up @@ -191,7 +213,7 @@ else:
"{params.cmd}"


rule reg_t2_to_t1:
rule reg_t2_to_t1_part1:
input:
flo=bids(
root=root,
Expand Down Expand Up @@ -226,35 +248,56 @@ rule reg_t2_to_t1:
desc="rigid",
type_="ras"
),
xfm_itk=bids(
log:
bids(
root="logs",
**inputs.subj_wildcards,
suffix="reg.txt",
from_="T2w",
to="T1w",
desc="rigid",
type_="ras"
),
container:
config["singularity"]["autotop"]
conda:
"../envs/niftyreg.yaml"
group:
"subj"
shell:
"reg_aladin -flo {input.flo} -ref {input.ref} -res {output.warped} -aff {output.xfm_ras} -rigOnly -nac &> {log}"

rule reg_t2_to_t1_part2:
input:
xfm_ras=bids(
root=work,
datatype="warps",
**inputs.subj_wildcards,
suffix="xfm.txt",
from_="T2w",
to="T1w",
desc="rigid",
type_="itk"
type_="ras"
),
log:
bids(
root="logs",
output:
xfm_itk=bids(
root=work,
datatype="warps",
**inputs.subj_wildcards,
suffix="reg.txt",
suffix="xfm.txt",
from_="T2w",
to="T1w",
desc="rigid",
type_="ras"
type_="itk"
),
container:
config["singularity"]["autotop"]
conda:
"../envs/env7.yaml"
"../envs/c3d.yaml"
group:
"subj"
shell:
"reg_aladin -flo {input.flo} -ref {input.ref} -res {output.warped} -aff {output.xfm_ras} -rigOnly -nac &> {log} && "
"c3d_affine_tool {output.xfm_ras} -oitk {output.xfm_itk}"
"c3d_affine_tool {input.xfm_ras} -oitk {output.xfm_itk}"


def get_inputs_compose_t2_xfm_corobl(wildcards):
Expand Down

0 comments on commit b661b82

Please sign in to comment.