-
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
Add postprocessing functionality for the new contrast-agnostic spinal cord segmentation model #31
Comments
oopsi! we should use post-processing methods, such as 'keep largest object'. Is this something that is available (or can be easily implemented) @joshuacwnewton @naga-karthik ? |
@Kaonashi22 can you please send me Also, please always indicate the version of the script that you used in your issue (edit #31 (comment) to add this information). Also, please upload a log file, so I can verify which version of SCT was used. |
Yes and no. The quality of the segmentation impacts the quality of registration, and therefore the quality of metrics extraction.
It depends how heavily weighted towards the segmentation the registration is. We can decide to weight the registration mode towards the image (ie T1w), but then we risk that in subjects with image artifacts, the registration will be more wrong. So there is a delicate decision to be made, depending on the image quality. This is why it is important for me to have a representative sample of the images, so I can make an informed decision.
no-- the segmentation of the cord should be the segmentation of the cord (not a dilated version of it) |
By "keep largest object", do you mean
It looks like this option refers to functionality that is within As a quick alternative using existing SCT CLIs, could we do Or, alternatively, since the cord seems to be centered in the FOV (while the aorta is offset), we could even do |
Thanks @jcohenadad, I'll send you the images by mail. |
They are slight to moderate motion artifacts that can affect different images depending on the subjects. I can share the full dataset by Onedrive if needed. |
Thanks @joshuacwnewton. I've already corrected manually all masks. Will the cord segmentation using this new approach be reproducible with the previous one? |
yes!
oops! yes! good catch
hum... these are very ad hoc approaches-- before implementing this for Lydia's project we should see if this issue concerns 1%, 10% or 50% of the data-- |
@Kaonashi22 I ran the process on this subject and the labeling failed: If you have created derivatives for this subject, it is important that you also send me the derivatives so I can reproduce your processing. |
I forgot to send the manual labeling that I used (for all subjects since I couldn't run SPINEPS) |
@joshuacwnewton is this something you would like me to implement on the monai side? As I am working on the improvements to the model on a separate branch, I have it already implemented. I can submit a PR on the SCT repo to include this function preferably in this part of the code? Please let me know! If we go this route, please note that the post-processing might not be a global SCT function but a specific to the monai inference script. |
That would be lovely! Thank you for offering. ❤️
Since the postprocessing can be applied to any numpy array (as far as I can tell), I think the easiest thing to do would be to call this function inside the "segment_non_ivadomed" function here, similar to how we apply thresholding as post-processing. (That way, it can be used for both MONAI and nnUNet.) Also, since we would now have 2 postprocessing operations, we may also want to add an extra explanatory comment above the thresholding, saying something like: # Apply postprocessing (replicates existing functionality from ivadomed package) |
@Kaonashi22 I've renamed this issue because it was non-specific ("QC"). Once spinalcordtoolbox/spinalcordtoolbox#4481 is merged (@joshuacwnewton any ETA) I will re-run the processing and let you know if this is ready for you to use. |
I'll make sure it gets merged today. :) |
The PR has been merged. Now, the existing |
Fantastic! Thank you @joshuacwnewton. I'll explore these syntaxes and choose the appropriate one for this project |
@Kaonashi22 I am now working on the postprocessing methods to improve the automatic segmentation for your dataset. I notice this issue includes multiple issues (#31 (comment) and #31 (comment) are two very different issues), making it very difficult to follow and address specifically. One issue should ideally refer to one single issue. Can you please open another issue about #31 (comment), with link to data and the SCT version you used. Thanks. |
Sure, I'll open the issue tomorrow. "I have to retrieve the ID of the subject where I encountered this issue. |
For some subjects, the template to subject registration is not accurate on the last slices. I noticed the segmentation masks are not accurate at these levels, which may explain that. I attached an example of MT off image with the WM template warped and the original segmentation. I guess this will be fixed during the second run using the manual corrections.
For one subject, the T1 template doesn't align properly at the edges of the subject images (MT off, UNI). The segmentations masks are good.
sub-DEV169Sujet03_mt-off_MTS_crop_seg.nii.gz
sub-DEV169Sujet03_mt-off_MTS_crop.nii.gz
PAM50_t1.nii.gz
PAM50_wm.nii.gz
Two questions/comments:
-If I understood well, the segmentation masks are mainly used for the registration, not for the metrics extraction (done with the template objects warped onto the subject space). Is it correct?
-How accurate the segmentations should be? Should we increase the number of voxels to make the measurements more robust or be more conservative to avoid partial volume effect?
The text was updated successfully, but these errors were encountered: