Hi!
This issue is related to the SlicerLiver extension development (issue:). We are having problems a MRML node creation in our extension, on Windows 10. The error message is as follows:
ASSERT failure in createNode: "Failed to create node of type [vtkMRMLLiverResectionNode]", file C:\S\Slicer\Libs\MRML\Widgets\qMRMLNodeFactory.cxx, line 74
I’m compiling Slicer v. 4.13.0 (debug) on VS Community 2022. On Windows 10 (v. 21H1 (build 19043.1466)). I tried using the VS debugger, but because the extension objects do not show up in the object list, I can’t track where is this error triggered within the extension.
I can get when the CreateNodeByClass() (qMRMLNodeFactory.cxx L:74) method is called, just before the error.
Any guidance on why the node is not created would be of great help! @RafaelPalomar
Indeed, the extension is not loaded properly.
I tried debugging the extension following the docs (C++ debugging on Windows — 3D Slicer documentation), but the only thing I got so far is that no symbols are loaded for SlicerLiverResectionModule (where the error is triggered).
The libraries are created and stored as expected in “qt-loadable-modules”, and this directory is added to the “Additional modules path”. Also there is no DLL error event recorded in the Event Viewer either, so I guess Slicer is not even attempting to load the module, only the scripted one. I tried using Dependency Walker, though with little success as no log related to the SlicerLiverResectionModule is logged.
When debugging, I see no log regarding the loading of symbols related to additional extension in the Output. Is there a way of logging this information?
You need to add the path to additional module paths that contain the module files. It is not ...\lib\Slicer-5.1\qt-loadable-modules but ``…\lib\Slicer-5.1\qt-loadable-modules\Debug`.
Thank you very much for your help. You are right, the path to the loadable module was wrong.
After pointing to the right path (...qt-loadable-mdoules\Debug), the error is still triggered though. Here is an excerpt of the log when I try to create a VTK MRML Liver Resection Node:
I’ve built Slicer-Liver in debug mode on Windows and then launched Slicer by executing SlicerWithSlicerLiver.exe and I had no problem with instantiating vtkMRMLLiverResectionNode in the Python console:
>>> slicer.mrmlScene.AddNewNodeByClass('vtkMRMLLiverResectionNode')
<vtkSlicerLiverResectionsModuleMRML.vtkMRMLLiverResectionNode(0x00000279CDC48380) at 0x00000279D4B9B220>
>>>
I then started Slicer normally (using Slicer.exe) and added c:\D\Slicer-Liver_D\lib\Slicer-5.1\qt-loadable-modules\Debug to the additional module paths in application settings, restarted Slicer, and again I did not get any error and vtkMRMLLiverResectionNode was instantiated without issues.
So there is nothing wrong with the source code, everything works fine on my computer. There is something wrong with your configuration. You can try to find out what exactly does not work by running Slicer in a debugger and placing breakpoints in the code (e.g., where you register and use the vtkMRMLLiverResectionNode class).