Skip to content

Commit

Permalink
use downloaded template for shape-inject
Browse files Browse the repository at this point in the history
  • Loading branch information
akhanf committed Feb 16, 2024
1 parent d73576e commit d3ccc76
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 39 deletions.
48 changes: 25 additions & 23 deletions hippunfold/config/snakebids.yml
Original file line number Diff line number Diff line change
Expand Up @@ -382,32 +382,32 @@ template_files:
crop_refT1w: tpl-dHCP_cohort-1_res-1_space-corobl_hemi-{hemi}_T1w.nii.gz
Mask_crop: tpl-dHCP_cohort-1_res-1_space-corobl_hemi-{hemi}_desc-hipp_mask.nii.gz
MBMv2:
T1w: MBMv2/Template_sym_MTR_80um.nii.gz
T2w: MBMv2/Template_sym_T2_80um.nii.gz
xfm_corobl: MBMv2/tpl-MBMv2_from-native_to-corobl_type-itk_affine.txt
crop_ref: MBMv2/tpl-MBMv2_hemi-{hemi}_space-corobl_{modality}.nii.gz
Mask_crop: MBMv2/tpl-MBMv2_hemi-{hemi}_space-corobl_desc-hipp_mask.nii.gz
dseg: MBMv2/tpl-MBMv2_hemi-R_space-corobl_desc-tissuemanual_dseg.nii.gz
coords: MBMv2/tpl-MBMv2_dir-{dir}_hemi-R_space-corobl_label-{autotop}_desc-laplace_coords.nii.gz
T1w: Template_sym_MTR_80um.nii.gz
T2w: Template_sym_T2_80um.nii.gz
xfm_corobl: tpl-MBMv2_from-native_to-corobl_type-itk_affine.txt
crop_ref: tpl-MBMv2_hemi-{hemi}_space-corobl_{modality}.nii.gz
Mask_crop: tpl-MBMv2_hemi-{hemi}_space-corobl_desc-hipp_mask.nii.gz
dseg: tpl-MBMv2_hemi-R_space-corobl_desc-tissuemanual_dseg.nii.gz
coords: tpl-MBMv2_dir-{dir}_hemi-R_space-corobl_label-{autotop}_desc-laplace_coords.nii.gz
MBMv3:
T1w: MBMv3/tpl-MBMv3_T1w.nii.gz
T2w: MBMv3/tpl-MBMv3_T2w.nii.gz
xfm_corobl: MBMv3/tpl-MBMv3_from-native_to-corobl_type-itk_affine.txt
crop_ref: MBMv3/tpl-MBMv3_hemi-{hemi}_space-corobl_{modality}.nii.gz
Mask_crop: MBMv3/tpl-MBMv3_hemi-{hemi}_space-corobl_desc-hipp_mask.nii.gz
dseg: MBMv3/tpl-MBMv3_hemi-R_space-corobl_desc-tissue_dseg.nii.gz
coords: MBMv3/tpl-MBMv3_dir-{dir}_hemi-R_space-corobl_label-{autotop}_desc-laplace_coords.nii.gz
T1w: tpl-MBMv3_T1w.nii.gz
T2w: tpl-MBMv3_T2w.nii.gz
xfm_corobl: tpl-MBMv3_from-native_to-corobl_type-itk_affine.txt
crop_ref: tpl-MBMv3_hemi-{hemi}_space-corobl_{modality}.nii.gz
Mask_crop: tpl-MBMv3_hemi-{hemi}_space-corobl_desc-hipp_mask.nii.gz
dseg: tpl-MBMv3_hemi-R_space-corobl_desc-tissue_dseg.nii.gz
coords: tpl-MBMv3_dir-{dir}_hemi-R_space-corobl_label-{autotop}_desc-laplace_coords.nii.gz
CIVM:
T1w: CIVM/tpl-CIVM_T1w.nii.gz
xfm_corobl: CIVM/tpl-CIVM_from-native_to-corobl_type-itk_affine.txt
crop_ref: CIVM/tpl-CIVM_hemi-{hemi}_space-corobl_{modality}.nii.gz
Mask_crop: CIVM/tpl-CIVM_hemi-{hemi}_space-corobl_desc-hipp_mask.nii.gz
dseg: CIVM/tpl-CIVM_hemi-R_space-corobl_desc-tissue_dseg.nii.gz
coords: CIVM/tpl-CIVM_dir-{dir}_hemi-R_space-corobl_label-{autotop}_desc-laplace_coords.nii.gz
T1w: tpl-CIVM_T1w.nii.gz
xfm_corobl: tpl-CIVM_from-native_to-corobl_type-itk_affine.txt
crop_ref: tpl-CIVM_hemi-{hemi}_space-corobl_{modality}.nii.gz
Mask_crop: tpl-CIVM_hemi-{hemi}_space-corobl_desc-hipp_mask.nii.gz
dseg: tpl-CIVM_hemi-R_space-corobl_desc-tissue_dseg.nii.gz
coords: tpl-CIVM_dir-{dir}_hemi-R_space-corobl_label-{autotop}_desc-laplace_coords.nii.gz
upenn:
T1w: upenn/tpl-upenn_desc-hipptissue_dseg.nii.gz
dseg: upenn/tpl-upenn_desc-hipptissue_dseg.nii.gz
coords: upenn/tpl-upenn_dir-{dir}_label-{autotop}_coords.nii.gz
T1w: tpl-upenn_desc-hipptissue_dseg.nii.gz
dseg: tpl-upenn_desc-hipptissue_dseg.nii.gz
coords: tpl-upenn_dir-{dir}_label-{autotop}_coords.nii.gz

