Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::StdFunctionCommand Class Reference

ITK command that uses std::function objects as filter and action callbacks. More...

#include <mitkStdFunctionCommand.h>

Inheritance diagram for mitk::StdFunctionCommand:
Collaboration diagram for mitk::StdFunctionCommand:

Public Types

using Self = StdFunctionCommand
 
using Pointer = itk::SmartPointer< Self >
 
using FilterFunction = std::function< bool(const itk::EventObject &)>
 Function type for filtering events. Returns true if the event should be handled. More...
 
using ActionFunction = std::function< void(const itk::EventObject &)>
 Function type for the action to execute when the filter passes. More...
 

Public Member Functions

virtual const char * GetClassName () const
 
void SetCommandFilter (FilterFunction stdFunctionFilter)
 Set the filter function that decides whether to handle an event. More...
 
void SetCommandAction (ActionFunction stdFunctionAction)
 Set the action function to execute when the filter passes. More...
 
void Execute (Object *, const itk::EventObject &event) override
 Execute the command for a non-const caller. More...
 
void Execute (const Object *, const itk::EventObject &event) override
 Execute the command for a const caller. More...
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

 StdFunctionCommand ()
 
 ~StdFunctionCommand () override
 

Protected Attributes

FilterFunction m_StdFilterFunction
 
ActionFunction m_StdActionFunction
 

Detailed Description

ITK command that uses std::function objects as filter and action callbacks.

This command accepts a filter function that decides whether to handle an event, and an action function that is executed when the filter returns true. Both functions must be set before the command will execute.

Definition at line 33 of file mitkStdFunctionCommand.h.

Member Typedef Documentation

◆ ActionFunction

using mitk::StdFunctionCommand::ActionFunction = std::function<void(const itk::EventObject&)>

Function type for the action to execute when the filter passes.

Definition at line 43 of file mitkStdFunctionCommand.h.

◆ FilterFunction

using mitk::StdFunctionCommand::FilterFunction = std::function<bool(const itk::EventObject&)>

Function type for filtering events. Returns true if the event should be handled.

Definition at line 40 of file mitkStdFunctionCommand.h.

◆ Pointer

◆ Self

Constructor & Destructor Documentation

◆ StdFunctionCommand()

mitk::StdFunctionCommand::StdFunctionCommand ( )
inlineprotected

Definition at line 109 of file mitkStdFunctionCommand.h.

◆ ~StdFunctionCommand()

mitk::StdFunctionCommand::~StdFunctionCommand ( )
inlineoverrideprotected

Definition at line 114 of file mitkStdFunctionCommand.h.

Member Function Documentation

◆ Execute() [1/2]

void mitk::StdFunctionCommand::Execute ( const Object *  ,
const itk::EventObject &  event 
)
inlineoverride

Execute the command for a const caller.

If both filter and action functions are set and the filter returns true for the given event, the action function is called.

Definition at line 94 of file mitkStdFunctionCommand.h.

◆ Execute() [2/2]

void mitk::StdFunctionCommand::Execute ( Object *  ,
const itk::EventObject &  event 
)
inlineoverride

Execute the command for a non-const caller.

If both filter and action functions are set and the filter returns true for the given event, the action function is called.

Definition at line 77 of file mitkStdFunctionCommand.h.

◆ GetClassName()

virtual const char* mitk::StdFunctionCommand::GetClassName ( ) const
virtual

Run-time type information (and related methods).

◆ New()

static Pointer mitk::StdFunctionCommand::New ( )
static

Method for creation through the object factory.

◆ SetCommandAction()

void mitk::StdFunctionCommand::SetCommandAction ( ActionFunction  stdFunctionAction)
inline

Set the action function to execute when the filter passes.

Parameters
[in]stdFunctionActionthe action function.

Definition at line 66 of file mitkStdFunctionCommand.h.

◆ SetCommandFilter()

void mitk::StdFunctionCommand::SetCommandFilter ( FilterFunction  stdFunctionFilter)
inline

Set the filter function that decides whether to handle an event.

Parameters
[in]stdFunctionFilterthe filter function.

Definition at line 56 of file mitkStdFunctionCommand.h.

Member Data Documentation

◆ m_StdActionFunction

ActionFunction mitk::StdFunctionCommand::m_StdActionFunction
protected

Definition at line 107 of file mitkStdFunctionCommand.h.

◆ m_StdFilterFunction

FilterFunction mitk::StdFunctionCommand::m_StdFilterFunction
protected

Definition at line 106 of file mitkStdFunctionCommand.h.


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