How to create custom markup?

For creating a custom markup, how do you open visual studio in the loadable markup source code, but with intellisense and all that from the slicer-build?

You can just load the .sln file of your extension. Intellisense will work well. See details here.

Do not modify Slicer core if you just want to add custom markups. @RafaelPalomar implemented infrastructure for adding new markup types in any extension. Use the “loadablecustommarkups” module template in Extension Wizard.

I looked through that page before, but I may just not be understanding correctly from the instructions. Here are the steps I have taken:

  • Built Slicer from source
  • Used the wizard to create a custom markup
  • Configured and Generated using cmake-gui into a build folder for the markup

From there I am not sure, I am completely new to writing extensions to applications. Do I open to .sln, then open the folder with the source code in it? Do I modify code in the build folder? Do I open the source code folder, then load in the .sln file?
Thanks again for your patience

To develop custom C++ loadable modules, you need to build 3D Slicer first, and then you can build your extension.

Yes, Here are the steps I have already taken.
I have:

  • Built slicer from source to D:/D/S4R
  • Used the extension wizard to create the template for the loadable markup
  • Configured and generated the extension to a build folder using the Slicer_DIR in cmake gui

I just don’t know how to go from there in editing the source folder. When I open the source folder in visual studio it gives me errors. So I am wondering if I have to reference the slicer-build folder while it is open in visual studio.

You can go to the binary folder of your extension (that CMake generated), open that .sln file, choose build configuration (if you built Slicer in Release mode then you need to choose Release mode), and then build. The build should succeed.

I am getting these errors when trying to build using the solution file. I need to modify the source code before building it right? That is the part that I’m wondering about.

Have you built Slicer successfully? Does it run? Have you build Slicer with the same build mode (Debug/Release/…) as you use for building your extension?

Make sure you build the top-level .sln file in your extension.

It may also be an issue that you have a space in your project path (and it is also way too long). Try to build your extension in C:\D\MyExtension.

Thanks for all the help. Your last suggestion worked, I put it in D:\D\Extensions.

As for the actual code writing part. I am still a little confused as to where to start writing. I now have the solutions explorer open in visual studio. Do I add a source code folder to it? Do I open the src folder with the solution explorer open? Thanks again.

You add new files into the source code folders and list the files in the CMakeLists.txt file.