Running a custom extension on start

Hello,

I am searching for a way to start a custom extension directly when starting 3D Slicer (some kind of modified .exe file, I don’t know).
I am very bad at coding but managed somehow a few months ago to create a custom extension for a personal project using the QuickSegment template that I found. I would like to have a shortcut that starts 3D Slicer directly on this extension.

I have tried the command method first, described at Documentation/Nightly/Developers/Slicelets - Slicer Wiki but didn’t work. I don’t understand why it works on ordinary modules like Transforms or Colors, but not on Extensions such as SlicerElastix. And it doesn’t work for my own extension…

Would really appreciate if someone can help me out !

Thank you !

Does setting your module as the “Home” module work for your purposes? For options on how to implement this, see Open a slicer module with python.

That is a good suggestion, and it might work, but it would make my 3D Slicer always start on this module, and it’s an internal setting… What I am trying to do is really to have an external shortcut that opens 3D Slicer on my Extension. That way I (and other people I work with) can access this feature when they need to, without internal configuration. Don’t know if I’m clear enough tho… Not a pro at all

You can create a shortcut that includes the flag as suggested in the following post as that doesn’t require going into Slicer first and setting the “Home” module setting.

I tried something similar, but even with the command console, I can’t zuse the --python-code “selectModule(‘MyModule’)” command on my module, it doesn’t work also for SlicerElastix. I don’t know if it’s because they have a different status than internal modules such as Transforms…

Edit: doesn’t work with SegmentEditorExtraEffects, but works with MarkupsToModel. The main difference I see is that MarkupsToModel seems to be a loadable module, as opposed to the others which are scripted modules, but I don’t really know the difference

Okay found it, the problem was that for an unknown reason, my module is still recognized as “QuickSegment”, the template’s name, and not by the name I gave. So it worked to modify the shortcut properties with the command line --python-code “slicer.util.selectModule(‘QuickSegment’)”. Still don’t know for Elastix tho.

Thanks for your help james ! Appreciate !

1 Like