BoneReconstructionPlanner not generating bone models/cutting guides

Dear Sir,

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

Regards

1 Like

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:

Edit -> Application Settings -> Developer -> Enable developer mode

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.

Please let me know if you have more questions

1 Like

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

how should I proceed?

Hi

Ok, so the test is not so robust as it’s needed and fails:

self.assertEqual(decimatedFibulaModelNode.GetMesh().GetNumberOfPoints(), 9872)

returns:

AssertionError: 9871 != 9872

The difference is 1.

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)

@lassoan do you have any quick fix suggestion?

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.

1 Like

This is the place where I’m stuck as well… nothing works after “generate bone models step”

@R_Nara I’ll solve this during the weekend

Thank you for your patience

1 Like

Thanks @mau_igna_06
i found a workaround for now… i’ve installed Ubuntu VM and running slicer on it now… i’m able to run the test successfully…

I started from scratch on this VM. But I still can’t go past “create models from segmentations” using my data… models turn out to be empty

will it be possible for you to have a look at this project file please

Regards


i get decimated fibula, decimated mandible, and then it stops at fibula… all models are blank, if i hide segments, the 3D view is blank

Probably there was an error. Please open the python interactor and copy the error message and paste it here. I’ll help then.

Here is a keyboard-shortcut on how to open the python console

1 Like

here it is

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’

Thank you. There was a bug and I fixed it

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

1 Like

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

1 Like

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

Regards

1 Like

Hi

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

Hi

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)
1 Like

Thank you @jamesobutler. You are right.

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

1 Like

thanks for resolving the issues, i was able to generate the cutting guides and complete the surgical plan without further issues…