Skip to content

Commit

Permalink
some more commits to get it working
Browse files Browse the repository at this point in the history
however the cifti-parcellate approach with custom csv header isn't great
when we have custom atlases -- instead should just make a script that
reads in the label.gii, metric.gii, and labellist file and manually
create the dataframe (output to tsv).
  • Loading branch information
akhanf committed Aug 15, 2022
1 parent 02f48ba commit d646fc9
Showing 1 changed file with 59 additions and 5 deletions.
64 changes: 59 additions & 5 deletions hippunfold/workflow/rules/gifti.smk
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ rule resample_atlas_to_refvol:
"antsApplyTransforms -d 3 -n MultiLabel -i {input.atlas} -r {input.refvol} -o {output.label_nii} -v &> {log}"


rule nii_to_label_gii:
rule unfold_subfields_vol_to_metric_gii:
input:
label_nii=bids(
root=work,
Expand All @@ -517,6 +517,45 @@ rule nii_to_label_gii:
"tpl-avg_space-unfold_den-{density}_midthickness.surf.gii",
),
output:
metric_gii=temp(bids(
root=root,
datatype="surf",
den="{density}",
suffix="subfields.shape.gii",
space="{space}",
hemi="{hemi}",
label="hipp",
atlas="{atlas}",
**config["subj_wildcards"]
)),
group:
"subj"
container:
config["singularity"]["autotop"]
shell:
"wb_command -volume-to-surface-mapping {input.label_nii} {input.surf} {output.metric_gii} -enclosing"

rule metric_gii_to_label_gii:
input:
metric_gii=bids(
root=root,
datatype="surf",
den="{density}",
suffix="subfields.shape.gii",
space="{space}",
hemi="{hemi}",
label="hipp",
atlas="{atlas}",
**config["subj_wildcards"]
),
label_list=os.path.join(
workflow.basedir,
"..",
"resources",
"{atlas}",
"{atlas}_labellist.{hemi}.txt",
),
output:
label_gii=bids(
root=root,
datatype="surf",
Expand All @@ -532,9 +571,9 @@ rule nii_to_label_gii:
"subj"
container:
config["singularity"]["autotop"]
shell:
"wb_command -volume-to-surface-mapping {input.label_nii} {input.surf} {output.label_gii} -enclosing"

shell:
"wb_command -metric-label-import {input.metric_gii} {input.label_list} {output.label_gii}"



Expand Down Expand Up @@ -713,7 +752,7 @@ rule create_spec_file_hipp:
metric=get_gifti_metric_types(wildcards.label),
allow_missing=True,
),
subfields=lambda wildcards: expand(
subfields_gii=lambda wildcards: expand(
bids(
root=root,
datatype="surf",
Expand All @@ -728,6 +767,21 @@ rule create_spec_file_hipp:
atlas=config["atlas"],
allow_missing=True,
),
subfields_cifti=lambda wildcards: expand(
bids(
root=root,
datatype="surf",
den="{density}",
suffix="subfields.dlabel.nii",
space="{space}",
label="{label}",
atlas="{atlas}",
**config["subj_wildcards"]
),
atlas=config["atlas"],
allow_missing=True,
),

surfs=expand(
bids(
root=root,
Expand Down

0 comments on commit d646fc9

Please sign in to comment.