atlas_files:
multihist7:
Expand Down Expand Up @@ -458,6 +458,8 @@ no_reg_template: False

modality: T2w

inject_template: upenn

template: CITI168

atlas:
Expand Down
2 changes: 1 addition & 1 deletion hippunfold/workflow/rules/preproc_t1.smk
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ rule template_xfm_itk2ras:
datatype="warps",
**config["subj_wildcards"],
suffix="xfm.txt",
from_="{native_modality,T1w|T2w}",
from_="{native_modality}",
to="corobl",
desc="affine",
type_="itk"
Expand Down
23 changes: 8 additions & 15 deletions hippunfold/workflow/rules/shape_inject.smk
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,10 @@ rule prep_segs_for_greedy:

rule import_template_shape:
input:
template_seg=os.path.join(
workflow.basedir,
"..",
"resources",
"tpl-upenn",
"tpl-upenn_desc-hipptissue_dseg.nii.gz",
),
template_dir=Path(download_dir) / "template" / config["inject_template"],
params:
template_seg=lambda wildcards, input: Path(input.template_dir)
/ config["template_files"][config["inject_template"]]["dseg"],
output:
template_seg=bids(
root=work,
Expand Down Expand Up @@ -279,13 +276,6 @@ rule template_shape_inject:

rule inject_init_laplace_coords:
input:
coords=os.path.join(
workflow.basedir,
"..",
"resources",
"tpl-upenn",
"tpl-upenn_dir-{dir}_label-{autotop}_coords.nii.gz",
),
subject_seg=get_input_for_shape_inject,
matrix=bids(
root=work,
Expand All @@ -310,7 +300,10 @@ rule inject_init_laplace_coords:
space="corobl",
hemi="{hemi}"
),
template_dir=Path(download_dir) / "template" / config["inject_template"],
params:
coords=lambda wildcards, input: Path(input.template_dir)
/ config["template_files"][config["inject_template"]]["coords"],
interp_opt="-ri NN",
output:
init_coords=bids(
Expand Down Expand Up @@ -340,7 +333,7 @@ rule inject_init_laplace_coords:
config["singularity"]["autotop"]
threads: 8
shell:
"greedy -d 3 -threads {threads} {params.interp_opt} -rf {input.subject_seg} -rm {input.coords} {output.init_coords} -r {input.warp} {input.matrix} &> {log}"
"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 unflip_init_coords:
Expand Down

0 comments on commit d3ccc76

Please sign in to comment.