Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
Medical Imaging Interaction Toolkit
ExampleSegTool2D.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef ExampleSegTool2D_h
14 #define ExampleSegTool2D_h
15 
16 #include <mitkSegTool2D.h>
18 
19 namespace us
20 {
21  class ModuleResource;
22 }
23 
24 // This is an example on how to add a segmentation tool to the standard
25 // MITK Segmentation Views. Here's the crucial points to make it work:
26 //
27 // * The name of the class MUST end in either SegTool2D or SegTool3D
28 //
29 // * Derive directly or indirectly from mitk::Tool, for example
30 // mitk::SegTool2D is a typical choice for 2d tools and
31 // mitk::AutoSegmentationTool is a typical choice for 3d tools.
32 //
33 // * Don't forget the MITK_TOOL_MACRO in the implementation file
34 //
35 // * You don't have to provide your own state machine if the state
36 // machines of the MitkSegmentation module are sufficient, but if
37 // you do, you MUST provide both, the state machine and an event
38 // config file, for example Paint.xml and PaintConfig.xml. The
39 // file name of the event config file MUST be "equal" to the file
40 // name of the state machine, suffixed by Config.xml instead of
41 // .xml. The file name is passed to the base class constructor
42 // without any extension, for example simply "Paint".
43 //
44 // * Look into ExampleSegTool2DGUI.h for an example of how to provide
45 // a custom tool GUI. The naming is important and basically "equals"
46 // the class name of the tool class, suffixed by GUI. Don't forget
47 // the MITK_TOOL_GUI_MACRO in the implementation file of the tool GUI.
48 //
49 // * Ensure that the module containing your tool is loaded at runtime
50 // before the MITK Segmentation Views are opened. Otherwise it cannot
51 // be found. One way is to call anything from that module in a plugin
52 // with eager activation policy. Such plugins are loaded very early
53 // in MITK. For an example of how this works, look into ExampleModule.h
54 // and the org_mitk_exampleplugin_eageractivation plugin.
55 
57 {
58 public:
60  itkFactorylessNewMacro(Self)
61 
62  us::ModuleResource GetIconResource() const override;
63  const char *GetName() const override;
64  const char **GetXPM() const override;
65 
66 protected:
68  ~ExampleSegTool2D() override;
69 
70  virtual void Paint(mitk::StateMachineAction* action, mitk::InteractionEvent* event);
71 
72 private:
73  void ConnectActionsAndFunctions() override;
74 };
75 
76 #endif
mitk::InteractionEvent
Definition: mitkInteractionEvent.h:26
mitk::SegTool2D::mitkClassMacro
mitkClassMacro(SegTool2D, Tool)
MITKEXAMPLEMODULE_EXPORT
#define MITKEXAMPLEMODULE_EXPORT
Definition: MitkExampleModuleExports.h:15
us
Definition: mitkAbstractFileReader.h:29
mitk::Tool::ConnectActionsAndFunctions
void ConnectActionsAndFunctions() override
mitk::EventStateMachine
‍**
Definition: mitkEventStateMachine.h:111
mitk::SegTool2D
Abstract base class for segmentation tools.
Definition: mitkSegTool2D.h:56
mitk::Tool::GetName
virtual const char * GetName() const =0
Returns the name of this tool. Make it short!
mitk::Tool::GetIconResource
virtual us::ModuleResource GetIconResource() const
Returns the tool button icon of the tool wrapped by a usModuleResource.
ExampleSegTool2D
Definition: ExampleSegTool2D.h:56
mitkSegTool2D.h
us::ModuleResource
Definition: usModuleResource.h:55
mitk::StateMachineAction
Represents an action, that is executed after a certain event (in statemachine-mechanism) TODO: implem...
Definition: mitkStateMachineAction.h:30
mitk::Tool::GetXPM
virtual const char ** GetXPM() const =0
Returns an icon in the XPM format.
MitkExampleModuleExports.h