Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan DeKraker committed Dec 17, 2024
1 parent 3c93675 commit c395b14
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
1 change: 0 additions & 1 deletion hippunfold/workflow/rules/nnunet.smk
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ rule run_inference:
"cp {params.temp_lbl} {output.nnunet_seg}"



def get_f3d_ref(wildcards, input):
if config["modality"] == "T2w":
nii = Path(input.template_dir) / config["template_files"][config["template"]][
Expand Down
1 change: 0 additions & 1 deletion hippunfold/workflow/rules/preproc_hippb500.smk
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ rule resample_hippdwi_to_template:
" -trim 0vox -o {output}"



rule cp_b500_to_anat_dir:
input:
nii=bids(
Expand Down
1 change: 0 additions & 1 deletion hippunfold/workflow/rules/preproc_t1.smk
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,3 @@ rule warp_t1_to_corobl_crop:
shell:
"ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS={threads} "
"antsApplyTransforms -d 3 --interpolation Linear -i {input.t1} -o {output.t1} -r {params.ref} -t {input.xfm}"

1 change: 0 additions & 1 deletion hippunfold/workflow/rules/preproc_t2.smk
Original file line number Diff line number Diff line change
Expand Up @@ -412,4 +412,3 @@ rule warp_t2_to_corobl_crop:
shell:
"ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS={threads} "
"antsApplyTransforms -d 3 --interpolation Linear -i {input.nii} -o {output.nii} -r {params.ref} -t {input.xfm}"

11 changes: 6 additions & 5 deletions hippunfold/workflow/rules/shape_inject.smk
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ rule import_template_shape:
space="template",
**inputs.subj_wildcards,
desc="hipptissue",
hemi=config["template_based_segmentation"][config["inject_template"]]["hemi"],
hemi=config["template_based_segmentation"][config["inject_template"]][
"hemi"
],
suffix="dseg.nii.gz"
),
group:
Expand All @@ -36,7 +38,9 @@ rule flip_template_dseg:
space="template",
**inputs.subj_wildcards,
desc="hipptissue",
hemi=config["template_based_segmentation"][config["inject_template"]]["hemi"],
hemi=config["template_based_segmentation"][config["inject_template"]][
"hemi"
],
suffix="dseg.nii.gz"
),
output:
Expand Down Expand Up @@ -120,7 +124,6 @@ rule prep_segs_for_greedy:
"c3d {input} -retain-labels {params.labels} -split -foreach -smooth {params.smoothing_stdev} -endfor -oo {output}/label_%02d.nii.gz"



def get_image_pairs(wildcards, input):
"""This rule requires snakemake 6.4.0, since it uses the new feature to execute if input files are not found"""

Expand Down Expand Up @@ -352,7 +355,6 @@ rule inject_init_laplace_coords:
"greedy -d 3 -threads {threads} {params.interp_opt} -rf {input.subject_seg} -rm {params.coords} {output.init_coords} -r {input.warp} {input.matrix} &> {log}"



rule reinsert_subject_labels:
input:
inject_seg=bids(
Expand Down Expand Up @@ -385,4 +387,3 @@ rule reinsert_subject_labels:
config["singularity"]["autotop"]
shell:
"c3d {input.subject_seg} -retain-labels {params.labels} -popas LBL -push LBL -threshold 0 0 1 0 {input.inject_seg} -multiply -push LBL -add -o {output.postproc_seg}"

29 changes: 16 additions & 13 deletions hippunfold/workflow/rules/templateseg.smk
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ rule import_template_shape:
space="template",
**inputs.subj_wildcards,
desc="hipptissue",
hemi=config["template_based_segmentation"][config["inject_template"]]["hemi"],
hemi=config["template_based_segmentation"][config["inject_template"]][
"hemi"
],
suffix="dseg.nii.gz"
),
group:
Expand All @@ -45,7 +47,9 @@ rule flip_template_dseg:
space="template",
**inputs.subj_wildcards,
desc="hipptissue",
hemi=config["template_based_segmentation"][config["inject_template"]]["hemi"],
hemi=config["template_based_segmentation"][config["inject_template"]][
"hemi"
],
suffix="dseg.nii.gz"
),
output:
Expand All @@ -71,9 +75,9 @@ rule import_template_anat:
template_dir=Path(download_dir) / "template" / config["template"],
params:
template_anat=lambda wildcards, input: Path(input.template_dir)
/ config["template_files"][config["template"]][get_modality_suffix(config["modality"])].format(
**wildcards
),
/ config["template_files"][config["template"]][
get_modality_suffix(config["modality"])
].format(**wildcards),
output:
template_anat=bids(
root=work,
Expand Down Expand Up @@ -129,9 +133,7 @@ rule import_template_coords:
template_dir=Path(download_dir) / "template" / config["template"],
params:
template_coords=lambda wildcards, input: Path(input.template_dir)
/ config["template_files"][config["template"]]["coords"].format(
**wildcards
),
/ config["template_files"][config["template"]]["coords"].format(**wildcards),
output:
template_coords=bids(
root=work,
Expand All @@ -143,7 +145,7 @@ rule import_template_coords:
desc="init",
space="template",
hemi="{hemi}"
)
),
group:
"subj"
container:
Expand All @@ -163,8 +165,10 @@ rule flip_template_coords:
suffix="coords.nii.gz",
desc="init",
space="template",
hemi=config["template_based_segmentation"][config["inject_template"]]["hemi"],
)
hemi=config["template_based_segmentation"][config["inject_template"]][
"hemi"
],
),
output:
template_coords=bids(
root=work,
Expand Down Expand Up @@ -394,7 +398,7 @@ rule warp_template_anat:
suffix=f"{config['modality']}.nii.gz",
desc="warpedtemplate",
space="corobl",
hemi="{hemi}"
hemi="{hemi}",
),
group:
"subj"
Expand All @@ -403,4 +407,3 @@ rule warp_template_anat:
threads: 8
shell:
"greedy -d 3 -threads {threads} -rf {input.ref} -rm {params.template_anat} {output.warped} -r {input.warp} {params.xfm_corobl}"

0 comments on commit c395b14

Please sign in to comment.