00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #ifndef mitkTool_h_Included 00019 #define mitkTool_h_Included 00020 00021 #include "mitkCommon.h" 00022 #include "MitkExtExports.h" 00023 #include "mitkStateMachine.h" 00024 #include "mitkToolEvents.h" 00025 #include "itkObjectFactoryBase.h" 00026 #include "itkVersion.h" 00027 #include "mitkToolFactoryMacro.h" 00028 #include "mitkMessage.h" 00029 #include "mitkDataNode.h" 00030 #include "mitkNodePredicateProperty.h" 00031 #include "mitkNodePredicateDataType.h" 00032 #include "mitkNodePredicateDimension.h" 00033 #include "mitkNodePredicateAnd.h" 00034 #include "mitkNodePredicateOr.h" 00035 #include "mitkNodePredicateNot.h" 00036 00037 #include <iostream> 00038 #include <string> 00039 #include <itkObject.h> 00040 00041 namespace mitk 00042 { 00043 00044 class ToolManager; 00045 00076 class MitkExt_EXPORT Tool : public StateMachine 00077 { 00078 public: 00079 00080 typedef unsigned char DefaultSegmentationDataType; 00081 00085 Message<> GUIProcessEventsMessage; 00086 00090 Message1<std::string> ErrorMessage; 00091 00095 Message1<std::string> GeneralMessage; 00096 00097 mitkClassMacro(Tool, StateMachine); 00098 00099 // no New(), there should only be subclasses 00100 00108 virtual const char** GetXPM() const = 0; 00109 00115 virtual const char* GetName() const = 0; 00116 00122 virtual const char* GetGroup() const; 00123 00143 virtual itk::Object::Pointer GetGUI(const std::string& toolkitPrefix, const std::string& toolkitPostfix); 00144 00145 virtual NodePredicateBase::ConstPointer GetReferenceDataPreference() const; 00146 virtual NodePredicateBase::ConstPointer GetWorkingDataPreference() const; 00147 00148 DataNode::Pointer CreateEmptySegmentationNode( Image* original, const std::string& organName, const mitk::Color& color ); 00149 DataNode::Pointer CreateSegmentationNode( Image* image, const std::string& organName, const mitk::Color& color ); 00150 00151 itkGetMacro(SupportRoi, bool); 00152 itkSetMacro(SupportRoi, bool); 00153 itkBooleanMacro(SupportRoi); 00154 00155 00156 protected: 00157 00158 friend class ToolManager; 00159 00160 virtual void SetToolManager(ToolManager*); 00161 00167 virtual void Activated(); 00168 00174 virtual void Deactivated(); 00175 00176 Tool(); // purposely hidden 00177 Tool( const char*); // purposely hidden 00178 virtual ~Tool(); 00179 00180 ToolManager* m_ToolManager; 00181 00182 bool m_SupportRoi; 00183 00184 private: 00185 00186 // for reference data 00187 NodePredicateDataType::Pointer m_PredicateImages; 00188 NodePredicateDimension::Pointer m_PredicateDim3; 00189 NodePredicateDimension::Pointer m_PredicateDim4; 00190 NodePredicateOr::Pointer m_PredicateDimension; 00191 NodePredicateAnd::Pointer m_PredicateImage3D; 00192 00193 NodePredicateProperty::Pointer m_PredicateBinary; 00194 NodePredicateNot::Pointer m_PredicateNotBinary; 00195 00196 NodePredicateProperty::Pointer m_PredicateSegmentation; 00197 NodePredicateNot::Pointer m_PredicateNotSegmentation; 00198 00199 NodePredicateProperty::Pointer m_PredicateHelper; 00200 NodePredicateNot::Pointer m_PredicateNotHelper; 00201 00202 NodePredicateAnd::Pointer m_PredicateImageColorful; 00203 00204 NodePredicateAnd::Pointer m_PredicateImageColorfulNotHelper; 00205 00206 NodePredicateAnd::Pointer m_PredicateReference; 00207 00208 // for working data 00209 NodePredicateAnd::Pointer m_IsSegmentationPredicate; 00210 00211 }; 00212 00213 } // namespace 00214 00215 #endif 00216