Slicer 5.6 not starting with custom extension

Hello,

A year ago I developped a custom extension as part of an internal project on 3D Slicer 4.11.
At the time, I managed to transfer to Slicer 5.0 without issues and use the extension on this version too. The project finished and I haven’t updated the extension since then. However, I had to re-install it recently and I tried to do so on Slicer 5.6. When I try to start it with the extension installed, the software seem to fall in an infinite starting loop, telling me that the computer lacks the graphic capabilities to start it. And I can’t close it with the task manager either, it just reboots everytime I close it.

I am not a programmer and the extension is not very well made, but I wanted to know if you have any idea on what might cause this problem, and what I can do to solve it.
Or if it’s not feasible, how I could download Slicer 5.0 to use it on this version of the software.

Thank you in advance !

@Vincebisca, what type of modules were included in the extension (C++ loadable, Python, CLI)?

When you say “transfer” do you mean manually copying the module files from one Slicer installation to another? Have you tried to build your extension against Slicer 5.6? Moving binary files generated using Slicer 4.11 to a 5.6 installation (or for that matter, pointing Slicer’s 5.6 paths to modules generated with 4.11) is something I would expect producing the errors you describe.

Generally speaking, moving Slicer backwards to fit one specific extension is not a good idea as you will miss on bug fixes, new features, etc. On the long term it does not even look very sustainable as Slicer is very dynamic and changes rapidly. A much better approach would be to build your extension against a new Slicer and update the extension.

I hope this helps.

Hello @RafaelPalomar , thank you for your reply !

Maybe extension is not the right term, “module” might be better suited. Actually I built it on the Slicelet code template. It is written in Python but uses function from other modules such as SegmentEditorExtraEffects or Elastix.

The module is juste a folder that I copy in the extension folder of Slicer and then add to the software by adding the module’s path in the application settings > module.

I don’t really know what you mean by “build the extension against Slicer 5.6”…

Actually an hour ago I managed to start 5.6, and the module seemed to work, but when I tried to close it the software fell in the starting loop once again…

I hope this made the situation a bit clearer, thanks for your help !

As an additionnal information, when starting, the loading window gets stuck on “registering modules > instanciating modules” back and fort. And I get the following error pop-up :

Errore message 2023_12_18

How do you do it with SegmentEditorExtraEffects and Elastix? Do you install them using the Extension Manager before using your extension?

Do the Show Details... give any relevant information?

Never mind. This is not relevant for python modules as they don’t need to be compiled.

I’m not familiar with slicelets, but if you were given a template from Slicer 4.11 you could try to get a new template from Slicer 5.6 and populate it with your code accordingly. I wouldn’t be surprised if some python templates are different today.

I install them with the Extension Manager yes, and they are imported in the code of the module as well.

The “show details” indicates to search for information on the Get Help - Application does not start section of 3D Slicer’s help. I will search there also, but the point is that the application does start, it just starts in a loop infinitely …

yes, finding the up to date template and populate it with the code is a good idea, I searched for the template but didn’t find it yet, I will continue to search.

As a new piece of information : the module actually only works on my computer with Slicer 5.0.3, I tried adding it back to 4.11 and it didn’t work, same with 4.11, 5.0.3 and 5.6.1 on another computer… I don’t know how it can work only on my version of Slicer 5.0.3, maybe that’s a clue to what the problem is?

Thanks again

@Vincebisca, maybe the slicelets infrastructure is no longer available in modern Slicer. I can’t find any references in the documentation. @Sam_Horvath did slicelets get replaced by SlicerCAT?

I am currently trying through the Extension Wizard → Create Extension → Add module to extension.

It generates a similar template to what I had, however, after I populate it with my old code it fails to instantiate the module.

@Vincebisca, that should be a good way to go. If your module is public I could have a look and see if I can reproduce the problem. There may be some specifics in your module that makes it fail.

@RafaelPalomar , unfortunately I don’t think I can share the module since it’s an internal tool…

