Hello SCT team,
I was wondering if there is a tool for the automatic segmentation of the proximal spinal nerve roots. Iβm mainly interested in proximal lumbosacral nerves.
Many thanks in advance for your help
Mohamed
Hi @mtach,
Thank you for reaching out. No there is no tool (yet) for automatic segmentation of spinal nerve rootlets. However, this is highly desirable feature, so if you are interested in developing it, we would love to help you having that feature integrated into SCT
Cheers,
Julien
Hi @mtach,
Iβm just providing a quick update to let you know that SCT v6.2 has been released. This version of SCT provides a new segmentation model for automatic segmentation of spinal nerve rootlets.
You can use this feature by running sct_deepseg -i image.nii.gz -task seg_spinal_rootlets_t2w
. Please let us know if you have any further questions or concerns.
Kind regards,
Joshua
Hi @joshuacwnewton
Thank you very much for letting me know.
Iβm keen to run it and let you know how it goes.
Best regards
Mohamed
Hi @joshuacwnewton ,
This does work nicely for the dorsal roots but is there also a way to mask both dorsal and ventral roots?
Edit: and if possible segment the roots even further away from the spinal cord
Thanks in advance!
Hi @b.kalkhoven!
Thanks for testing the dorsal rootlets model and for your positive feedback!
The model segmenting both ventral and dorsal rootlets is still under development. We currently have a beta version of this model available. You can follow the instructions in this README to get the model! We will be glad for your feedback! The model currently segments rootlets within the spinal canal.
If you find the model useful and will use it in your research, please cite our recent preprint.
Cheers,
Jan
I tried running the model but I get the following error, could you help me identify the issue?
Predicting :
perform_everything_on_gpu: False
100%|βββββββββββββββββββββββββββββββββββββββββββββ| 8/8 [10:09<00:00, 76.14s/it]
Prediction done, transferring to CPU if needed
sending off prediction to background worker for resampling and export
done with
[W ParallelNative.cpp:230] Warning: Cannot set number of intraop threads after parallel work has started or after set_num_threads call when using native parallel backend (function set_num_threads)
Inference done.
Total inference time: 10 minute(s) 27 seconds
Traceback (most recent call last):
File β/Users/bkalkhov/Tractography/Spinal_cord/Spinal_cord_testing/Rootlets/model-spinal-rootlets/packaging_ventral_rootlets/run_inference_single_subject.pyβ, line 224, in
main()
File β/Users/bkalkhov/Tractography/Spinal_cord/Spinal_cord_testing/Rootlets/model-spinal-rootlets/packaging_ventral_rootlets/run_inference_single_subject.pyβ, line 198, in main
pred_file = glob.glob(os.path.join(tmpdir_nnunet, β*.nii.gzβ))[0]
IndexError: list index out of range
The T2 image is copied to the temporary folder, which also contains the folder βnnUNet_predictionβ but there is no other .nii.gz file that contains the prediction which causes the errorβ¦ But the loading bar and total inference time feedback imply that it encountered no errors during the processβ¦
Thanks for testing the model, @b.kalkhoven!
I tried the model on a sample image on my end, and it worked without errors.
Would you mind sharing the image with me? The debugging will be easier. You can upload the image to some cloud service and send me a link to jan.valosek@polymtl.ca. Thanks!
Thanks for sharing the image @b.kalkhoven!
I was able to reproduce the error. I will dig deeper into it today/tomorrow and let you know.
Hi @b.kalkhoven!
I believe I fixed the issue (details here).
Can you please run the following commands to download the fixed code and run the model again?
cd <YOUR_PATH>/model-spinal-rootlets
git pull
Thank you!
Hi @valosekj ,
It works without errors now! But the results still only contain dorsal rootlets. Is that possibly a contrast problem in my image?
Cheers
Hi @b.kalkhoven!
I have just run the model-spinal-rootlets_ventral_D106_r20240523
model on your t2.nii
image, and I can see that the model segments both ventral and dorsal rootlets:
Did you follow the instructions in this README? Note that you need to download the ventral model model-spinal-rootlets_ventral_D106_r20240523.zip
, as described in Step 3. Then, you need to provide the path to this model to the run_inference_single_subject.py
script:
python packaging_ventral_rootlets/run_inference_single_subject.py -i t2.nii -o t2_rootlets.nii ~/Downloads/model-spinal-rootlets_ventral_D106_r20240523 -fold all
@joshuacwnewton . Can I use this model to segment nerve roots for whole spine ? Based on readme, it seems it works only for cervical area. Thoughts ?
Hi @ranabhat!
Correct, the current models work for cervical rootlets only. However, we are also developing a model for lumbar rootlets! If you have already segmented some lumbar images manually, I would be happy to include them in our training set to make our current model more robust.
Cheers,
Jan
@valosekj : Sorry we have created any ground-truth segmentation for lumbar spine yet. Itβs a huge manual work . In addition, we donβt have enough CT and MR images of lumbar spine to create those. Not sure do you have these data which I can use to generate segmentations? We are planning to do this work by the end of summer. Thanks !!!
Thanks for the details, @ranabhat! When we have the first version of the lumbar model ready (hopefully by the end of summer), Iβll share it with you so you can try it out on your data!