spinalcordtoolbox icon indicating copy to clipboard operation
spinalcordtoolbox copied to clipboard

Expand centerline QC report to add sagittal/coronal views

Open jcohenadad opened this issue 2 years ago • 6 comments

When validating output centerlines, it would be convenient to have a QC. One possibility is to use multiple axial views, as done for the SC segmentation QC. However, given that we are not after accuracy here, there might be a more rapid way to QC centerlines: by looking at the sagittal and coronal views. However, if only showing the medial sagittal plane, we might 'miss' the spinal cord. hence, an idea would be to average the 1/3 central chunk of the FOV and display that for the sagittal view. And for the coronal, average the entirety of the A-P axis. See related discussion: https://github.com/neuropoly/idea-projects/issues/15#issuecomment-1400709359

Also, to make sure the centerline is visible, we would need to do a 'repmat' (ie: find the 'one' along the array, and replace all zeroes by one) along the RL and AP axes, respectively for the sagittal and coronal views.

Related to https://github.com/neuropoly/idea-projects/issues/15#issuecomment-1402319717

jcohenadad avatar Jan 24 '23 18:01 jcohenadad

When validating output centerlines, it would be convenient to have a QC. One possibility is to use multiple axial views, as done for the SC segmentation QC.

I might be missing something here, but don't we have an axial slicewise QC report for sct_get_centerline already?

Screenshot (sct_example_data/t2/t2.nii.gz)

image

https://github.com/spinalcordtoolbox/spinalcordtoolbox/blob/2d09af3ee707ca166c3d1611295a7575ffdd4cd0/spinalcordtoolbox/scripts/sct_get_centerline.py#L110-L115

It's present in sct_qc as well:

https://github.com/spinalcordtoolbox/spinalcordtoolbox/blob/2d09af3ee707ca166c3d1611295a7575ffdd4cd0/spinalcordtoolbox/scripts/sct_qc.py#L29-L34

So, is the idea here to augment the existing axial QC with saggital and/or medial views?

joshuacwnewton avatar Jan 24 '23 18:01 joshuacwnewton

Potentially related issue:

  • https://github.com/spinalcordtoolbox/spinalcordtoolbox/issues/3625

joshuacwnewton avatar Jan 24 '23 18:01 joshuacwnewton

I might be missing something here, but don't we have an axial slicewise QC report for sct_get_centerline already?

oh! I was the one missing something 😅 I completely forgot we already had this QC. That being said, it would be convenient to have the sag/coronal view (esp. for images with thick sagittal slices), if not toooo complicated to implement.

jcohenadad avatar Jan 24 '23 18:01 jcohenadad

See related discussion: neuropoly/idea-projects#15 (comment)

Just for the full context. Here is how the images in neuropoly/idea-projects#15 (comment) were obtained:

# Sagittal image
# Crop around the middle of the FOV. Here we specified the slice range manually, but it could probably be obtained automatically as well.
sct_crop_image -i sub-cal056_ses-M0_T2w.nii.gz -xmin 20 -xmax 35 -o sub-cal056_ses-M0_T2w_crop.nii.gz
# Do average
sct_maths -i sub-cal056_ses-M0_T2w_crop.nii.gz -mean x -o sub-cal056_ses-M0_T2w_crop_mean.nii.gz

# Do the same for the centerline
sct_crop_image -i sub-cal056_ses-M0_T2w_seg_centerline.nii.gz -xmin 20 -xmax 35 -o sub-cal056_ses-M0_T2w_seg_centerline_crop.nii.gz
# Do average
sct_maths -i sub-cal056_ses-M0_T2w_seg_centerline_crop.nii.gz  -mean x -o sub-cal056_ses-M0_T2w_seg_centerline_crop_mean.nii.gz

# Coronal image
# For coronal image, we did only averaging (because it is not easy to specify the slices for cropping)
sct_maths -i sub-cal056_ses-M0_T2w.nii.gz -mean y -o sub-cal056_ses-M0_T2w_mean_y.nii.gz
sct_maths -i sub-cal056_ses-M0_T2w_seg_centerline.nii.gz -mean y -o sub-cal056_ses-M0_T2w_seg_centerline_mean_y.nii.gz

valosekj avatar Jan 24 '23 20:01 valosekj

I have just found out that we can already get sagittal centerline QC using this small hack (passing -p sct_label_vertebrae instead of -p sct_get_centerline):

sct_qc -i sub-cal056_ses-M0_T2w.nii.gz -s sub-cal056_ses-M0_T2w_seg_centerline.nii.gz -p sct_label_vertebrae -qc qc -qc-subject sub-cal056
image

For the sake of clarity, -p sct_get_centerline provides axial QC:

sct_qc -i sub-cal056_ses-M0_T2w.nii.gz -s sub-cal056_ses-M0_T2w_seg_centerline.nii.gz -p sct_get_centerline -qc qc -qc-subject sub-cal056
image

valosekj avatar Jan 25 '23 15:01 valosekj

Just for the record, sct_qc -p sct_label_vertebrae also works well for getting a rough idea of SC seg in the sagittal plane:

Kapture 2023-05-24 at 14 19 27

Command:

sct_qc -i sub-zh01/ses-01/anat/sub-zh01_ses-01_acq-sag_T2w.nii.gz -s derivatives/labels/sub-zh01/ses-01/anat/sub-zh01_ses-01_acq-sag_T2w_seg-manual.nii.gz -p sct_label_vertebrae -qc qc -qc-subject sub-zh01

valosekj avatar May 24 '23 18:05 valosekj