Skip to content

Commit

Permalink
use updated structure and secondary types
Browse files Browse the repository at this point in the history
  • Loading branch information
akhanf committed Jan 10, 2025
1 parent d9edaf2 commit c9ac98b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
27 changes: 23 additions & 4 deletions hippunfold/workflow/rules/gifti.smk
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
# lookup tables for structure:
hemi_to_structure = {"L": "CORTEX_LEFT", "R": "CORTEX_RIGHT"}


def get_structure(hemi, label):
if label == "hipp":
if hemi == "L":
return "HIPPOCAMPUS_LEFT"
elif hemi == "R":
return "HIPPOCAMPUS_RIGHT"
elif label == "dentate":
if hemi == "L":
return "HIPPOCAMPUS_DENTATE_LEFT"
elif hemi == "R":
return "HIPPOCAMPUS_DENTATE_RIGHT"


surf_to_secondary_type = {
"midthickness": "MIDTHICKNESS",
"inner": "PIAL",
"outer": "GRAY_WHITE",
"inner": "INNER",
"outer": "OUTER",
}


Expand All @@ -18,7 +33,9 @@ rule cp_template_to_unfold:
"tpl-avg_space-unfold_den-{density}_{surfname}.surf.gii",
),
params:
structure_type=lambda wildcards: hemi_to_structure[wildcards.hemi],
structure_type=lambda wildcards: get_structure(
wildcards.hemi, wildcards.autotop
),
secondary_type=lambda wildcards: surf_to_secondary_type[wildcards.surfname],
surface_type="FLAT",
output:
Expand Down Expand Up @@ -59,7 +76,9 @@ rule calc_unfold_template_coords:
coord_IO="coord-IO.shape.gii",
origin=lambda wildcards: config["{autotop}"]["origin"],
extent=lambda wildcards: config["{autotop}"]["extent"],
structure_type=lambda wildcards: hemi_to_structure[wildcards.hemi],
structure_type=lambda wildcards: get_structure(
wildcards.hemi, wildcards.autotop
),
output:
coords_gii=bids(
root=work,
Expand Down
8 changes: 4 additions & 4 deletions hippunfold/workflow/rules/native_surf.smk
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ rule update_native_mesh_structure:
**inputs.subj_wildcards
),
params:
structure_type=lambda wildcards: hemi_to_structure[wildcards.hemi],
structure_type=lambda wildcards: get_structure(wildcards.hemi, wildcards.label),
secondary_type=lambda wildcards: surf_to_secondary_type[wildcards.surfname],
surface_type="ANATOMICAL",
output:
Expand Down Expand Up @@ -320,7 +320,7 @@ rule warp_native_mesh_to_unfold:
mode="surface"
),
params:
structure_type=lambda wildcards: hemi_to_structure[wildcards.hemi],
structure_type=lambda wildcards: get_structure(wildcards.hemi, wildcards.label),
secondary_type=lambda wildcards: surf_to_secondary_type[wildcards.surfname],
surface_type="FLAT",
output:
Expand Down Expand Up @@ -699,7 +699,7 @@ rule warp_midthickness_to_inout:
**inputs.subj_wildcards
),
params:
structure_type=lambda wildcards: hemi_to_structure[wildcards.hemi],
structure_type=lambda wildcards: get_structure(wildcards.hemi, wildcards.label),
secondary_type=lambda wildcards: surf_to_secondary_type[wildcards.surfname],
surface_type="ANATOMICAL",
output:
Expand Down Expand Up @@ -1414,7 +1414,7 @@ rule warp_unfold_native_to_unfoldreg:
**inputs.subj_wildcards,
),
params:
structure_type=lambda wildcards: hemi_to_structure[wildcards.hemi],
structure_type=lambda wildcards: get_structure(wildcards.hemi, wildcards.label),
secondary_type=lambda wildcards: surf_to_secondary_type[wildcards.surfname],
surface_type="FLAT",
output:
Expand Down

0 comments on commit c9ac98b

Please sign in to comment.