From 48f8f5db64d744952afce65d99e90da80283232e Mon Sep 17 00:00:00 2001 From: Jordan DeKraker Date: Thu, 12 Dec 2024 16:38:40 -0500 Subject: [PATCH] cropseg to manualseg --- .github/workflows/python-testing.yml | 8 ++++---- hippunfold/config/snakebids.yml | 6 +++--- hippunfold/workflow/Snakefile | 6 +++--- .../rules/{preproc_cropseg.smk => preproc_manualseg.smk} | 4 ++-- hippunfold/workflow/rules/qc.smk | 2 +- hippunfold/workflow/rules/shape_inject.smk | 4 ++-- .../dataset_description.json | 0 .../sub-001/anat/sub-001_hemi-L_dseg.nii.gz | 0 .../sub-001/anat/sub-001_hemi-R_dseg.nii.gz | 0 .../dataset_description.json | 0 .../sub-001/anat/sub-001_hemi-L_dseg.nii.gz | 0 11 files changed, 15 insertions(+), 15 deletions(-) rename hippunfold/workflow/rules/{preproc_cropseg.smk => preproc_manualseg.smk} (93%) rename test_data/{data_cropseg => bids_manualseg}/dataset_description.json (100%) rename test_data/{data_cropseg => bids_manualseg}/sub-001/anat/sub-001_hemi-L_dseg.nii.gz (100%) rename test_data/{data_cropseg => bids_manualseg}/sub-001/anat/sub-001_hemi-R_dseg.nii.gz (100%) rename test_data/{data_cropseg_1hemi => bids_manualseg_1hemi}/dataset_description.json (100%) rename test_data/{data_cropseg_1hemi => bids_manualseg_1hemi}/sub-001/anat/sub-001_hemi-L_dseg.nii.gz (100%) diff --git a/.github/workflows/python-testing.yml b/.github/workflows/python-testing.yml index 9a16ac45..3292aa71 100644 --- a/.github/workflows/python-testing.yml +++ b/.github/workflows/python-testing.yml @@ -94,13 +94,13 @@ jobs: run: | poetry run hippunfold test_data/bids_singleT2w_longitudinal test_out participant -np --modality T2w - - name: Test cropseg bids, with path override + - name: Test manualseg bids, with path override run: | - poetry run hippunfold test_data/data_cropseg test_out participant -np --modality cropseg --path_cropseg test_data/data_cropseg/sub-{subject}_hemi-{hemi}_dseg.nii.gz + poetry run hippunfold test_data/bids_manualseg test_out participant -np --modality manualseg --path_manualseg test_data/bids_manualseg/sub-{subject}_hemi-{hemi}_dseg.nii.gz - - name: Test cropseg bids, one hemisphere hemi + - name: Test manualseg bids, one hemisphere hemi run: | - poetry run hippunfold test_data/data_cropseg_1hemi test_out participant -np --modality cropseg --hemi L + poetry run hippunfold test_data/bids_manualseg_1hemi test_out participant -np --modality manualseg --hemi L - name: Test T2w with T1w template registration run: | diff --git a/hippunfold/config/snakebids.yml b/hippunfold/config/snakebids.yml index b94db2f6..96e08641 100644 --- a/hippunfold/config/snakebids.yml +++ b/hippunfold/config/snakebids.yml @@ -67,7 +67,7 @@ pybids_inputs: - acquisition - run - cropseg: + manualseg: filters: suffix: 'dseg' extension: '.nii.gz' @@ -88,13 +88,13 @@ pybids_inputs: parse_args: --modality: - help: 'Type of image to run hippunfold on. For manual segmentations, use cropseg and be sure to match the label scheme applied in the look up table (lut) online. For best performance, please also make sure the input is approximately aligned to the template space, with hemi-L|R in the name. (default: %(default)s)' + help: 'Type of image to run hippunfold on. For manualseg and be sure to match the label scheme applied in the look up table (lut) online. For best performance, please also make sure the input is approximately aligned to the template space, with separate hemi-L|R in the name(s). (default: %(default)s)' required: True choices: - T1w - T2w - hippb500 - - cropseg + - manualseg --template: diff --git a/hippunfold/workflow/Snakefile b/hippunfold/workflow/Snakefile index 07bffaf8..2b54c9dd 100644 --- a/hippunfold/workflow/Snakefile +++ b/hippunfold/workflow/Snakefile @@ -35,7 +35,7 @@ if ( limit_to_list.add("T2w") if ( config["modality"] == "hippb500" - or config["modality"] == "cropseg" + or config["modality"] == "manualseg" or "corobl" in config["output_spaces"] ): ref_spaces.append("corobl") @@ -111,9 +111,9 @@ if "T1w" in limit_to_list: # include rules only as they are needed.. -if config["modality"] == "cropseg": +if config["modality"] == "manualseg": - include: "rules/preproc_cropseg.smk" + include: "rules/preproc_manualseg.smk" else: diff --git a/hippunfold/workflow/rules/preproc_cropseg.smk b/hippunfold/workflow/rules/preproc_manualseg.smk similarity index 93% rename from hippunfold/workflow/rules/preproc_cropseg.smk rename to hippunfold/workflow/rules/preproc_manualseg.smk index 11ba4b73..23996799 100644 --- a/hippunfold/workflow/rules/preproc_cropseg.smk +++ b/hippunfold/workflow/rules/preproc_manualseg.smk @@ -1,7 +1,7 @@ -rule import_cropseg_to_corobl: +rule import_manualseg_to_corobl: input: - in_img=partial(get_single_bids_input, component="cropseg"), + in_img=partial(get_single_bids_input, component="manualseg"), template_dir=Path(download_dir) / "template" / config["template"], params: std_to_cor=lambda wildcards: config["template_files"][config["template"]][ diff --git a/hippunfold/workflow/rules/qc.smk b/hippunfold/workflow/rules/qc.smk index 6dbeb1ae..c92bb316 100644 --- a/hippunfold/workflow/rules/qc.smk +++ b/hippunfold/workflow/rules/qc.smk @@ -120,7 +120,7 @@ def get_bg_img_for_subfield_qc(wildcards): hemi="{hemi}", **inputs.subj_wildcards, ) - elif config["modality"] == "cropseg": + elif config["modality"] == "manualseg": # blank image as bg return bids( root=work, diff --git a/hippunfold/workflow/rules/shape_inject.smk b/hippunfold/workflow/rules/shape_inject.smk index 743dd25b..922493ad 100644 --- a/hippunfold/workflow/rules/shape_inject.smk +++ b/hippunfold/workflow/rules/shape_inject.smk @@ -32,7 +32,7 @@ def flipped(wildcards): def get_input_for_shape_inject(wildcards): - if config["modality"] == "cropseg": + if config["modality"] == "manualseg": seg = bids( root=work, datatype="anat", @@ -55,7 +55,7 @@ def get_input_for_shape_inject(wildcards): def get_input_splitseg_for_shape_inject(wildcards): - if config["modality"] == "cropseg": + if config["modality"] == "manualseg": seg = bids( root=work, datatype="anat", diff --git a/test_data/data_cropseg/dataset_description.json b/test_data/bids_manualseg/dataset_description.json similarity index 100% rename from test_data/data_cropseg/dataset_description.json rename to test_data/bids_manualseg/dataset_description.json diff --git a/test_data/data_cropseg/sub-001/anat/sub-001_hemi-L_dseg.nii.gz b/test_data/bids_manualseg/sub-001/anat/sub-001_hemi-L_dseg.nii.gz similarity index 100% rename from test_data/data_cropseg/sub-001/anat/sub-001_hemi-L_dseg.nii.gz rename to test_data/bids_manualseg/sub-001/anat/sub-001_hemi-L_dseg.nii.gz diff --git a/test_data/data_cropseg/sub-001/anat/sub-001_hemi-R_dseg.nii.gz b/test_data/bids_manualseg/sub-001/anat/sub-001_hemi-R_dseg.nii.gz similarity index 100% rename from test_data/data_cropseg/sub-001/anat/sub-001_hemi-R_dseg.nii.gz rename to test_data/bids_manualseg/sub-001/anat/sub-001_hemi-R_dseg.nii.gz diff --git a/test_data/data_cropseg_1hemi/dataset_description.json b/test_data/bids_manualseg_1hemi/dataset_description.json similarity index 100% rename from test_data/data_cropseg_1hemi/dataset_description.json rename to test_data/bids_manualseg_1hemi/dataset_description.json diff --git a/test_data/data_cropseg_1hemi/sub-001/anat/sub-001_hemi-L_dseg.nii.gz b/test_data/bids_manualseg_1hemi/sub-001/anat/sub-001_hemi-L_dseg.nii.gz similarity index 100% rename from test_data/data_cropseg_1hemi/sub-001/anat/sub-001_hemi-L_dseg.nii.gz rename to test_data/bids_manualseg_1hemi/sub-001/anat/sub-001_hemi-L_dseg.nii.gz