A new AI-based tool - HDBrainExtracion extension - is added to 3D Slicer for skull stripping (blanking out region outside the brain in MRI images). The model is trained on a large set of images and proven to be more robust than many other similar tools.
This is a very instructive and well-written extension, thank you @lassoan. Do you have any information on how HD-BET trained their skull stripping model in detail? The cited paper remains a bit unclear here. It would be interesting to have similar tissue stripping AI-based modules for other organs.
I donât have any more information other than what they described in their paper. You may contact the authors at the email provided in the paper or by submitting an issue in their GitHub repository for more details.
Short feedback: Works great on a Windows 11 GTX 1060 laptop, but I needed to start Slicer in Admin mode to install the PyTorch extension upon the first run. Processing took about 5 min to complete (Device=auto), so it is probably not using the GPU yet.
Thanks for the feedback. What indicated that installing as admin user was necessary?
Iâve noticed that failed Pytorch installs may prevent proper installation. You may consider trying to reinstall Slicer from scratch (deleting the Slicer install folder completely) to see if it makes Slicerâs pytorch find the GPU.
Also make sure that in your NVIDIA settings Slicer is configured to use the GPU.
to the PyTorch utility module. Then the install runs normally, but unfortunately, it does not detect CUDA yet on my two systems. Using Slicer in Admin mode was mandatory, otherwise, the PyTorch Util was throwing exceptions.
If you encounter any issues then always try to update the extensions in the latest Slicer Stable Release, or install the latest Slicer Preview Release (extension updates are not available for preview releases).
I would expect that the module only works for images that contains many slices and cover the full brain, but you can try it on sĂngle-slice images, too.
If you find that it does not work then you can train a new network specifically for sĂngle-slice images. You should be able to automatically generate training data from full-brain data sets.
This is great⌠do you know if there is a way to hack the Pytorch installation to swap it to use the Metal-backend that is now available for M1/M2 processors?
Wet use light-the-torch to install pytorch. Check out its documentation for ARM architecture compatibility. Note that Slicer runs on ARM macs through Rosetta emulation, which might complicate things a bit further.
Hello Guys,
I installed CUDA, PyTorch and HDBrainExtraction. However when I try to run the extension I get an error message. I tried reinstalling several timers and also running slicer in admin mode.
I basically donât know what else to do. I installed everything today, so Iâm assuming I have the most recent versions of everything. It would be great if somebody could help me out.
The error message in full detail: Traceback (most recent call last):
File âC:\Users\Rickli\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\util.pyâ, line 2961, in tryWithErrorDisplay
yield
File âC:/Users/Rickli/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/HDBrainExtraction/lib/Slicer-5.2/qt-scripted-modules/HDBrainExtractionTool.pyâ, line 227, in onApplyButton
self.logic.setupPythonRequirements()
File âC:/Users/Rickli/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/HDBrainExtraction/lib/Slicer-5.2/qt-scripted-modules/HDBrainExtractionTool.pyâ, line 301, in setupPythonRequirements
slicer.util.pip_install(âgit+https://github.com/MIC-DKFZ/batchgenerators#egg=batchgeneratorsâ)
File âC:\Users\Rickli\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\util.pyâ, line 3571, in pip_install
_executePythonModule(âpipâ, args)
File âC:\Users\Rickli\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\util.pyâ, line 3533, in _executePythonModule
logProcessOutput(proc)
File âC:\Users\Rickli\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\util.pyâ, line 3502, in logProcessOutput
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
subprocess.CalledProcessError: Command â[âC:/Users/Rickli/AppData/Local/NA-MIC/Slicer 5.2.1/bin/âŚ/bin\PythonSlicer.EXEâ, â-mâ, âpipâ, âinstallâ, âgit+https://github.com/MIC-DKFZ/batchgenerators#egg=batchgeneratorsâ]â returned non-zero exit status 1.
Thank you for your help! I didnât have âgitâ installed. After installing and quickly restarting my PC it worked just fine. I think it also used the GPU to extract, as it was quite fast. The extraction turned out wonderful!