MRML None not found

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

Your custom vtkMRMLLiverResectionNode is registered in LiverResections module logic, so if that module is successfully loaded and initialized then the instantiation of the node will succeed. Make sure you add the folder that contains your module DLLs to additional module paths.

1 Like

Thank you very much @lassoan. I’ll look into it!

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:

[DEBUG][Qt] 22.05.2022 14:54:29 [] (unknown:0) - Session start time .......: 2022-05-22 14:54:29
[DEBUG][Qt] 22.05.2022 14:54:29 [] (unknown:0) - Slicer version ...........: 5.1.0-2022-05-19 (revision 30956 / ba34656) win-amd64 - not installed debug
[DEBUG][Qt] 22.05.2022 14:54:29 [] (unknown:0) - Operating system .........: Windows /  Professional / (Build 19043, Code Page 65001) - 64-bit
[DEBUG][Qt] 22.05.2022 14:54:29 [] (unknown:0) - Memory ...................: 32540 MB physical, 49948 MB virtual
[DEBUG][Qt] 22.05.2022 14:54:29 [] (unknown:0) - CPU ......................: GenuineIntel , 12 cores, 12 logical processors
[DEBUG][Qt] 22.05.2022 14:54:29 [] (unknown:0) - VTK configuration ........: OpenGL2 rendering, TBB threading
[DEBUG][Qt] 22.05.2022 14:54:29 [] (unknown:0) - Qt configuration .........: version 5.15.2, with SSL, requested OpenGL 3.2 (compatibility profile)
[DEBUG][Qt] 22.05.2022 14:54:29 [] (unknown:0) - Internationalization .....: disabled, language=
[DEBUG][Qt] 22.05.2022 14:54:29 [] (unknown:0) - Developer mode ...........: enabled
[DEBUG][Qt] 22.05.2022 14:54:29 [] (unknown:0) - Application path .........: C:/S/SD/Slicer-build/bin/Debug
[DEBUG][Qt] 22.05.2022 14:54:29 [] (unknown:0) - Additional module paths ..: C:/S/VMTK_build/inner-build/lib/Slicer-5.1/Debug, C:/S/DebTools/lib/Slicer-5.1/qt-scripted-modules, C:/S/VMTK_build/inner-build/lib/Slicer-5.1/qt-scripted-modules, C:/S/SL_debug/lib/Slicer-5.1/qt-loadable-modules/Debug, C:/S/SL_debug/lib/Slicer-5.1/qt-scripted-modules
[DEBUG][Python] 22.05.2022 14:54:39 [Python] (C:\S\SD\Slicer-build\lib\Slicer-5.1\qt-scripted-modules\SubjectHierarchyPlugins\AbstractScriptedSubjectHierarchyPlugin.py:38) - Scripted subject hierarchy plugin registered: Annotations
[WARNING][Qt] 22.05.2022 14:54:41 [] (unknown:0) - When loading module  "CurveCenterlineExtraction" , the dependency "SegmentEditorDrawTube" failed to be loaded.
[WARNING][Qt] 22.05.2022 14:54:41 [] (unknown:0) - When loading module  "FiducialCenterlineExtraction" , the dependency "SegmentEditorFloodFilling" failed to be loaded.
[DEBUG][Python] 22.05.2022 14:54:42 [Python] (C:\S\SD\Slicer-build\lib\Slicer-5.1\qt-scripted-modules\SubjectHierarchyPlugins\AbstractScriptedSubjectHierarchyPlugin.py:38) - Scripted subject hierarchy plugin registered: SegmentEditor
[DEBUG][Python] 22.05.2022 14:54:42 [Python] (C:\S\SD\Slicer-build\lib\Slicer-5.1\qt-scripted-modules\SubjectHierarchyPlugins\AbstractScriptedSubjectHierarchyPlugin.py:38) - Scripted subject hierarchy plugin registered: SegmentStatistics
[DEBUG][Qt] 22.05.2022 14:54:43 [] (unknown:0) - Switch to module:  "Welcome"
[INFO][VTK] 22.05.2022 14:54:44 [vtkMRMLVolumeArchetypeStorageNode (0000020CC3DD5240)] (C:\S\S_src\Libs\MRML\Core\vtkMRMLVolumeArchetypeStorageNode.cxx:513) - Loaded volume from file: C:/S/VMTK_build/inner-build/lib/Slicer-5.1/qt-scripted-modules/Resources/Vesselness.png. Dimensions: 65x50x1. Number of components: 3. Pixel type: unsigned char.
[DEBUG][Qt] 22.05.2022 14:55:10 [] (unknown:0) - Switch to module:  "Liver"
[FATAL][Qt] 22.05.2022 14:55:13 [] (unknown:0) - ASSERT failure in createNode: "Failed to create node of type [vtkMRMLLiverResectionNode]", file C:\S\S_src\Libs\MRML\Widgets\qMRMLNodeFactory.cxx, line 74
[WARNING][Qt] 22.05.2022 14:55:16 [] (unknown:0) - qMRMLNodeComboBox::addNode() failed with node type vtkMRMLLiverResectionNode

What puzzles me the most is not getting a fail to load module message, if in fact the module couldn’t be loaded.

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).

Glad to hear that the extension can run on Windows!
Thank you very much for your help! :slight_smile:
I’ll keep debugging it then