From c9ac98b971c4179e585c021e178dececf0a6635f Mon Sep 17 00:00:00 2001 From: Ali Khan Date: Fri, 10 Jan 2025 09:15:41 -0500 Subject: [PATCH] use updated structure and secondary types --- hippunfold/workflow/rules/gifti.smk | 27 +++++++++++++++++++---- hippunfold/workflow/rules/native_surf.smk | 8 +++---- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/hippunfold/workflow/rules/gifti.smk b/hippunfold/workflow/rules/gifti.smk index 8d3637e4..c28907ab 100644 --- a/hippunfold/workflow/rules/gifti.smk +++ b/hippunfold/workflow/rules/gifti.smk @@ -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", } @@ -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: @@ -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, diff --git a/hippunfold/workflow/rules/native_surf.smk b/hippunfold/workflow/rules/native_surf.smk index cc8e2883..aa886450 100644 --- a/hippunfold/workflow/rules/native_surf.smk +++ b/hippunfold/workflow/rules/native_surf.smk @@ -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: @@ -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: @@ -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: @@ -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: