spinalcordtoolbox icon indicating copy to clipboard operation
spinalcordtoolbox copied to clipboard

Add QC reporting to `sct_deepseg_lesion`

Open joshuacwnewton opened this issue 3 years ago • 5 comments

Additional context given by @jcohenadad:

note that this particular QC is quite tricky (although not impossible)-- because lesion seg could happen on sag or ax images, and the QC only shows one orientation (so far)-- so which one to choose is a question-- also, we'll need to input the cord seg in the QC in order to crop around the cord (we already do that for the cord seg qc), but then display the lesion seg

Specifically, I believe this is referring to the fact that sct_deepseg_lesion can be run on images of multiple orientations:

https://github.com/spinalcordtoolbox/spinalcordtoolbox/blob/2e5a817d831f9d8a439b52fca630df29cbf34e69/spinalcordtoolbox/scripts/sct_deepseg_lesion.py#L37-L45

joshuacwnewton avatar Jun 01 '22 14:06 joshuacwnewton

so which one to choose is a question

Is it possible that we could infer the image orientation from the choice of -c?


we'll need to input the cord seg in the QC in order to crop around the cord

Could we not re-use the results from -centerline/-file_centerline?

https://github.com/spinalcordtoolbox/spinalcordtoolbox/blob/2e5a817d831f9d8a439b52fca630df29cbf34e69/spinalcordtoolbox/scripts/sct_deepseg_lesion.py#L148

Since the segmentation returns im_ctr, we should in theory already have the region of the spinal cord identified, I would think?


I guess the tricky thing here is that, while this might work for sct_deepseg_lesion -qc, our separate sct_qc script won't necessarily have this same context when called in isolation. :thinking:

joshuacwnewton avatar Jun 01 '22 15:06 joshuacwnewton

Specifically, I believe this is referring to the fact that sct_deepseg_lesion can be run on images of multiple orientations:

to clarify, -c specifically refers to the contrast, and sometimes the contrast correlates with the orientation, but this is not a general rule that should be used. Eg: Some users are dealing with axial T1w and axial T2w images (or sag T1w and sag T2w).

My point here, was that we would ideally show the view that has the best in-plane resolution (we can find that with the data shape)

jcohenadad avatar Jun 01 '22 15:06 jcohenadad

to clarify, -c specifically refers to the contrast, and sometimes the contrast correlates with the orientation, but this is not a general rule that should be used. Eg: Some users are dealing with axial T1w and axial T2w images (or sag T1w and sag T2w).

I might be misunderstanding here, but I thought that for sct_deepseg_lesion specifically, we had used -c in a different way than usual. (Since we have both t2 and t2_ax options, which are used to pick a specific lesion-segmentation model.)

https://github.com/spinalcordtoolbox/spinalcordtoolbox/blob/2e5a817d831f9d8a439b52fca630df29cbf34e69/spinalcordtoolbox/scripts/sct_deepseg_lesion.py#L41-L43

https://github.com/spinalcordtoolbox/spinalcordtoolbox/blob/2e5a817d831f9d8a439b52fca630df29cbf34e69/spinalcordtoolbox/deepseg_lesion/core.py#L195-L196

joshuacwnewton avatar Jun 01 '22 15:06 joshuacwnewton

I thought that for sct_deepseg_lesion specifically, we had used -c in a different way than usual. (Since we have both t2 and t2_ax options, which are used to pick a specific lesion-segmentation model.)

Yes, you are absolutely right, but I've always been uncomfortable with the 'misuse' of the -c flag. Moreover, we are putting high priority in creating updated (better) models for lesion segmentation. There are multiple active projects in this direction (eg: from Naga/Kiri and from Naga/Uzay), which would ultimately be implemented via sct_deepseg (so that's another thing to consider: futur deprecation of sct_deepseg_lesion)

jcohenadad avatar Jun 01 '22 15:06 jcohenadad

I've always been uncomfortable with the 'misuse' of the -c flag.

Very fair! It caught me off guard, too, when I first saw it.

Moreover, we are putting high priority in creating updated (better) models for lesion segmentation. There are multiple active projects in this direction (eg: from Naga/Kiri and from Naga/Uzay), which would ultimately be implemented via sct_deepseg.

Ahh, I see, I see. I had been thinking about the original context (i.e. QC for strictly sct_deepseg_lesion, possibly as a tool for Julian McGinnis to use, depending on their needs).

But, you have been thinking about QC for lesion segmentation in general, including for current/future projects. (In other words, the (much larger) project that is https://github.com/spinalcordtoolbox/spinalcordtoolbox/issues/3325, since sct_deepseg uses -c in the "standard" way.)

Thank you for clarifying!

joshuacwnewton avatar Jun 01 '22 15:06 joshuacwnewton

During the 2023-04-13 SCIseg meeting, we (Jan, Naga, Julien) concluded that it would be great to increase the priority of implementing the QC for lesions. The QC should be universal, working for SCI, MS, DCM lesions.

Suggestions

  • make this QC function wider than sct_deepseg_lesion because it will be useful for other manual or auto lesion seg methods (eg: MS, SCI, DCM, etc.)
  • what orientation to show?
    • the native orientation of the image
    • if sagittal: crop it around the cord (via the seg) to magnify the ROI. Show all slices from left to right (and display them next to each other). This would be a NEW feature.
    • if axial: show ALL slices as done for SC seg (feature already exists).
  • Input segmentation required?
    • yes: otherwise, some axial images would be HUGE (eg 512x512) and small lesions would not be easily viewable on the QC page.
    • There is the option to crop around the lesion, but if false neg, then nothing to crop (and lesion will be missed)

jcohenadad avatar Apr 13 '23 14:04 jcohenadad