We have a new “experimental AI” option in Lung CT Segmenter for creating lung and lobe segmentations with minimal effort (one tracheal markup) on the fly.
This feature involves Johannes Hofmanningers lungmask with permission.
A short YouTube demo is here:
In this setting, an Nvidia GPU (1060 +), 6 GB GPU memory and “CUDA enabled” are strongly recommended.
Real processing time on a desktop PC with RTX 3070Ti GPU (without the in-video speedup): 97.23 s.
Slicer extension: Lung CT Analyzer
Dataset: From MONAILabel Task06_lung with permission.
The only thing to note is the current necessity to define one tracheal markup in this code. If you want just lungs and lobes you could just freely define one, f.e. as in the test example, it is not really needed for AI.
Please install the “Pytorch Utils” extension and restart Slicer.
Then it should typically install torch when you run the lung segmenter extension, but you could also install it from Pytorch Utils directly:
Please be patient during installation, it will take several minutes with no reaction or progress bar.
Which version of 3D Slicer and Lung CT Segmenter are you using?
Also note that you may need 20-30GB of free disk space for installing pytorch. If you run out of disk space then you may need to completely remove all remnants of pytorch and then install it again. I’ve found that in this case it is easier to reinstall Slicer than trying to clean up things manually.
All dependencies (SegmentEditorExtraEffects, SurfaceWrapSolidify, and PyTorch) are now included in Lung CT Analyzer’s CMakeList.txt for user convenience.
A fresh 3D Slicer 5.0.3 install on a Windows 11 system occupies 850 MB which grows to 7.4 GB after AI lung segmentations (mainly from Pytorch).
I am using Macbook Pro, macOS Big Sur, 2.8GHz Dual-Core Intel Core i7, Memory 8 GB. 3D Slicer version 5.03.
I have installed PyTorch as I mentioned and the AI still not working. Thank you for your help Rudolf.
Unfortunately, I have no experience with using PyTorch in MacOS.
Have you been pressing this button in the PyTorch Utils extension?
If yes and you still got the error message you may want to refer to this page on how to install PyTorch from Slicer´s Python Interactor. See “Installing on MacOS” section.
I am using the Lung CT analyser for a research project involving analysis of chest CTs of severe COVID patients. I would like to be able to automatically segment the lung regions using the lungmask AI feature/dataset, however I consistently get the following error each time I try it;
Identified the error. The lungmask developers have introduced a different infer mode in their new program version 0.2.14. LungCTAnalyzer has been adopted (2.67) and has just been pushed to the project GitHub, so it will be available for updates tomorrow via the extension manager and no longer display the error message.
Thanks very much for looking into this. I can confirm the lungmask AI model is working well within 3D slicer now and producing very nice segmentations.
I recently updated slicer and had to re-install the Lung CT Segmenter. I am now getting an error stating the module ‘torch’ has no attribute ‘inference_mode’ (see below). I tried to uninstall and re-install the module as well as pytorch.
sorry for the late response.
I can not reproduce the problem after the last 3 installations that I have done.
What do you see in the Python console when you experience this error?