I’m trying to plan a case of mandibular reconstruction using BoneReconstructionPlanner, but i’m stuck at one step, “create bone models from segmentations” doesn’t do anything and returns empty bone models, hence i’m not able to perform any steps beyond this point.(like centering fibula line, automatic mandibular cutting plane positioning, fibula surgical guide generation etc.)
Please guide me and help me in resolving this issue
Hi. I just installed BoneReconstructionPlanner and executed its automatic tests and they worked successfully on both the stable and preview release of Slicer.
It should look like this video:
Although it may take around 10 minutes for you because Slicer will be downloading the test data (around 500MB) for the first time (after that it is cached).
To be able to execute the tests you need to enable developer mode on Slicer:
Then restart Slicer. After that you should be able to execute the BoneReconstructionPlanner automatic tests. You should see the same GUI that appears on the video.
thanks for the prompt response
i’m getting error on running the test, here are the details
Traceback (most recent call last):
File “C:\Users\Admin\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\util.py”, line 2961, in tryWithErrorDisplay
yield
File “C:\Users\Admin\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\ScriptedLoadableModule.py”, line 224, in onReloadAndTest
test(msec=int(slicer.app.userSettings().value(“Developer/SelfTestDisplayMessageDelay”)), **kwargs)
File “C:\Users\Admin\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\ScriptedLoadableModule.py”, line 86, in runTest
testCase.runTest(**kwargs)
File “C:/Users/Admin/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/BoneReconstructionPlanner/lib/Slicer-5.2/qt-scripted-modules/BoneReconstructionPlanner.py”, line 3656, in runTest
self.section_MakeModels()
File “C:/Users/Admin/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/BoneReconstructionPlanner/lib/Slicer-5.2/qt-scripted-modules/BoneReconstructionPlanner.py”, line 3803, in section_MakeModels
self.assertEqual(decimatedFibulaModelNode.GetMesh().GetNumberOfPoints(), 9872)
File “C:\Users\Admin\AppData\Local\NA-MIC\Slicer 5.2.1\lib\Python\Lib\unittest\case.py”, line 837, in assertEqual
assertion_func(first, second, msg=msg)
File “C:\Users\Admin\AppData\Local\NA-MIC\Slicer 5.2.1\lib\Python\Lib\unittest\case.py”, line 830, in _baseAssertEqual
raise self.failureException(msg)
AssertionError: 9871 != 9872
This maybe due to vtk implementation differences on Windows (where you executed the tests) and Ubuntu (where I coded the tests and they were successful)
Result of floating-point operations depend on many things - compiler options, hardware, operating systems, etc. Therefore results of any image or mesh processing operations is often slightly different on each system.
There are special compilation options that could be used to get consistent computation results, but the generated code is very slow, therefore these are rarely used in practice.
A simple solution is to specify tolerances for your tests to allow some small numerical differences.
Python 3.9.10 (main, Nov 24 2022, 08:11:57)
[GCC 7.3.1 20180303 (Red Hat 7.3.1-5)] on linux2
[Qt] QLayout::addChildLayout: layout “” already has a parent
[Qt] ctkSliderWidget::setSingleStep() 0 is out of bounds. 0 100 1
[Qt] QString qSlicerSegmentEditorAbstractEffect::parameter(QString) : Parameter named “regionSegmentID” cannot be found for effect “Wrap Solidify”
[Qt] ctkSliderWidget::setSingleStep() 0 is out of bounds. 0 100 1
Traceback (most recent call last):
File “/home/opd4/Downloads/Slicer-5.2.1-linux-amd64/NA-MIC/Extensions-31317/BoneReconstructionPlanner/lib/Slicer-5.2/qt-scripted-modules/BoneReconstructionPlanner.py”, line 261, in setup
self.initializeParameterNode()
File “/home/opd4/Downloads/Slicer-5.2.1-linux-amd64/NA-MIC/Extensions-31317/BoneReconstructionPlanner/lib/Slicer-5.2/qt-scripted-modules/BoneReconstructionPlanner.py”, line 379, in initializeParameterNode
self.setParameterNode(self.logic.getParameterNode())
File “/home/opd4/Downloads/Slicer-5.2.1-linux-amd64/NA-MIC/Extensions-31317/BoneReconstructionPlanner/lib/Slicer-5.2/qt-scripted-modules/BoneReconstructionPlanner.py”, line 400, in setParameterNode
self.updateGUIFromParameterNode()
File “/home/opd4/Downloads/Slicer-5.2.1-linux-amd64/NA-MIC/Extensions-31317/BoneReconstructionPlanner/lib/Slicer-5.2/qt-scripted-modules/BoneReconstructionPlanner.py”, line 426, in updateGUIFromParameterNode
scalarVolumeID = self._parameterNode.GetNodeReference(“currentScalarVolume”).GetID()
AttributeError: ‘NoneType’ object has no attribute ‘GetID’
[VTK] Warning: In /work/Stable/Slicer-0/Libs/MRML/Core/vtkMRMLSubjectHierarchyNode.cxx, line 2839
[VTK] vtkMRMLSubjectHierarchyNode (0x433cb20): GetItemChildren: Invalid item ID given
[VTK] Warning: In /work/Stable/Slicer-0/Libs/MRML/Core/vtkMRMLSubjectHierarchyNode.cxx, line 2839
[VTK] vtkMRMLSubjectHierarchyNode (0x433cb20): GetItemChildren: Invalid item ID given
Traceback (most recent call last):
File “/home/opd4/Downloads/Slicer-5.2.1-linux-amd64/NA-MIC/Extensions-31317/BoneReconstructionPlanner/lib/Slicer-5.2/qt-scripted-modules/BoneReconstructionPlanner.py”, line 620, in onMakeModelsButton
self.logic.makeModels()
File “/home/opd4/Downloads/Slicer-5.2.1-linux-amd64/NA-MIC/Extensions-31317/BoneReconstructionPlanner/lib/Slicer-5.2/qt-scripted-modules/BoneReconstructionPlanner.py”, line 2299, in makeModels
seg.GetSegmentation().CreateRepresentation(slicer.vtkSegmentationConverter.GetSegmentationClosedSurfaceRepresentationName())
AttributeError: ‘NoneType’ object has no attribute ‘GetSegmentation’
I loaded to Slicer only the CT volumes and the two segmentations from your scene and I could do Virtual Surgical Planning in both Slicer Preview and Stable release with the updated code. Also the automatic tests executed successfully.
The new BRP code will be available tomorrow as an extension update on Stable release or as an extension install on the Preview version of tomorrow. You can also download the code by yourself and add the module path to Slicer settings to start using it today but you first need to uninstall BRP from the extensions manager to avoid conflicts
Perfect. I’m totally new to 3D slicer and Linux, i don’t know how to download and use the code manually… I’ll wait for the update tomorrow and get back to you with a feedback.
Regards
Looks like it’s working, I’m able to get past the error… thanks a lot for the prompt response and solution. Will update once i complete the process or if I come across any error.
It’s still not working on windows, but working on ubuntu
Some tests were failing and got fixed… Please use Slicer Preview release of tomorrow (or update BRP extension on Stable release tomorrow). Both Ubuntu and Windows should work.
Please try executing the automatic tests as I pointed in the video above, they should be a very graphic learning tool for new users
I’m getting a new error in windows app now. here are the details
Traceback (most recent call last):
File “C:\Users\abc\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\util.py”, line 2961, in tryWithErrorDisplay
yield
File “C:\Users\abc\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\ScriptedLoadableModule.py”, line 224, in onReloadAndTest
test(msec=int(slicer.app.userSettings().value(“Developer/SelfTestDisplayMessageDelay”)), **kwargs)
File “C:\Users\abc\AppData\Local\NA-MIC\Slicer 5.2.1\bin\Python\slicer\ScriptedLoadableModule.py”, line 86, in runTest
testCase.runTest(**kwargs)
File “C:/Users/abc/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/BoneReconstructionPlanner/lib/Slicer-5.2/qt-scripted-modules/BoneReconstructionPlanner.py”, line 3654, in runTest
self.section_SimulateAndImproveMandibleReconstruction()
File “C:/Users/abc/AppData/Local/NA-MIC/Slicer 5.2.1/NA-MIC/Extensions-31317/BoneReconstructionPlanner/lib/Slicer-5.2/qt-scripted-modules/BoneReconstructionPlanner.py”, line 4123, in section_SimulateAndImproveMandibleReconstruction
layoutManager.addMaximizedViewNode(mandibleViewNode)
AttributeError: qSlicerLayoutManager has no attribute named ‘addMaximizedViewNode’
@mau_igna_06 Your latest code changes are compatible with the latest Slicer Preview but not the latest Slicer stable (5.2.1). You’ll need to add some compatibility statements like below
if (slicer.app.majorVersion, slicer.app.minorVersion) < (5, 3):
layoutManager.setMaximizedViewNode(fibulaViewNode)
else:
layoutManager.addMaximizedViewNode(fibulaViewNode)
Dear @R_Nara
Thank you for bearing with me. Your testing is very important since we are still developing auto-tests that would send us an email to developers when things are not working.
Stable release should work after updating the BoneReconstructionPlanner extension tomorrow