I tried to rebuild the module bit by bit while trying when it failed. I used the template created with the Extension Wizard and progressively copy-pasted the functionnal content of the module’s code. For the GUI, I just copy-pasted de .ui file I had for the original module.

So far, it seems to work better, however, when I start it there are a few errors in the Python Log :

[Qt] QLayout::addChildLayout: layout "" already has a parent
[Qt] qMRMLSegmentEditorWidget::setMasterVolumeNodeSelectorVisible is deprecated, use setSourceVolumeNodeSelectorVisible method instead.
[Qt] qMRMLSegmentEditorWidget::setMasterVolumeNode is deprecated, use setSourceVolumeNode method instead.

I tried to find the deprecated functions in my code but it seems they are not from my code…
Additionnaly, when I try to run a resampling function from cropVolumeLogic, I get this kind or error :

[VTK] Generic Warning: In vtkSlicerCropVolumeLogic.cxx, line 91
[VTK] vtkSlicerCropVolumeLogic::vtkInternal::SetXYZ failed: invalid ROI
[VTK] Generic Warning: In vtkSlicerCropVolumeLogic.cxx, line 117
[VTK] vtkSlicerCropVolumeLogic::vtkInternal::SetROIRadius failed: invalid ROI
[VTK] Generic Warning: In vtkSlicerCropVolumeLogic.cxx, line 104
[VTK] vtkSlicerCropVolumeLogic::vtkInternal::GetROIRadius failed: invalid ROI
[VTK] Generic Warning: In vtkSlicerCropVolumeLogic.cxx, line 78
[VTK] vtkSlicerCropVolumeLogic::vtkInternal::GetROIXYZ failed: invalid ROI
[VTK] Generic Warning: In vtkSlicerCropVolumeLogic.cxx, line 104
[VTK] vtkSlicerCropVolumeLogic::vtkInternal::GetROIRadius failed: invalid ROI
[VTK] Input port 0 of algorithm vtkImageMapToWindowLevelColors (000001D4A44D6D80) has 0 connections but is not optional.
[VTK] Input port 0 of algorithm vtkImageThreshold (000001D4F9D01CF0) has 0 connections but is not optional.
[VTK] Input port 0 of algorithm vtkImageMapToWindowLevelColors (000001D4A44D6D80) has 0 connections but is not optional.
[VTK] Input port 0 of algorithm vtkImageReslice (000001D4F7854220) has 0 connections but is not optional.

I have no idea how to fix this. Is it possible that the Qt and VTK functions I used are not supported anymore?

@Vincebisca, it is difficult to debug the error without knowing the code behind it.

Make sure when debugging, that this happens in a clean Slicer environment (make sure you use a recent version of Slicer and that there are not old versions of your module set in the module path). Try to identify the lines that produce the errors and see if the functions are still available and in the same form (number of parameters and order of them).

Hi @RafaelPalomar , yes I understand.

For now I have adressed the main problem of the resampling function by replacing the ROI type from vtkMRMLAnnotationROINode to vtkMRMLMarkupsROINode.

The code still gives warnings about Qt elements being deprecated and the “Input port 0 …” lines but it still runs so that’s a start…

I will dig deeper in the code to see if I can identify and replace deprecated elements.

Thanks a lot for your time and help !

1 Like

Hello again everyone,

I am adding to this topic because there has been new informations. I thought to have solved my initial issue when trying to drag and drop the folder of the extension directly into 3D Slicer’s home page. While that works on PC, it seems that it doesn’t on Mac : the option “Add python scrypted modules to the application” doesn’t appear.

Also, I noticed that when trying the other method, via Edit > Application Settings > Modules, on a fresh version of 3D Slicer, it crashes also wether I use “add” or drag and drop the folder in the module paths window.

The crash doesn’t happen if I already installed the extension once via Drag&Drop and then removed it or re-installed 3D Slicer without wiping the whole “slicer.org” folder.

I am wondering what could cause this difference in behavior between import methods. The extension doesn’t seem completely broken since it works when using the Drag&Drop method…

If anyone has a clue on what is happening it would be great !

Thanks,

Vincent