diff --git a/Modules/ExampleModule/include/ExampleSegTool2D.h b/Modules/ExampleModule/include/ExampleSegTool2D.h index e69c355..7362c78 100644 --- a/Modules/ExampleModule/include/ExampleSegTool2D.h +++ b/Modules/ExampleModule/include/ExampleSegTool2D.h @@ -1,48 +1,80 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef ExampleSegTool2D_h #define ExampleSegTool2D_h #include #include namespace us { class ModuleResource; } +// This is an example on how to add a segmentation tool to the standard +// MITK Segmentation Views. Here's the crucial points to make it work: +// +// * The name of the class MUST end in either SegTool2D or SegTool3D +// +// * Derive directly or indirectly from mitk::Tool, for example +// mitk::SegTool2D is a typical choice for 2d tools and +// mitk::AutoSegmentationTool is a typical choice for 3d tools. +// +// * Don't forget the MITK_TOOL_MACRO in the implementation file +// +// * You don't have to provide your own state machine if the state +// machines of the MitkSegmentation module are sufficient, but if +// you do, you MUST provide both, the state machine and an event +// config file, for example Paint.xml and PaintConfig.xml. The +// file name of the event config file MUST be "equal" to the file +// name of the state machine, suffixed by Config.xml instead of +// .xml. The file name is passed to the base class constructor +// without any extension, for example simply "Paint". +// +// * Look into ExampleSegTool2DGUI.h for an example of how to provide +// a custom tool GUI. The naming is important and basically "equals" +// the class name of the tool class, suffixed by GUI. Don't forget +// the MITK_TOOL_GUI_MACRO in the implementation file of the tool GUI. +// +// * Ensure that the module containing your tool is loaded at runtime +// before the MITK Segmentation Views are opened. Otherwise it cannot +// be found. One way is to call anything from that module in a plugin +// with eager activation policy. Such plugins are loaded very early +// in MITK. For an example of how this works, look into ExampleModule.h +// and the org_mitk_exampleplugin_eageractivation plugin. + class MITKEXAMPLEMODULE_EXPORT ExampleSegTool2D : public mitk::SegTool2D { public: mitkClassMacro(ExampleSegTool2D, SegTool2D) itkFactorylessNewMacro(Self) us::ModuleResource GetIconResource() const override; const char *GetName() const override; const char **GetXPM() const override; protected: ExampleSegTool2D(); ~ExampleSegTool2D() override; virtual void Paint(mitk::StateMachineAction* action, mitk::InteractionEvent* event); private: void ConnectActionsAndFunctions() override; }; #endif diff --git a/Modules/ExampleModule/include/ExampleSegTool2DGUI.h b/Modules/ExampleModule/include/ExampleSegTool2DGUI.h index 0b90fff..747334e 100644 --- a/Modules/ExampleModule/include/ExampleSegTool2DGUI.h +++ b/Modules/ExampleModule/include/ExampleSegTool2DGUI.h @@ -1,45 +1,47 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef ExampleSegTool2DGUI_h #define ExampleSegTool2DGUI_h #include #include #include namespace Ui { class ExampleSegTool2DGUI; } +// Look into ExampleSegTool2D.h for more information. + class MITKEXAMPLEMODULE_EXPORT ExampleSegTool2DGUI : public QmitkToolGUI { Q_OBJECT public: mitkClassMacro(ExampleSegTool2DGUI, QmitkToolGUI) itkFactorylessNewMacro(Self) protected: ExampleSegTool2DGUI(); ~ExampleSegTool2DGUI() override; private: QScopedPointer m_Ui; }; #endif