Markup shortkeys and model interaction


I apologize in advance if the answer is clearly stated somewhere but I cannot find a definite answer to my questions below. I found bits and pieces of informations but I may not be using the right keywords. Some pointers would be helpful.

We are trying to use the markup module / control point to process quite a bit of data. For this we will use templates on a rough segmentation model and the result will be used to initialize other tools.

Efficient interactions with the 3D model are essential to position the points. This interaction seems cumbersome in Slicer compared to some other tools (meshlab for example, but meshlab does not have the 3D image). More specifically, once in the markup / control point is ready to be click (with the red sphere and name shown):

  • how to rotate the model (without clicking on the arrow). The middle button translates, the right button exits the selection (but does not toggle), space to toggle between tools only seems to work in segmentation, ctrl, alt do not seem to be work as modifyiers, etc…

  • how to change the center of rotation to a point clicked on a model ? (e.g. double click in meshlab, middle click some other tool we use, etc).

  • how to implement modifyers/shortcuts if none of this is available? (I found posts of shortcuts but if there was somewhere an example with a modifyier (e.g. alt with left click rotates but and returns to the current mode), that would be useful

  • optionnally how to change the depth of the camera / perspective angle to end up viewing inside or between an objects? (“using the z buffer” in some other tools etc, ctrl whee/alt/etc in meshlab, position camera tool in sketchup…). I know about model clip. This one is less important to us.


The good news is that most of the behavior customization (adding/changing keyboard shortcuts, small navigation features, etc.) are all quite easy to do, using very little Python scripting. We can also make changes in Slicer core to satisfy any requirements that are generally useful.

I’ve created a pull request that allows view manipulation during point placement by holding down the Alt key. See below.

You can already use “Refocus camera on this point” feature for this. It is available in the right-click menu of any control point of a markup. You can create a separate markup node for this that you can lock in place, change color, etc. to distinguish from your landmark points.

I’ve implemented a right-click menu to set any point (without adding a markup point). See below.

You can change the perspective projection angle by copy-pasting this into the Python console:

for cameraNode in getNodesByClass("vtkMRMLCameraNode"):

It would be easy to add a GUI for this, but it has not come up as a need.

Pull request that adds Alt modifier for view manipulation and camera refocusing to view context menu:

@muratmaga Your group places lots of points, so this discussion should be interesting. Please have a look at this discussion and the pull request and let us know if you have any comments or suggestions.

Wow. Thanks for your fast response.
This is great news.

We will keep an eye on the pull request for when it makes it in the nightly windows build.

I had not seen the right key menu and, for the camera angle, I confirm it is good enough to paste in the console. It is really helpful to click points in partially hidden location but it is not like we do that every minute.

Thanks again

@lassoan We tried the Alt modifiers in this pull request and they work well. I think this will be a very useful feature!

One thing to note: I initially tried on a VNC connection with alternate Windows mappings for Alt+mouse motion that overrode the Slicer shortcuts. This might not be a common use case, but I wonder if it might be worth considering a different modifier key?

Thank you for the feedback.

VNC stealing the Alt key is a niche use case - I don’t think it should impact the general use case. For that special case it is possible to re-map the keys using some custom Python scripting (and all these new Alt shortcuts are just additions to the existing shortcuts anyway).

1 Like

The pull request is now merged, the new features will be available in the Slicer Preview Release from tomorrow.

1 Like

It works fine for me (windows 10 machine, both alt and change of camera center).
That will clearly help.
This is also the fastest change I have ever seen after posting a question for me ;-).
Thanks again Andras.

1 Like