HD_BET does not work in latest Slicer Preview Release

While the code below works without any errors in the stable version, it gives an error in the preview version.

import HDBrainExtractionTool             
        
HDBetLogic = HDBrainExtractionTool.HDBrainExtractionToolLogic()                            
        
brainNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLScalarVolumeNode')        
brainSegNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLSegmentationNode')
HDBetLogic.process(masterVolumeNode,brainNode ,brainSegNode ,0)
slicer.util.setSliceViewerLayers(background=brainNode)

image

  File "C:/ProgramData/slicer.org/Slicer5.3.0/slicer.org/Extensions-31866/HDBrainExtraction/lib/Slicer-5.3/qt-scripted-modules/HDBrainExtractionTool.py", line 346, in process
    from HD_BET.run import run_hd_bet
ModuleNotFoundError: No module named 'HD_BET'

Please post the exact error.

Also, it could help to post a fully reproducible example that someone can easily paste into the python console to reproduce what you are seeing. E.g. us the sample data methods to load data, etc.

1 Like

@Muhammed_Fatih_Talu You need to install prerequisite packages (pytorch and hd_bet). You can do that by running the module once using the GUI. If you install and run the module from script, make sure you call HDBetLogic.setupPythonRequirements() before HDBetLogic.process(...).

Hi,
I am running into similar issue:

Traceback (most recent call last):
File “/Applications/Slicer.app/Contents/bin/Python/slicer/util.py”, line 3255, in tryWithErrorDisplay
yield
File “/Applications/Slicer.app/Contents/Extensions-32448/HDBrainExtraction/lib/Slicer-5.6/qt-scripted-modules/HDBrainExtractionTool.py”, line 237, in onApplyButton
self.logic.process(self.ui.inputVolumeSelector.currentNode(), self.ui.outputVolumeSelector.currentNode(),
File “/Applications/Slicer.app/Contents/Extensions-32448/HDBrainExtraction/lib/Slicer-5.6/qt-scripted-modules/HDBrainExtractionTool.py”, line 346, in process
from HD_BET.run import run_hd_bet
ModuleNotFoundError: No module named ‘HD_BET.run’

Now, PyTorch is installed, but how do I do add the suggested hd_bet package?

Help is appreciated…

The Slicer HDBrainExtension currently specifies to use the latest code of the HD_BET Python package, but the developer has refactored the code resulting in API compatibility issues. I have written up the following GitHub issue to track the work associated with updating the Slicer extension to use an older version of HD_BET that would be compatible.

cc: @lassoan

1 Like