Way to create permanent slice intersection

when slice intersection is enabled, the user can see a line that indicates where the slice they are currently viewing is relative to the other views. I was wondering if there was a way to create a static line for a certain slice (i.e. create a line in the sagittal and coronal views indicating where the a specific axial slice is located, so it doesn’t change no matter what slice is currently in the axial view).

You can create a markups plane node (or a model node with a plane in it) at the desired position and enable 2D display to show its intersection line in slice views.

There are many other ways to do this, depending on what you would like to achieve. Can you write a bit more about your application?

This goal of this feature is basically so if the user has an axial and sagittal view open, the user can click a button with a specific slice open on the axial view and it would be “marked” on the sagittal view, i.e. if the user scrolls away from the that slice, they can tell exactly where the marked scan is by scrolling back to that line in the sagittal view.

To mark a point, you can also use markup fiducial points. It not just remembers a slice but a 3D position. You can jumpy to slice by clicking on the fiducial in the control point list (in Markups module) or in any views (you need to enable 2D projection to make the point show up in all slices).

Alternatively, you can choose view layouts with a couple of extra views (if you want to keep showing the reference planes to the user).

Is it possible to call functions in the vtkSlicerMarkupsLogic and vtkMRMLMarkupsLineNode classes in a different module? I’m not sure if my implementation is incorrect or something else is going wrong.

Yes, you can call methods of MRML nodes and module logic classes from any modules. If you write us the error messages that you get then we can tell what is missing.

Right now my issue is that despite including the vtkSlicerMarkupsLogic.h file in an #include line, I’m getting an “undefined reference to [function]” error whenever I try to use any of the functions in the class.

Please provide the entire error message.

This is what I’ve done:

vtkSlicerMarkupsLogic* markupLogic = vtkSlicerMarkupsLogic::SafeDownCast(qSlicerApplication::application()->applicationLogic());
vtkMRMLNode *markupsNode = qSlicerApplication::application()->mrmlScene()->AddNewNodeByClass("vtkMRMLMarkupsLineNode");
markupLogic->AddNewDisplayNodeForMarkupsNode(markupsNode);

The error I got was: “undefined reference to `vtkSlicerMarkupsLogic::AddNewDisplayNodeForMarkupsNode [abi:cxx11] (vtkMRMLNode*) '”

Adding #include "vtkSlicerMarkupsLogic.h" fixes undefined reference to vtkSlicerMarkupsLogic::AddNewDisplayNodeForMarkupsNode. If not, then most likely your compiler threw an error before that it could not find vtkSlicerMarkupsLogic.h. You always need to fix the very first error the compiler reports because subsequent errors may be result of previous ones.

There are several examples of using markups from C++ modules, for example in SlicerIGT extension.

That’s the strange part, I have the #include line and this error is the only error the compiler throws. I’ll keep investigating then, thanks!

If you send a link to your source code repository then I can take a look.