Skip to content

Commit

Permalink
this refactors the config to put template stuff together
Browse files Browse the repository at this point in the history
- adds a hemi_wildcards field instead
  • Loading branch information
akhanf committed Dec 19, 2024
1 parent 2525dfc commit 1916e01
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 26 deletions.
55 changes: 30 additions & 25 deletions hippunfold/config/snakebids.yml
Original file line number Diff line number Diff line change
Expand Up @@ -354,32 +354,7 @@ singularity:
xfm_identity: resources/etc/identity_xfm.txt
xfm_identity_itk: resources/etc/identity_xfm_itk.txt

#templates enabled for template-based segmentation are here
# TODO: should also perhaps include modalities avaialble, and any custom crop_native_res settings
template_available_hemis:
CITI168:
- R
- L
dHCP:
- R
- L
MBMv2:
- R
MBMv3:
- R
CIVM:
- R
- L
upenn:
- R
ABAv3:
- R
- L
bigbrain:
- R
- L


template_files:
CITI168:
T1w: T1w_head_700um.nii.gz
Expand All @@ -390,6 +365,9 @@ template_files:
Mask_crop: Mask_300umCoronalOblique_hemi-{hemi}.nii.gz
dseg: sub-CITI168_hemi-{hemi}_space-cropT1w_desc-postproc_dseg.nii.gz
coords: sub-CITI168_dir-{dir}_hemi-{hemi}_space-cropT1w_label-{autotop}_desc-laplace_coords.nii.gz
hemi_wildcards:
- L
- R
dHCP:
T1w: tpl-dHCP_cohort-1_res-1_T1w.nii.gz
T2w: tpl-dHCP_cohort-1_res-1_T2w.nii.gz
Expand All @@ -399,6 +377,10 @@ template_files:
Mask_crop: tpl-dHCP_cohort-1_res-1_space-corobl_hemi-{hemi}_desc-hipp_mask.nii.gz
dseg: tpl-dHCP_space-corobl_hemi-{hemi}_desc-tissuemanualseg_dseg.nii.gz
coords: tpl-dHCP_dir-{dir}_hemi-{hemi}_space-corobl_label-{autotop}_desc-laplace_coords.nii.gz
hemi_wildcards:
- L
- R

MBMv2:
T1w: Template_sym_MTR_80um.nii.gz
T2w: Template_sym_T2_80um.nii.gz
Expand All @@ -407,6 +389,9 @@ template_files:
Mask_crop: tpl-MBMv2_hemi-R_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
hemi_wildcards:
- R

MBMv3:
T1w: tpl-MBMv3_T1w.nii.gz
T2w: tpl-MBMv3_T2w.nii.gz
Expand All @@ -415,24 +400,40 @@ template_files:
Mask_crop: tpl-MBMv3_hemi-R_space-corobl_desc-hipp_mask.nii.gz
dseg: tpl-MBMv3_hemi-R_space-corobl_desc-tissuemanual_dseg.nii.gz
coords: tpl-MBMv3_dir-{dir}_hemi-R_space-corobl_label-{autotop}_desc-laplace_coords.nii.gz
hemi_wildcards:
- R


CIVM:
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-{hemi}_space-corobl_desc-tissuemanual_dseg.nii.gz
coords: tpl-CIVM_dir-{dir}_hemi-{hemi}_space-corobl_label-{autotop}_desc-laplace_coords.nii.gz
hemi_wildcards:
- L
- R


upenn:
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
hemi_wildcards:
- R

ABAv3:
T1w: tpl-ABAv3_T1w.nii.gz
xfm_corobl: tpl-ABAv3_from-native_to-corobl_type-itk_affine.txt
crop_ref: tpl-ABAv3_hemi-{hemi}_space-corobl_T1w.nii.gz
Mask_crop: tpl-ABAv3_hemi-{hemi}_space-corobl_desc-tissuemanual_dseg.nii.gz
dseg: tpl-ABAv3_hemi-{hemi}_space-corobl_desc-tissuemanual_dseg.nii.gz
coords: tpl-ABAv3_dir-{dir}_hemi-{hemi}_space-corobl_label-{autotop}_desc-laplace_coords.nii.gz
hemi_wildcards:
- L
- R

bigbrain:
T1w: tpl-bigbrain_1mm_merker.nii.gz
T2w: tpl-bigbrain_1mm_merker.nii.gz
Expand All @@ -441,6 +442,10 @@ template_files:
Mask_crop: tpl-bigbrain_hemi-{hemi}_space-corobl_desc-tissuemanual_100um_dseg.nii.gz
dseg: tpl-bigbrain_hemi-{hemi}_space-corobl_desc-tissuemanual_100um_dseg.nii.gz
coords: tpl-bigbrain_dir-{dir}_hemi-{hemi}_space-corobl_label-{autotop}_desc-laplace_coords.nii.gz
hemi_wildcards:
- L
- R



atlas_files:
Expand Down
5 changes: 4 additions & 1 deletion hippunfold/workflow/rules/download.smk
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ rule download_extract_template:


def copy_or_flip(wildcards, file_to_process):
if wildcards.hemi in config["template_available_hemis"][config["inject_template"]]:
if (
wildcards.hemi
in config["template_files"][config["inject_template"]]["hemi_wildcards"]
):
cmd = f"cp {file_to_process}"
else:
cmd = f"c3d {file_to_process} -flip x -o"
Expand Down

0 comments on commit 1916e01

Please sign in to comment.