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

nnInteractive interactor for drawing rectangular boxes. More...

#include <mitknnInteractiveBoxInteractor.h>

Inheritance diagram for mitk::nnInteractive::BoxInteractor:
Collaboration diagram for mitk::nnInteractive::BoxInteractor:

Public Member Functions

 BoxInteractor ()
 Constructs a BoxInteractor with InteractionType::Box. More...
 
 ~BoxInteractor () override
 Destructor. Calls OnReset() to clean up data nodes. More...
 
bool HasInteractions () const override
 Checks whether any boxes have been drawn. More...
 
const PlanarFigure * GetLastBox () const
 Returns the most recently completed box for the current prompt type. More...
 
void RemoveLastInteraction (PromptType promptType) override
 Removes the most recently completed box 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...
 
virtual void OnHandleEvent (InteractionEvent *event)
 Called when an interaction event is received. 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 rectangular boxes.

Boxes are managed as a list of PlanarRectangle data nodes, organized by PromptType. The currently drawn PlanarRectangle is stored in a separate data node until it is completed.

Interaction is handled through the PlanarFigureInteractor. Left mouse button display interaction (crosshair navigation) is blocked while this interactor is enabled, allowing plain left clicks for box placement.

See also
Interactor, PlanarFigure, nnInteractiveTool

Definition at line 37 of file mitknnInteractiveBoxInteractor.h.

Constructor & Destructor Documentation

◆ BoxInteractor()

mitk::nnInteractive::BoxInteractor::BoxInteractor ( )

Constructs a BoxInteractor with InteractionType::Box.

◆ ~BoxInteractor()

mitk::nnInteractive::BoxInteractor::~BoxInteractor ( )
override

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

Member Function Documentation

◆ GetLastBox()

const PlanarFigure* mitk::nnInteractive::BoxInteractor::GetLastBox ( ) const

Returns the most recently completed box for the current prompt type.

Returns
Pointer to the last completed PlanarFigure (PlanarRectangle), or nullptr if no boxes have been completed for the current prompt type.
See also
GetCurrentPromptType()

◆ HasInteractions()

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

Checks whether any boxes have been drawn.

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

Implements mitk::nnInteractive::Interactor.

◆ RemoveLastInteraction()

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

Removes the most recently completed box for the given prompt type.

Removes the last box node of promptType from the data storage. A no-op if no completed box exists for that prompt type. The in-progress "next box" node is left untouched.

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

Implements mitk::nnInteractive::Interactor.


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