Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::nnInteractive::LassoInteractor Class Reference

nnInteractive interactor for drawing contours. More...

#include <mitknnInteractiveLassoInteractor.h>

Inheritance diagram for mitk::nnInteractive::LassoInteractor:
Collaboration diagram for mitk::nnInteractive::LassoInteractor:

Public Member Functions

 LassoInteractor ()
 Constructs a LassoInteractor with InteractionType::Lasso. More...
 
 ~LassoInteractor () override
 Destructor. Calls OnReset() to clean up data nodes. More...
 
bool HasInteractions () const override
 Checks whether any contours have been drawn. More...
 
Image::ConstPointer GetLastLassoMask () const
 Returns the binary mask slice of the most recently drawn contour. More...
 
const InteractionBoundingBox * GetLastLassoBoundingBox () const
 Returns the interaction bounding box for the most recently drawn contour. More...
 
void RemoveLastInteraction (PromptType promptType) override
 Removes the most recently drawn contour for the given prompt type. More...
 
- Public Member Functions inherited from mitk::nnInteractive::Interactor
virtual ~Interactor ()
 Destructor. More...
 
InteractionType GetType () const
 Returns the interaction type associated with this interactor. More...
 
void SetToolManager (ToolManager *toolManager)
 Sets the ToolManager for this interactor. More...
 
void HandleEvent (InteractionEvent *event)
 Handles an interaction event. More...
 
void Enable (PromptType promptType)
 Enables the interactor for the given prompt type. More...
 
void Disable ()
 Disables the interactor. More...
 
bool IsEnabled () const
 Checks whether the interactor is currently enabled. More...
 
void Reset ()
 Resets the interactor to its initial state. More...
 
std::string GetIcon () const
 Retrieves the SVG icon as a string from module resources. More...
 
std::string GetCursor (PromptType promptType) const
 Retrieves the SVG cursor as a string from module resources based on PromptType. More...
 

Additional Inherited Members

- Public Attributes inherited from mitk::nnInteractive::Interactor
Message1< bool > UpdatePreviewEvent
 Event triggered after an interaction has occurred. More...
 
- Protected Member Functions inherited from mitk::nnInteractive::Interactor
 Interactor (InteractionType type)
 Constructs an interactor with a given type. More...
 
virtual void OnSetToolManager ()
 Called when a ToolManager is assigned. More...
 
ToolManager * GetToolManager () const
 Returns the ToolManager associated with this interactor. More...
 
DataStorage * GetDataStorage () const
 Convenience method for accessing the DataStorage. More...
 
PromptType GetCurrentPromptType () const
 Returns the currently active prompt type. More...
 

Detailed Description

nnInteractive interactor for drawing contours.

Each completed contour is stored as a ContourModel DataNode (vector geometry, cheap to keep around) for persistent visualization across slice scrolling and interactor switches; contours are organized by PromptType. The most recently drawn contour is also exposed as a small bounding-box-sized 3D uint8 mask plus the corresponding axis-aligned interaction bounding box in nnInteractive coordinates, so the Python call can skip the full 3D volume round-trip.

Interaction is handled through an internal contour state machine that builds a 3D-world-coordinate ContourModel as the user drags. On release the contour is rasterized via VTK reslicing into a small bounding-box-sized mask – no 3D working segmentation is involved. Left mouse button display interaction (crosshair navigation) is blocked while the interactor is enabled so the crosshair does not move during drawing.

See also
Interactor, ContourModel, nnInteractiveTool

Definition at line 42 of file mitknnInteractiveLassoInteractor.h.

Constructor & Destructor Documentation

◆ LassoInteractor()

mitk::nnInteractive::LassoInteractor::LassoInteractor ( )

◆ ~LassoInteractor()

mitk::nnInteractive::LassoInteractor::~LassoInteractor ( )
override

Destructor. Calls OnReset() to clean up data nodes.

Member Function Documentation

◆ GetLastLassoBoundingBox()

const InteractionBoundingBox* mitk::nnInteractive::LassoInteractor::GetLastLassoBoundingBox ( ) const

Returns the interaction bounding box for the most recently drawn contour.

The box is in nnInteractive's coordinate order (reverse of MITK index order): {{z_min,z_max}, {y_min,y_max}, {x_min,x_max}}.

Returns
Pointer to the bounding box, or nullptr if no contour has been drawn yet.

◆ GetLastLassoMask()

Image::ConstPointer mitk::nnInteractive::LassoInteractor::GetLastLassoMask ( ) const

Returns the binary mask slice of the most recently drawn contour.

The mask is a uint8 image whose extent matches the corresponding interaction bounding box (one voxel thick along the slicing axis). Returning a smart pointer makes the lifetime explicit so callers do not need to know that the underlying member is replaced on the next stroke.

Returns
The mask Image, or a null smart pointer if no contour has been drawn yet.

◆ HasInteractions()

bool mitk::nnInteractive::LassoInteractor::HasInteractions ( ) const
overridevirtual

Checks whether any contours have been drawn.

Returns
true if at least one completed contour exists for any prompt type, false otherwise.

Implements mitk::nnInteractive::Interactor.

◆ RemoveLastInteraction()

void mitk::nnInteractive::LassoInteractor::RemoveLastInteraction ( PromptType  promptType)
overridevirtual

Removes the most recently drawn contour for the given prompt type.

Removes the last lasso overlay node of promptType from the data storage. A no-op if no contour exists for that prompt type.

Parameters
[in]promptTypeThe prompt type whose last contour should be removed.

Implements mitk::nnInteractive::Interactor.


The documentation for this class was generated from the following file: