-
Notifications
You must be signed in to change notification settings - Fork 0
Home
After running your analysis, check the Quality Control (QC) report by opening the file ./qc/index.html
. Use the "search" feature of the QC report to quickly jump to segmentations issues.
If segmentation issues are noticed while checking the quality report, proceed to manual correction using the procedure below:
- In the QC report, search for
deepseg
to only display results of spinal cord segmentation. - Review spinal cord segmentation.
- Click on the F key to indicate if the segmentation/label is OK ✅, needs manual correction ❌ or if the data is not usable
⚠️ (artifact). Two YML files, one for manual corrections and one for unusable data, will automatically be generated. - Download the YML by clicking on Download QC Fails and on Download Qc Artifacts.
The YML files will have the following format:
YML file for correcting cord segmentation:
FILES_SEG:
- sub-001_T1w.nii.gz
- sub-002_T2w.nii.gz
The workflow is the following:
- Loop across subjects,
- Load images listed in the YML file in FSLeyes/ITKsnap, and overlay the SC segmentation,
- Adjust the SC segmentation using editing tools. Toggle the lesion overlay on/off to help validate the accuracy of the label (cmd+F on a Mac or ctrl+F on a Linux/Windows),
- Save the mask
Note: The manual_correction.py
will automatically save manually-corrected segmentations under derivatives/labels/
folder at the root of OUTPUT_PATH
according to the BIDS convention.
Example command:
python manual_correction.py -path-in <INPUT_PATH>/data_processed -config <CONFIG_FILE> -path-out <OUTPUT_PATH> -viewer fsleyes
After all corrections are done, you can generate a QC report by adding the flag -qc-only-
to the command above. Note that SCT is required for generating QC report.
Here is a video for correcting manual segmentation: Youtube manual
Lesions are segmented on the PSIR or STIR contrasts (when available). The workflow is the following:
- Loop across subjects,
- Load PSIR/STIR in FSLeyes, and overlay the lesion segmentation (if it already exists),
- Create/adjust the segmentation mask using editing tools. Toggle the lesion overlay on/off to help validate the accuracy of the label (cmd+F on a Mac or ctrl+F on a Linux/Windows),
- Save the mask in FSLeyes
Example command:
python manual_correction.py -path-in <INPUT_PATH> -config <CONFIG_FILE> -path-out <OUTPUT_PATH> -viewer fsleyes
-
INPUT_PATH
: BIDS dataset from which manual lesions will be identified -
CONFIG_FILE
: YML file that lists all subjects to be included in the manual lesion segmentation. This file can either be generated by SCT's QC report or created manually. See the example of a YML file below -
OUTPUT_PATH
: Optional. If not specified, output segmentations will be generated in theINPUT_PATH
FILES_LESION:
- sub-edm005_ses-M0_PSIR.nii.gz
- sub-edm008_ses-M0_PSIR.nii.gz
- sub-edm010_ses-M0_PSIR.nii.gz
Lesions are segmented on one contrast (e.g., T2w), while the second contrast (such as PSIR or STIR) is also opened in FSLeyes. The workflow is the following:
- Loop across subjects,
- Denoise T2w image
- In FSLeyes, load the denoised T2w image first, then load PSIR/STIR in FSLeyes
- Overlay the lesion segmentation (if it already exists),
- Create/adjust the segmentation mask using editing tools. Toggle the contrasts and lesion overlays on/off to help validate the accuracy of the label (cmd+F on a Mac or ctrl+F on a Linux/Windows),
- Save the mask in FSLeyes
- Remove the denoised T2w image
Example command:
python manual_correction.py -path-in <INPUT_PATH> -config <CONFIG_FILE> -path-out <OUTPUT_PATH> -viewer fsleyes -load-other-contrast PSIR -denoise
-
INPUT_PATH
: BIDS dataset from which manual lesions will be identified -
CONFIG_FILE
: YML file that lists all subjects to be included in the manual lesion segmentation. This file can either be generated by SCT's QC report or created manually. See the example of a YML file below -
OUTPUT_PATH
: Optional. If not specified, output segmentations will be generated in theINPUT_PATH
-
-load-other-contrast PSIR
is used to load an additional contrast; in this case, the PSIR image -
-denoise
is used to denoise the images specified inCONFIG_FILE
; ; in this case, the T2w image
FILES_LESION:
- sub-edm005_ses-M0_T2w.nii.gz
- sub-edm008_ses-M0_T2w.nii.gz
- sub-edm010_ses-M0_T2w.nii.gz
After you finish manual corrections, upload the manually-corrected segmentations to git-annex (see internal documentation).
You can use the copy_files_to_derivatives.py
script provided within this repository to copy manually corrected labels (segmentations, disc labels, etc.) from your local derivatives/labels folder to the already existing git-annex BIDS dataset's derivatives/labels folder.