Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef mitkTool_h_Included
18 #define mitkTool_h_Included
19 
20 #include "itkObjectFactoryBase.h"
21 #include "itkVersion.h"
22 #include "mitkCommon.h"
23 #include "mitkDataNode.h"
24 #include "mitkMessage.h"
25 #include "mitkNodePredicateAnd.h"
28 #include "mitkNodePredicateNot.h"
29 #include "mitkNodePredicateOr.h"
31 #include "mitkToolEvents.h"
32 #include "mitkToolFactoryMacro.h"
34 
35 #include <iostream>
36 #include <map>
37 #include <string>
38 
39 #include <itkObject.h>
40 
41 #include "usServiceRegistration.h"
42 
43 #include "mitkEventStateMachine.h"
45 #include <mitkLabel.h>
46 
47 namespace us
48 {
49  class ModuleResource;
50 }
51 
52 namespace mitk
53 {
54  class ToolManager;
55 
93  {
94  public:
96 
101 
106 
111 
116 
118 
119  // no New(), there should only be subclasses
120 
129  virtual const char **GetXPM() const = 0;
130 
136  virtual std::string GetIconPath() const { return ""; }
141  virtual us::ModuleResource GetCursorIconResource() const;
142 
148  virtual us::ModuleResource GetIconResource() const;
149 
155  virtual const char *GetName() const = 0;
156 
163  virtual const char *GetGroup() const;
164 
165  virtual void InitializeStateMachine();
166 
188  virtual itk::Object::Pointer GetGUI(const std::string &toolkitPrefix, const std::string &toolkitPostfix);
189 
190  virtual NodePredicateBase::ConstPointer GetReferenceDataPreference() const;
191  virtual NodePredicateBase::ConstPointer GetWorkingDataPreference() const;
192 
193  DataNode::Pointer CreateEmptySegmentationNode(Image *original,
194  const std::string &organName,
195  const mitk::Color &color);
196  DataNode::Pointer CreateSegmentationNode(Image *image, const std::string &organName, const mitk::Color &color);
197 
198  virtual bool CanHandle(BaseData *referenceData) const;
199 
200  protected:
201  friend class ToolManager;
202 
203  virtual void SetToolManager(ToolManager *);
204 
205  void ConnectActionsAndFunctions() override;
206 
212  virtual void Activated();
213 
219  virtual void Deactivated();
220 
224  std::string m_EventConfig;
225 
226  Tool(); // purposely hidden
227  Tool(const char *); // purposely hidden
228  virtual ~Tool();
229 
230  virtual void Notify(InteractionEvent *interactionEvent, bool isHandled) override;
231 
232  bool FilterEvents(InteractionEvent *, DataNode *) override;
233 
235 
236  private:
237  // for reference data
238  NodePredicateDataType::Pointer m_PredicateImages;
239  NodePredicateDimension::Pointer m_PredicateDim3;
240  NodePredicateDimension::Pointer m_PredicateDim4;
241  NodePredicateOr::Pointer m_PredicateDimension;
242  NodePredicateAnd::Pointer m_PredicateImage3D;
243 
244  NodePredicateProperty::Pointer m_PredicateBinary;
245  NodePredicateNot::Pointer m_PredicateNotBinary;
246 
247  NodePredicateProperty::Pointer m_PredicateSegmentation;
248  NodePredicateNot::Pointer m_PredicateNotSegmentation;
249 
250  NodePredicateProperty::Pointer m_PredicateHelper;
251  NodePredicateNot::Pointer m_PredicateNotHelper;
252 
253  NodePredicateAnd::Pointer m_PredicateImageColorful;
254 
255  NodePredicateAnd::Pointer m_PredicateImageColorfulNotHelper;
256 
257  NodePredicateAnd::Pointer m_PredicateReference;
258 
259  // for working data
260  NodePredicateAnd::Pointer m_IsSegmentationPredicate;
261 
262  std::string m_InteractorType;
263 
264  std::map<us::ServiceReferenceU, EventConfig> m_DisplayInteractorConfigs;
265  };
266 
267 } // namespace
268 
269 #endif
Message GUIProcessEventsMessage
To let GUI process new events (e.g. qApp->processEvents() )
Definition: mitkTool.h:100
Base class of all tools used by mitk::ToolManager.
Definition: mitkTool.h:92
Base class to implement InteractionEventObservers.
itk::SmartPointer< Self > Pointer
Base of all data objects.
Definition: mitkBaseData.h:39
Message1< bool > CurrentlyBusy
To send whether the tool is busy (to be shown by some GUI)
Definition: mitkTool.h:110
#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:105
std::string m_EventConfig
Let subclasses change their event configuration.
Definition: mitkTool.h:224
virtual void ConnectActionsAndFunctions() override
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
Image class for storing images.
Definition: mitkImage.h:76
Message1< std::string > GeneralMessage
To send general messages (to be shown by some GUI)
Definition: mitkTool.h:115
Event/message/notification class.
Definition: mitkMessage.h:572
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
mitk::Label::PixelType DefaultSegmentationDataType
Definition: mitkTool.h:95
ToolManager * m_ToolManager
Definition: mitkTool.h:234
static std::string GetName(std::string fileName, std::string suffix)
unsigned short PixelType
Definition: mitkLabel.h:40
virtual std::string GetIconPath() const
Returns the path of an icon.
Definition: mitkTool.h:136
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66
Manages and coordinates instances of mitk::Tool.
Super-class that provides the functionality of a StateMachine to DataInteractors. ...