Seeking Guidance on Developing Custom Features using C++ (loadable module / core)

Hello,

I am currently developing a custom app using Slicer. So far, I have been using Python and Scripted Modules for my development. However, I now need to accomplish the following tasks:

  • Develop Custom Markups
  • Create new MRML modules
  • Modify the pipeline
  • Create Custom Transform Handles

I understand that these tasks typically require modifying Slicer’s source code or developing Loadable Modules. I attempted to look into the C++ code to implement these features but am unsure where to start.

I am proficient in Python and can handle Scripted Modules effectively. While I have a basic understanding of C++ and can use the basic API of VTK, I am not very skilled in C++.

Given this situation, what should I prioritize to achieve my goals?

  • Become highly proficient in C++ programming
  • Study VTK more in-depth
  • Learn the Qt Framework
  • Study CMake to understand the structure
  • Take the Slicer Advanced Course

I would appreciate any advice. Thank you.

1 Like

I’m not an expert but I would start in this extension :grinning: :grinning: :grinning:

HIH

  • Create new MRML modules

I think this advanced topic in the developer’s guide can be helpful: Creating Custom MRML Node Classes

Given this situation, what should I prioritize to achieve my goals?

From the things that you listed, here are my views:

  • learning the Qt framework at a basic level will help make the code more readable, and it will be needed for customizing UI
  • becoming proficient in C++ will help, but if you already know the basics then the you can learn via your work on Slicer itself. It is a slow and steady process. Lately while getting familiar with a new language I have found it useful to paste code into chatgpt and ask it to explain things

I think that VTK and CMake are less critical for figuring out where to start and how to get moving, and they can be filled in as you need them.

(we offer the 3D slicer advanced course at Kitware so of course I would recommend it :grinning:)

1 Like

In general my suggestion for new Slicer C++ developers is to study and follow existing patterns - a lot of complex design decisions have been made in the division of code between GUI (Qt) vs Logic/MRML/displayable managers (VTK) vs support libraries in vanilla C++, including how they are exposed in Python. Plus for maintainability you will find it easier if you closely follow conventions so you can more easily adapt as compilers, OSes, dependencies, and build systems inevitably evolve.

This sounds like good advice!

2 Likes

Thank you all for the advice!!

I will take it step by step and leave feedback afterward. Hopefully, one day I can write advice like this myself.

Thank you.