-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error raised by sct_qc
when dealing with empty masks
#60
Comments
Agree. I would add a simple condition checking if the label file is empty (for example, in the case of an MS patient with no visible lesion). If so, I would skip the QC. UPDATE: implemented in #61 |
The error raised by $ sct_qc -i sub-zh01_ses-01_acq-sag_T1w.nii.gz -s sub-zh01_ses-01_acq-sag_T1w_label-disc.nii.gz -p sct_label_utils -qc qc
--
Spinal Cord Toolbox (git-master-8b8f9bd98a0565d670faa515a6b24ecbc5a7d3a3)
sct_qc -i sub-zh01_ses-01_acq-sag_T1w.nii.gz -s sub-zh01_ses-01_acq-sag_T1w_label-disc.nii.gz -p sct_label_utils -qc qc
--
*** Generate Quality Control (QC) html report ***
Resample images to NonexNone mm
QcImage: layout with Sagittal slice
Traceback (most recent call last):
File "/Users/valosek/code/sct_latest/spinalcordtoolbox/scripts/sct_qc.py", line 105, in <module>
main(sys.argv[1:])
File "/Users/valosek/code/sct_latest/spinalcordtoolbox/scripts/sct_qc.py", line 90, in main
generate_qc(fname_in1=arguments.i,
File "/Users/valosek/code/sct_latest/spinalcordtoolbox/reports/qc.py", line 713, in generate_qc
QcImage(
File "/Users/valosek/code/sct_latest/spinalcordtoolbox/reports/qc.py", line 239, in layout
img, *mask = qcslice_layout(qcslice)
File "/Users/valosek/code/sct_latest/spinalcordtoolbox/reports/qc.py", line 665, in qcslice_layout
def qcslice_layout(x): return x.single()
File "/Users/valosek/code/sct_latest/spinalcordtoolbox/reports/slice.py", line 252, in single
index = self.get_center_spit()
File "/Users/valosek/code/sct_latest/spinalcordtoolbox/reports/slice.py", line 433, in get_center_spit
raise ValueError("Label/segmentation image is empty. Can't retrieve RL slice indices.")
ValueError: Label/segmentation image is empty. Can't retrieve RL slice indices. Note that the error is raised due to the For the $ sct_qc -i sub-zh01_ses-01_acq-sag_T1w.nii.gz -s sub-zh01_ses-01_acq-sag_T1w_seg.nii.gz -d sub-zh01_ses-01_acq-sag_T1w_lesion.nii.gz -p sct_deepseg_lesion -plane axial -qc qc
--
Spinal Cord Toolbox (git-master-8b8f9bd98a0565d670faa515a6b24ecbc5a7d3a3)
sct_qc -i sub-zh01_ses-01_acq-sag_T1w.nii.gz -s sub-zh01_ses-01_acq-sag_T1w_seg.nii.gz -d sub-zh01_ses-01_acq-sag_T1w_lesion.nii.gz -p sct_deepseg_lesion -plane axial -qc qc
--
*** Generate Quality Control (QC) html report ***
Resample images to 0.6x0.6 mm
QcImage: layout with Axial slice
Compute center of mass at each slice
/Users/valosek/code/sct_latest/python/envs/venv_sct/lib/python3.8/site-packages/scipy/ndimage/_measurements.py:1534: RuntimeWarning: invalid value encountered in double_scalars
results = [sum(input * grids[dir].astype(float), labels, index) / normalizer
qc/sub-zh01/ses-01/anat/sct_deepseg_lesion/2023_08_22_155410.797321/background_img.png
Successfully generated the QC results in qc/_json/qc_2023_08_22_155410.797321.json
To see the results in a browser, type:
open qc/index.html |
Okay, an empty label file is not supported by the following
Implemented in b481504 |
Description
An error is raised by sct_qc when new created labels are empty. This behaviour is actually interesting in some cases:
However, keeping empty masks can be relevant for some specific tasks such as lesions segmentations.
Question
Should we create a check after the creation of the label to avoid this problem ?
The text was updated successfully, but these errors were encountered: