From 82d06f4c6f5697acf944642be511a0548f1e3752 Mon Sep 17 00:00:00 2001 From: Jordan DeKraker Date: Wed, 12 Jun 2024 11:37:53 -0400 Subject: [PATCH 1/2] ABAv3 mouse atlas+template (#299) * uploaded ABAv3 mouse * felled missing info * LUTs to OSF for easier additions in the future * lint * snake-friendly formatting * downloads lists * lambda for LUT * atlas_dir as input, filename as param * updates to use params rather than input * passing inputs to params * lint * typo * linting back to previous --------- Co-authored-by: Jordan DeKraker --- hippunfold/config/snakebids.yml | 31 +++++++++++++++++-- .../desc-subfields_atlas-bigbrain_dseg.tsv | 9 ------ .../desc-subfields_atlas-freesurfer_dseg.tsv | 10 ------ .../desc-subfields_atlas-magdeburg_dseg.tsv | 9 ------ .../desc-subfields_atlas-multihist7_dseg.tsv | 9 ------ .../label_lut/desc-subfields_dseg.tsv | 9 ------ .../desc-subfields_freeview_desg.tsv | 10 ------ hippunfold/resources/label_lut/dseg.tsv | 29 ----------------- hippunfold/workflow/rules/qc.smk | 8 ++--- hippunfold/workflow/scripts/gen_volume_tsv.py | 2 +- 10 files changed, 34 insertions(+), 92 deletions(-) delete mode 100644 hippunfold/resources/label_lut/desc-subfields_atlas-bigbrain_dseg.tsv delete mode 100644 hippunfold/resources/label_lut/desc-subfields_atlas-freesurfer_dseg.tsv delete mode 100644 hippunfold/resources/label_lut/desc-subfields_atlas-magdeburg_dseg.tsv delete mode 100644 hippunfold/resources/label_lut/desc-subfields_atlas-multihist7_dseg.tsv delete mode 100644 hippunfold/resources/label_lut/desc-subfields_dseg.tsv delete mode 100644 hippunfold/resources/label_lut/desc-subfields_freeview_desg.tsv delete mode 100644 hippunfold/resources/label_lut/dseg.tsv diff --git a/hippunfold/config/snakebids.yml b/hippunfold/config/snakebids.yml index 60535759..8ca8bf2b 100644 --- a/hippunfold/config/snakebids.yml +++ b/hippunfold/config/snakebids.yml @@ -150,8 +150,9 @@ parse_args: - 'MBMv2' - 'MBMv3' - 'CIVM' + - 'ABAv3' default: 'CITI168' - help: 'Set the template to use for registration to coronal oblique (and optionally for template-based segmentation if --use-template-seg is enabled). CITI168 is for adult human data, dHCP is for neonatal human data, MBMv2 is for ex vivo marmoset data, MBMv3 is for in vivo marmoset data, and CIVM is for in vivo macaque data. (default: %(default)s)' + help: 'Set the template to use for registration to coronal oblique (and optionally for template-based segmentation if --use-template-seg is enabled). CITI168 is for adult human data, dHCP is for neonatal human data, MBMv2 is for ex vivo marmoset data, MBMv3 is for in vivo marmoset data, CIVM is for in vivo macaque data, and ABAv3 is for mouse data. (default: %(default)s)' @@ -162,6 +163,7 @@ parse_args: - 'MBMv2' - 'MBMv3' - 'CIVM' + - 'ABAv3' default: 'upenn' help: 'Set the template to use for shape injection. (default: %(default)s)' @@ -231,6 +233,7 @@ parse_args: - 'magdeburg' - 'freesurfer' - 'multihist7' + - 'mouse' default: - 'multihist7' nargs: '+' @@ -384,6 +387,10 @@ template_based_segmentation: MBMv3: hemi: - R + ABAv3: + hemi: + - R + - L template_files: @@ -430,23 +437,38 @@ template_files: 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 + 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 atlas_files: multihist7: label_nii: sub-maxprob_label-hipp_desc-manualsubfieldsunfoldaligned_dseg.nii.gz + lut: desc-subfields_atlas-multihist7_dseg.tsv label_list: labellist.txt thickness: thickness.nii.gz curvature: curvature.nii.gz gyrification: gyrification.nii.gz bigbrain: label_nii: sub-bigbrain_hemi-{hemi}_label-hipp_desc-manualsubfields_dseg.nii.gz + lut: desc-subfields_atlas-bigbrain_dseg.tsv label_list: sub-bigbrain_labellist.txt magdeburg: label_nii: sub-all_hemi-{hemi}_label-hipp_desc-manualsubfields_maxprob.nii.gz + lut: desc-subfields_atlas-magdeburg_dseg.tsv label_list: magdeburg_labellist.txt freesurfer: label_nii: sub-all_hemi-{hemi}_space-unfold_label-hipp_desc-freesurfersubfields_dseg.nii.gz + lut: desc-subfields_atlas-mfreesurfer_dseg.tsv label_list: freesurfer_labellist.txt + mouse: + label_nii: sub-ABAv3_space-unfold_label-hipp_desc-mousesubfields_dseg.nii.gz + lut: desc-subfields_atlas-mouse_dseg.tsv + label_list: mouse_labellist.txt #values to use for re-mapping tissue labels when combining with subfields. @@ -472,7 +494,10 @@ tissue_atlas_mapping: dg: 209 srlm: 227 cyst: 228 - + mouse: + dg: 6 + srlm: 7 + cyst: 8 rigid_reg_template: False @@ -505,6 +530,7 @@ resource_urls: bigbrain: 'files.ca-1.osf.io/v1/resources/v8acf/providers/osfstorage/65395b8b13d27b123094c96f/?zip=' magdeburg: 'files.ca-1.osf.io/v1/resources/v8acf/providers/osfstorage/65395b8013d27b122f94c938/?zip=' freesurfer: 'files.ca-1.osf.io/v1/resources/v8acf/providers/osfstorage/65395b8513d27b123094c96a/?zip=' + mouse: 'files.ca-1.osf.io/v1/resources/v8acf/providers/osfstorage/666884380f8c80103a3c9569/?zip=' template: CITI168: 'files.ca-1.osf.io/v1/resources/v8acf/providers/osfstorage/65395bf0282745121fb86a93/?zip=' dHCP: 'files.ca-1.osf.io/v1/resources/v8acf/providers/osfstorage/65395bff13d27b123094c9b4/?zip=' @@ -512,6 +538,7 @@ resource_urls: MBMv3: 'files.ca-1.osf.io/v1/resources/v8acf/providers/osfstorage/65395c0e8a28b11240ffc6e9/?zip=' upenn: 'files.ca-1.osf.io/v1/resources/v8acf/providers/osfstorage/65395c1613d27b122a94ca09/?zip=' CIVM: 'files.ca-1.osf.io/v1/resources/v8acf/providers/osfstorage/65395bf62827451220b86e24/?zip=' + ABAv3: 'files.ca-1.osf.io/v1/resources/v8acf/providers/osfstorage/6668855b6b6c8e2cc704ca97/?zip=' #to get hash, see https://github.com/CenterForOpenScience/osf.io/issues/8256#issuecomment-379833911 diff --git a/hippunfold/resources/label_lut/desc-subfields_atlas-bigbrain_dseg.tsv b/hippunfold/resources/label_lut/desc-subfields_atlas-bigbrain_dseg.tsv deleted file mode 100644 index b4293fbe..00000000 --- a/hippunfold/resources/label_lut/desc-subfields_atlas-bigbrain_dseg.tsv +++ /dev/null @@ -1,9 +0,0 @@ -index name abbreviation -1 subiculum Sub -2 CA1 CA1 -3 CA2 CA2 -4 CA3 CA3 -5 CA4 CA4 -6 dentate_gyrus DG -7 SRLM SRLM -8 cysts Cyst diff --git a/hippunfold/resources/label_lut/desc-subfields_atlas-freesurfer_dseg.tsv b/hippunfold/resources/label_lut/desc-subfields_atlas-freesurfer_dseg.tsv deleted file mode 100644 index 95a20f78..00000000 --- a/hippunfold/resources/label_lut/desc-subfields_atlas-freesurfer_dseg.tsv +++ /dev/null @@ -1,10 +0,0 @@ -index name abbreviation -203 parasubiculum ParaSub -204 presubiculum PreSub -205 subiculum Sub -206 CA1 CA1 -208 CA3 CA3 -209 CA4_and_dentate gyrus CA4_DG -226 tail Tail -227 SRLM SRLM -228 cysts Cyst diff --git a/hippunfold/resources/label_lut/desc-subfields_atlas-magdeburg_dseg.tsv b/hippunfold/resources/label_lut/desc-subfields_atlas-magdeburg_dseg.tsv deleted file mode 100644 index 3c0ee0f1..00000000 --- a/hippunfold/resources/label_lut/desc-subfields_atlas-magdeburg_dseg.tsv +++ /dev/null @@ -1,9 +0,0 @@ -index name abbreviation -1 CA1 CA1 -2 CA2 CA2 -3 dentate_gyrus DG -4 CA3 CA3 -5 tail Tail -8 subiculum Sub -9 SRLM SRLM -10 cysts Cyst diff --git a/hippunfold/resources/label_lut/desc-subfields_atlas-multihist7_dseg.tsv b/hippunfold/resources/label_lut/desc-subfields_atlas-multihist7_dseg.tsv deleted file mode 100644 index b4293fbe..00000000 --- a/hippunfold/resources/label_lut/desc-subfields_atlas-multihist7_dseg.tsv +++ /dev/null @@ -1,9 +0,0 @@ -index name abbreviation -1 subiculum Sub -2 CA1 CA1 -3 CA2 CA2 -4 CA3 CA3 -5 CA4 CA4 -6 dentate_gyrus DG -7 SRLM SRLM -8 cysts Cyst diff --git a/hippunfold/resources/label_lut/desc-subfields_dseg.tsv b/hippunfold/resources/label_lut/desc-subfields_dseg.tsv deleted file mode 100644 index b4293fbe..00000000 --- a/hippunfold/resources/label_lut/desc-subfields_dseg.tsv +++ /dev/null @@ -1,9 +0,0 @@ -index name abbreviation -1 subiculum Sub -2 CA1 CA1 -3 CA2 CA2 -4 CA3 CA3 -5 CA4 CA4 -6 dentate_gyrus DG -7 SRLM SRLM -8 cysts Cyst diff --git a/hippunfold/resources/label_lut/desc-subfields_freeview_desg.tsv b/hippunfold/resources/label_lut/desc-subfields_freeview_desg.tsv deleted file mode 100644 index 899126ce..00000000 --- a/hippunfold/resources/label_lut/desc-subfields_freeview_desg.tsv +++ /dev/null @@ -1,10 +0,0 @@ -#No. Label Name R G B A -1 subiculum 255 0 0 0 -2 CA1 0 255 0 0 -3 CA2 0 0 255 0 -4 CA3 255 255 0 0 -5 CA4 0 255 255 0 -6 dentate_gyrus 255 0 255 0 -7 SRLM 255 239 213 0 -8 cysts 0 0 205 0 - diff --git a/hippunfold/resources/label_lut/dseg.tsv b/hippunfold/resources/label_lut/dseg.tsv deleted file mode 100644 index 7af6d5c0..00000000 --- a/hippunfold/resources/label_lut/dseg.tsv +++ /dev/null @@ -1,29 +0,0 @@ -index name abbreviation -1 right hippocampal grey matter RGM -2 right SRLM or 'dark band' RSRLM -3 right neocortex (entorhinal or parahippocampal) RMTLC -4 right pial surface RPial -5 right hippocampal-amygdalar transition area RHATA -6 right indusium griseum RIndGris -7 right cysts RCyst -8 right dentate gyrus RDG -11 left hippocampal grey matter LGM -12 left SRLM or 'dark band' LSRLM -13 left neocortex (entorhinal or parahippocampal) LMTLC -14 left pial surface LPial -15 left hippocampal-amygdalar transition area LHATA -16 left indusium griseum LIndGris -17 left cysts LCyst -18 left dentate gyrus LDGm -21 right subiculum RSub -22 right CA1 RCA1 -23 right CA2 RCA2 -24 right CA3 RCA3 -25 right CA4 RCA4 -26 right dentate gyrus RDG -31 left subiculum LSub -32 left CA1 LCA1 -33 left CA2 LCA2 -34 left CA3 LCA3 -35 left CA4 LCA4 -36 left dentate gyrus LDG diff --git a/hippunfold/workflow/rules/qc.smk b/hippunfold/workflow/rules/qc.smk index 0e97e6c6..076fd9aa 100644 --- a/hippunfold/workflow/rules/qc.smk +++ b/hippunfold/workflow/rules/qc.smk @@ -54,10 +54,10 @@ rule get_subfield_vols_subj: hemi=config["hemi"], allow_missing=True, ), - lookup_tsv=Path(workflow.basedir).parent - / "resources" - / "label_lut" - / "desc-subfields_atlas-{atlas}_dseg.tsv", + atlas_dir=lambda wildcards: Path(download_dir) / "atlas" / wildcards.atlas, + params: + lookup_tsv=lambda wildcards, input: Path(input.atlas_dir) + / config["atlas_files"][wildcards.atlas]["lut"].format(**wildcards), group: "subj" output: diff --git a/hippunfold/workflow/scripts/gen_volume_tsv.py b/hippunfold/workflow/scripts/gen_volume_tsv.py index e663cf62..1508b266 100644 --- a/hippunfold/workflow/scripts/gen_volume_tsv.py +++ b/hippunfold/workflow/scripts/gen_volume_tsv.py @@ -2,7 +2,7 @@ import pandas as pd import numpy as np -lookup_df = pd.read_table(snakemake.input.lookup_tsv, index_col="index") +lookup_df = pd.read_table(snakemake.params.lookup_tsv, index_col="index") # get indices and names from lookup table indices = lookup_df.index.to_list() From 2ad1bca2e2d5860a8cb9b7d36bc2f34e9ac86863 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 12 Jun 2024 15:38:18 +0000 Subject: [PATCH 2/2] Bump version to 1.4.2-pre.42 --- hippunfold/config/snakebids.yml | 2 +- hippunfold/pipeline_description.json | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hippunfold/config/snakebids.yml b/hippunfold/config/snakebids.yml index 8ca8bf2b..7ceffb98 100644 --- a/hippunfold/config/snakebids.yml +++ b/hippunfold/config/snakebids.yml @@ -128,7 +128,7 @@ parse_args: --version: help: 'Print the version of HippUnfold' action: version - version: "1.4.2-pre.41" + version: "1.4.2-pre.42" --modality: diff --git a/hippunfold/pipeline_description.json b/hippunfold/pipeline_description.json index 08320b9d..4ff5f350 100644 --- a/hippunfold/pipeline_description.json +++ b/hippunfold/pipeline_description.json @@ -5,7 +5,7 @@ "GeneratedBy": [ { "Name": "hippunfold", - "Version": "1.4.2-pre.41", + "Version": "1.4.2-pre.42", "CodeURL": "https://github.com/khanlab/hippunfold", "Author": "Jordan DeKraker & Ali Khan", "AuthorEmail": "ali.khan@uwo.ca" diff --git a/pyproject.toml b/pyproject.toml index 55924bab..a4c5ae4c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "hippunfold" -version = "1.4.2-pre.41" +version = "1.4.2-pre.42" description = "BIDS App for Hippocampal AutoTop (automated hippocampal unfolding and subfield segmentation)" authors = ["Jordan DeKraker & Ali Khan "]