Interaction Mode

Hi Slicer developers,

When communicating an interaction state/mode within a module (or potentially between modules in an extension) it feels like the best way to do this would be use the vtkMRMLInteractionNodeSingleton. However, this currently only allows for the predefined states (place, viewTransform, & select) - as the function SetCurrentInteractionMode is limited to switch between these enums.

Is there a suggested “best practice” for this, if we need different states? Would it ever make sense to have the vtkMRMLInteractionNode class be more flexible so that states can be added?

Currently I am thinking I will encode the state inside a MRML node particular to the module (which is handling some stuff related to the interaction mode). Another option might be to create a child class of the interaction node to extend the modes?

Thanks for your help,

Louise

Modules that needs custom interaction (such as Segment editor) often just set interaction mode to default (ViewTransform) and capture events directly from window interactors. This is OK for cases when you only need to capture mouse events temporarily.

If you want to show a “tool” in the mouse mode list in the toolbar, then you need to register your own mouse mode (with a corresponding name and icon) - see AddNewPlaceNodeClassNameToList. Then in your custom displayable manager, you would check for the current place node class name, and if it is yours then you process the event, otherwise you ignore it.