Medical Imaging Interaction Toolkit  2018.4.99-6a3ea89d
Medical Imaging Interaction Toolkit
mitkTool.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 mitkTool_h_Included
14 #define mitkTool_h_Included
15 
16 #include "itkObjectFactoryBase.h"
17 #include "itkVersion.h"
18 #include "mitkCommon.h"
19 #include "mitkDataNode.h"
20 #include "mitkEventStateMachine.h"
22 #include "mitkLabelSetImage.h"
23 #include "mitkMessage.h"
24 #include "mitkNodePredicateAnd.h"
27 #include "mitkNodePredicateNot.h"
28 #include "mitkNodePredicateOr.h"
30 #include "mitkToolEvents.h"
31 #include "mitkToolFactoryMacro.h"
33 #include <mitkLabel.h>
34 
35 #include <iostream>
36 #include <map>
37 #include <string>
38 
39 #include <itkObject.h>
40 
41 #include "usServiceRegistration.h"
42 
43 namespace us
44 {
45  class ModuleResource;
46 }
47 
48 namespace mitk
49 {
50  class ToolManager;
51 
87  {
88  public:
90 
95 
100 
105 
110 
112 
113  // no New(), there should only be subclasses
114 
123  virtual const char **GetXPM() const = 0;
124 
130  virtual std::string GetIconPath() const { return ""; }
135  virtual us::ModuleResource GetCursorIconResource() const;
136 
142  virtual us::ModuleResource GetIconResource() const;
143 
149  virtual const char *GetName() const = 0;
150 
157  virtual const char *GetGroup() const;
158 
159  virtual void InitializeStateMachine();
160 
182  virtual itk::Object::Pointer GetGUI(const std::string &toolkitPrefix, const std::string &toolkitPostfix);
183 
184  virtual NodePredicateBase::ConstPointer GetReferenceDataPreference() const;
185  virtual NodePredicateBase::ConstPointer GetWorkingDataPreference() const;
186 
187  DataNode::Pointer CreateEmptySegmentationNode(const Image *original,
188  const std::string &organName,
189  const mitk::Color &color);
190  DataNode::Pointer CreateSegmentationNode(Image *image, const std::string &organName, const mitk::Color &color);
191 
192  virtual bool CanHandle(BaseData *referenceData) const;
193 
194  protected:
195  friend class ToolManager;
196 
197  virtual void SetToolManager(ToolManager *);
198 
199  void ConnectActionsAndFunctions() override;
200 
206  virtual void Activated();
207 
213  virtual void Deactivated();
214 
218  std::string m_EventConfig;
219 
220  Tool(); // purposely hidden
221  Tool(const char *, const us::Module *interactorModule = nullptr); // purposely hidden
222  ~Tool() override;
223 
224  void Notify(InteractionEvent *interactionEvent, bool isHandled) override;
225 
226  bool FilterEvents(InteractionEvent *, DataNode *) override;
227 
229 
230  private:
231  // for reference data
232  NodePredicateDataType::Pointer m_PredicateImages;
233  NodePredicateDimension::Pointer m_PredicateDim3;
234  NodePredicateDimension::Pointer m_PredicateDim4;
235  NodePredicateOr::Pointer m_PredicateDimension;
236  NodePredicateAnd::Pointer m_PredicateImage3D;
237 
238  NodePredicateProperty::Pointer m_PredicateBinary;
239  NodePredicateNot::Pointer m_PredicateNotBinary;
240 
241  NodePredicateProperty::Pointer m_PredicateSegmentation;
242  NodePredicateNot::Pointer m_PredicateNotSegmentation;
243 
244  NodePredicateProperty::Pointer m_PredicateHelper;
245  NodePredicateNot::Pointer m_PredicateNotHelper;
246 
247  NodePredicateAnd::Pointer m_PredicateImageColorful;
248 
249  NodePredicateAnd::Pointer m_PredicateImageColorfulNotHelper;
250 
251  NodePredicateAnd::Pointer m_PredicateReference;
252 
253  // for working data
254  NodePredicateAnd::Pointer m_IsSegmentationPredicate;
255 
256  std::string m_InteractorType;
257 
258  std::map<us::ServiceReferenceU, EventConfig> m_DisplayInteractorConfigs;
259 
260  const us::Module *m_InteractorModule;
261  };
262 
263 } // namespace
264 
265 #endif
Message GUIProcessEventsMessage
To let GUI process new events (e.g. qApp->processEvents() )
Definition: mitkTool.h:94
Base class of all tools used by mitk::ToolManager.
Definition: mitkTool.h:86
Base class to implement InteractionEventObservers.
Base of all data objects.
Definition: mitkBaseData.h:37
Message1< bool > CurrentlyBusy
To send whether the tool is busy (to be shown by some GUI)
Definition: mitkTool.h:104
#define MITKSEGMENTATION_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
Message1< std::string > ErrorMessage
To send error messages (to be shown by some GUI)
Definition: mitkTool.h:99
std::string m_EventConfig
Let subclasses change their event configuration.
Definition: mitkTool.h:218
virtual std::string GetIconPath() const
Returns the path of an icon.
Definition: mitkTool.h:130
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
Image class for storing images.
Definition: mitkImage.h:72
Message1< std::string > GeneralMessage
To send general messages (to be shown by some GUI)
Definition: mitkTool.h:109
Event/message/notification class.
Definition: mitkMessage.h:568
mitk::Image::Pointer image
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
mitk::Label::PixelType DefaultSegmentationDataType
Definition: mitkTool.h:89
ToolManager * m_ToolManager
Definition: mitkTool.h:228
static std::string GetName(std::string fileName, std::string suffix)
unsigned short PixelType
Definition: mitkLabel.h:36
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57
Manages and coordinates instances of mitk::Tool.
Super-class that provides the functionality of a StateMachine to DataInteractors. ...