-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove corobl resample, add crop, --resample-manualseg
- Loading branch information
Showing
2 changed files
with
29 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,24 @@ | ||
config["resample_inplace"] = "20%" | ||
|
||
if config["resample_inplace"] is not None: | ||
|
||
rule import_manualseg: | ||
input: | ||
in_img=partial(get_single_bids_input, component="manualseg"), | ||
params: | ||
resample=config["resample_inplace"], | ||
output: | ||
nii=bids( | ||
root=work, | ||
datatype="anat", | ||
**inputs.subj_wildcards, | ||
suffix="dseg.nii.gz", | ||
space="corobl", | ||
hemi="{hemi,L|R}", | ||
), | ||
group: | ||
"subj" | ||
shell: | ||
"c3d {input} -int 0 -resample {params.resample} -o {output}" | ||
|
||
else: | ||
|
||
rule import_manualseg_to_corobl: | ||
input: | ||
in_img=partial(get_single_bids_input, component="manualseg"), | ||
template_dir=Path(download_dir) / "template" / config["template"], | ||
params: | ||
std_to_cor=lambda wildcards, input: Path(input.template_dir) | ||
/ config["template_files"][config["template"]]["xfm_corobl"].format( | ||
**wildcards | ||
), | ||
ref=lambda wildcards, input: Path(input.template_dir) | ||
/ config["template_files"][config["template"]]["crop_ref"].format( | ||
**wildcards | ||
), | ||
output: | ||
nii=bids( | ||
root=work, | ||
datatype="anat", | ||
**inputs.subj_wildcards, | ||
suffix="dseg.nii.gz", | ||
space="corobl", | ||
hemi="{hemi,L|R}", | ||
), | ||
container: | ||
config["singularity"]["autotop"] | ||
group: | ||
"subj" | ||
shell: | ||
"ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS={threads} " | ||
"antsApplyTransforms -d 3 --interpolation MultiLabel -i {input.in_img} -o {output.nii} -r {params.ref} -t {params.std_to_cor}" | ||
rule import_manualseg_with_resample: | ||
input: | ||
in_img=partial(get_single_bids_input, component="manualseg"), | ||
params: | ||
resample_cmd="" | ||
if config["resample_manualseg"] == None | ||
else "-resample {res}".format(res=config["resample_manualseg"]), | ||
crop_cmd="-trim 5vox", #leave 5 voxel padding | ||
output: | ||
nii=bids( | ||
root=work, | ||
datatype="anat", | ||
**inputs.subj_wildcards, | ||
suffix="dseg.nii.gz", | ||
space="corobl", | ||
hemi="{hemi,L|R}", | ||
), | ||
container: | ||
config["singularity"]["autotop"] | ||
group: | ||
"subj" | ||
shell: | ||
"c3d {input} -int 0 {params.resample_cmd} {params.crop_cmd} -o {output}" |