Skip to content

Conversation

@valosekj
Copy link
Member

@valosekj valosekj commented Dec 10, 2024

Description

As SCT v6.4+ produces JSON sidecars for some outputs that track the provenance of the function, models, etc. (details: spinalcordtoolbox/spinalcordtoolbox#4466), we want to include this information in the final JSON sidecar produced by manual_correction.py. This PR implements this feature.

How to test this PR

cd ~/code/manual-correction
git fetch
git checkout jv/103_include_json_created_by_sct
sct_download_data -d sct_course_data -o sct_course_data_2024
cd sct_course_data_2024/multi_subject
chmod +x process_data.sh
sct_run_batch -script process_data.sh -config config.yml -jobs 3
# Note: you can add `exit` to line 115 to run only the contrast-agnostic model on T2w to save time

$SCT_DIR/python/envs/venv_sct/bin/python ~/code/manual-correction/manual_correction.py -config qc_fail.yml -path-img output/data_processed/ -path-label output/data_processed -path-out data/derivatives/labels

cat data/derivatives/labels/sub-05/anat/sub-05_T2w_seg.json
{
    "SpatialReference": "orig",
    "GeneratedBy": [
        {
            "GeneratedBy": [
                {
                    "Name": "spinalcordtoolbox: sct_deepseg -task seg_sc_contrast_agnostic -i sub-05_T2w.nii.gz -qc qc -qc-subject sub-05",
                    "Version": "git-master-64f55fdf022659db5d5c779f01c605d91ca7d052",
                    "CodeURL": "https://github.com/spinalcordtoolbox/spinalcordtoolbox/blob/64f55fdf022659db5d5c779f01c605d91ca7d052/spinalcordtoolbox/scripts/sct_deepseg.py",
                    "ModelURL": "https://github.com/sct-pipeline/contrast-agnostic-softseg-spinalcord/releases/download/v2.5/model_contrast-agnostic_20240930-1002.zip"
                }
            ]
        },
        {
            "Name": "Manual",
            "Author": "Jan Valosek",
            "Date": "2024-12-10 18:05:31"
        }
    ]
}

As you can see above, the output JSON sidecar under derivatives now includes information about the SCT model and the manual rater who made manual corrections.


Resolves: #103
Relevant to: #102

To make it more general
Context: SCT v6.4+ produces JSON sidecars for some outputs that track the provenance of the function, models, etc.
Details: spinalcordtoolbox/spinalcordtoolbox#4466
We want to include this information in the final JSON sidecar
Copy link
Member

@sandrinebedard sandrinebedard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it and works well! Thanks @valosekj !

@valosekj valosekj merged commit 24ac6ca into main Dec 11, 2024
1 check passed
@valosekj valosekj deleted the jv/103_include_json_created_by_sct branch December 11, 2024 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Include the JSON sidecar created by SCT

2 participants