diff --git a/Documentation/Doxygen/3-DeveloperManual/Concepts/Overlays.dox b/Documentation/Doxygen/3-DeveloperManual/Concepts/Annotation.dox similarity index 89% rename from Documentation/Doxygen/3-DeveloperManual/Concepts/Overlays.dox rename to Documentation/Doxygen/3-DeveloperManual/Concepts/Annotation.dox index 38e8b8d1e1..0c7c4537b7 100644 --- a/Documentation/Doxygen/3-DeveloperManual/Concepts/Overlays.dox +++ b/Documentation/Doxygen/3-DeveloperManual/Concepts/Annotation.dox @@ -1,123 +1,123 @@ /** -\page OverlaysPage Overlays and Annotations Concepts +\page AnnotationPage Overlays and Annotations Concepts \tableofcontents -\section OverlaysPage_Introduction Overlays and Annotations +\section AnnotationPage_Introduction Overlays and Annotations The overlays in MITK are a simple way to display additional information on the render windows. A class, deriving from mitk::Overlay represents an arbitrary 2D or 3D object that can be rendered as an overlay. This can for example be used for the annotation of 3D points or to overlay despriptions in the window corners. The mitk::OverlayManager is used to add the overlays to the renderwindows, updating them and manage the respective layout managers. The following features are implemented in this framework.
  1. Definition of graphical elements that can be displayed in the render windows.
  2. It is possible to manage multiple elements in each window.
  3. A single Overlay can be rendered on any number of available render windows.
  4. 2D and 3D textelements are already defined in the Overlay module and are using VTK to create custom annotations.
  5. The mitk::BaseLayouter interface enables the implementation of layout managers, to handle the placement of the overlays.
-\section OverlaysPage_ArchitectureSection General Architecture +\section AnnotationPage_ArchitectureSection General Architecture \dot digraph linker_deps { node [shape=record, fontname=Helvetica, fontsize=10]; BR [ label="BaseRenderer" ]; BL [ label="{BaseLayouter|+ArrangeOverlays()}" ]; O [ label="{Overlay|-PropertyList|+RemoveOverlay(BaseRenderer*)\n+UpdateOverlay(BaseRenderer*)\n+RemoveOverlay(BaseRenderer*)}" ]; OM [ label="{OverlayManager|+AddOverlay(Overlay*)\n+RemoveOverlay(Overlay*)}" ]; TO [ label="TextOverlay" ]; VTKO [ label="{vtkOverlay|#GetVtkActor()}" ]; TO -> VTKO; VTKO -> O; OM -> O [style="dashed",label="manages"]; OM -> BL [style="dashed"]; OM -> BR [style="dashed"]; BR -> OM [style="dashed"]; } \enddot The mitk::Overlay can be implemented using a custom rendering framework like VTK. In this diagram, the vtkOverlay is shown as the superclass for all Overlays which use the vtk framework for rendering. The OverlayManager can be registered to several BaseRenderer instances in order to call the update method of each Overlay during the rendering phase of the renderer. It also manages the respective Layouters which are used to manage the placement of a group of Overlays. -\subsection OverlaysPage_OverlaySubsection Overlay +\subsection AnnotationPage_OverlaySubsection Overlay The mitk::Overlay is an abstract class that can manage property lists like the mitk::DataNode and provides the interfaces to thr three methods mitk::Overlay::AddOverlay, mitk::Overlay::UpdateOverlay and mitk::Overlay::RemoveOverlay. The subclasses of the mitk::Overlay have to implement these methods in order to provide the functionallity of an overlay. There are already a few implementations of mitk::Overlay which are using VTK as a rendering framework to display the Overlays. However the mitk::Overlay can also be implemented using OpenGL to draw the Overlay on the renderwindows. -\subsection OverlaysPage_OverlayManagerSubsection OverlayManager +\subsection AnnotationPage_OverlayManagerSubsection OverlayManager The mitk::OverlayManager is the manager for a set of Overlays and the respective Layouters. Before the manager can be used, all mitk::BaseRenderer have to be registered to the mitk::OverlayManager instance like this: \snippet OverlayExample.cpp CreateOverlayManager The mitk::OverlayManager can then be used anywhere in the program by fetching it as follows: \snippet OverlayExample.cpp GetOverlayManagerInstance All mitk::Overlay instances can now be added to the OverlayManager by calling mitk::OverlayManager::AddOverlay. -\subsection OverlaysPage_LayouterSubsection Layouter +\subsection AnnotationPage_LayouterSubsection Layouter In order to use Layouters for the positioning of the Overlays, each Layouter object that has been created has to be added to an internal list in the OverlayManager: \snippet OverlayExample.cpp AddLayouter The mitk::OverlayManager::SetLayouter method can then be used to configure an Overlay to be positioned by a certain Layouter: \snippet OverlayExample.cpp SetLayouterToOverlay -\subsection OverlaysPage_NotManagedSubsection Manually Managed Overlays +\subsection AnnotationPage_NotManagedSubsection Manually Managed Overlays In order to integrate an Overlay into an mitk::Mapper, it is advised not to use the OverlayManager but to manually manage the Overlay. To do so, the update methods of the overlays have to be called manually before the start of each rendering procedure. It must only be called if the Properties have changed or if your custom overlay implements its own rendering mechanism. -\section OverlaysPage_CustomOverlaySection Implement a Custom Overlay +\section AnnotationPage_CustomOverlaySection Implement a Custom Overlay A new custom Overlay should derive from mitkOverlay or one of the later mentioned subclasses VtkOverlay2D oder VtkOverlay3D. There should always be an implementation for the methods AddOverlay, RemoveOverlay and Update Overlay. UpdateOverlay is the procedure that is called in each rendering step. If the Overlay is rendered by VTK, this method only applies the properties to the representation. If the custom Overlay requires additional properties, they should be made accessible by getters and setters for a better usability: \code void mitk::VtkOverlay3D::SetPosition3D(Point3D position3D, mitk::BaseRenderer *renderer) { mitk::Point3dProperty::Pointer position3dProperty = mitk::Point3dProperty::New(position3D); SetProperty("Position3D", position3dProperty,renderer); } mitk::Point3D mitk::VtkOverlay3D::GetPosition3D(mitk::BaseRenderer *renderer) { mitk::Point3D position3D; GetPropertyValue("Position3D", position3D, renderer); return position3D; } \endcode -\subsection OverlaysPage_CustomVTK2DOverlaySubsection VTK 2D Overlay +\subsection AnnotationPage_CustomVTK2DOverlaySubsection VTK 2D Overlay VTK based overlays which are meant to be displayed in 2D over the render window should derive from the mitk::VtkOverlay2D. The mitk::VtkOverlay2D is a subclass of Vtk::Overlay, that uses VTK to render the overlay. This class creates the Overlay representation as a vtkActor2D, and is very easy to implement because only UpdateVtkOverlay2D and GetVtkActor2D have to be implemented. The add, update and remove methods are implemented in the superclasses. UpdateVtkOverlay2D only needs to apply the specific properties and GetVtkActor2D simply returns the created vtkActor. -\subsection OverlaysPage_CustomVTK3DOverlaySubsection VTK 3D Overlay +\subsection AnnotationPage_CustomVTK3DOverlaySubsection VTK 3D Overlay The mitkVtkOverlay3D works just like mitkVtkOverlay2D, but it is designed for arbitrary 3D objects which derive from vtkProp, -\section OverlaysPage_CustomLayouterSection Implement a Custom Layouter +\section AnnotationPage_CustomLayouterSection Implement a Custom Layouter A Layouter is used for an automatic positioning of a group of Overlays and is derived from mitkBaseLayouter. Every Layouter that manages a group of Layouts should have a unique identifier which is used to register the Layouter in the OverlayManager. A Layouter is always uniquely defined by the identifier and one BaseRenderer. Before a Layouter can be used by the OverlayManager it has to be added, using the AddLayouter Method. An Overlay can then be added to a Layout as follows: \code overlayManager->SetLayouter(textOverlay.GetPointer(),mitk::Overlay2DLayouter::STANDARD_2D_TOPLEFT,axialRenderer); \endcode A new Layouter has to implement PrepareLayout which should parse the internal Overlay list and set their position as required. */ diff --git a/Documentation/Doxygen/3-DeveloperManual/Concepts/Concepts.dox b/Documentation/Doxygen/3-DeveloperManual/Concepts/Concepts.dox index 5a0594d3fe..f7ec5a8bc5 100644 --- a/Documentation/Doxygen/3-DeveloperManual/Concepts/Concepts.dox +++ b/Documentation/Doxygen/3-DeveloperManual/Concepts/Concepts.dox @@ -1,33 +1,33 @@ /** \page Concepts MITK Concepts -The following items describe some issues about MITK on a more abstract level. +The following items describe some issues about MITK on a more abstract level. -# \subpage OverviewPage -# \subpage CodingPage "Coding Concepts" -# \ref CodingPageGeneral -# \ref CodingPageStyle -# \ref CodingPageMITKMacros -# \subpage MicroServices_Overview -# Data Concepts -# \subpage BasicDataTypesPage -# \subpage DataManagementPage -# \subpage ReaderWriterPage -# \subpage MitkImagePage -# \subpage PropertiesPage -# \subpage GeometryOverviewPage -# \subpage PipelineingConceptPage - -# \subpage OverlaysPage + -# \subpage AnnotationPage -# \subpage PersistenceConceptPage -# \subpage QVTKRendering -# Interaction -# \subpage DataInteractionPage -# \subpage InteractionPage -# \subpage LoggingPage -# \subpage ExceptionPage -# \subpage ModularizationPage "Modularization Concept" -# \ref ModularizationPageOverview -# \ref ModularizationPageHowTo If you want to start using MITK, you also want to see the chapter \ref Development. */ diff --git a/Documentation/Doxygen/3-DeveloperManual/Toolkit/ModuleManuals/MITKModuleManualsList.dox b/Documentation/Doxygen/3-DeveloperManual/Toolkit/ModuleManuals/MITKModuleManualsList.dox index 015179e6e2..97f0df66d1 100644 --- a/Documentation/Doxygen/3-DeveloperManual/Toolkit/ModuleManuals/MITKModuleManualsList.dox +++ b/Documentation/Doxygen/3-DeveloperManual/Toolkit/ModuleManuals/MITKModuleManualsList.dox @@ -1,28 +1,28 @@ /** \page MITKModuleManualsListPage MITK Module Manuals \section MITKModuleManualsListPageOverview Overview The modules are shared libraries that provide functionality that can be used by developers. \section MITKModuleManualsListPageModuleManualList List of Module Manuals \li \subpage NavigationGeneralModulePage \li \subpage MitkOpenCL_Overview \li \subpage LegacyGLModule \li \subpage GeneratingDeviceModulesPage \li \subpage mitkPython_Overview \li \subpage USModulePage - \li \subpage OverlaysModulePage + \li \subpage AnnotationModulePage \section MITKModuleManualsListPageAdditionalInformation Additional Information on Certain Modules \li \ref PlanarPropertiesPage \li \subpage DiffusionImagingPropertiesPage \li \subpage ConnectomicsRenderingPropertiesPage \section MITKMigrationGuides Migration Guides \li \subpage InteractionMigration \li \subpage GeometryMigration */ diff --git a/Modules/Annotation/doc/doxygen/OverlaysModule.dox b/Modules/Annotation/doc/doxygen/AnnotationModule.dox similarity index 83% rename from Modules/Annotation/doc/doxygen/OverlaysModule.dox rename to Modules/Annotation/doc/doxygen/AnnotationModule.dox index 282f67eed5..4d35b5bec5 100644 --- a/Modules/Annotation/doc/doxygen/OverlaysModule.dox +++ b/Modules/Annotation/doc/doxygen/AnnotationModule.dox @@ -1,82 +1,82 @@ /** -\page OverlaysModulePage Overlays and Annotations Module +\page AnnotationModulePage Overlays and Annotations Module \tableofcontents -\section OverlaysModulePage_Introduction Overlays and Annotations +\section AnnotationModulePage_Introduction Overlays and Annotations The overlays in MITK are a simple way to display additional information on the render windows. A class, deriving from mitk::Overlay represents an arbitrary 2D or 3D object that can be rendered as an overlay. This can for example be used for the annotation of 3D points or to overlay despriptions in the window corners. The mitk::OverlayManager is used to add the overlays to the renderwindows, updating them and manage the respective layout managers. The following features are implemented in this framework.
  1. Definition of graphical elements that can be displayed in the render windows.
  2. It is possible to manage multiple elements in each window.
  3. A single Overlay can be rendered on any number of available render windows.
  4. 2D and 3D textelements are already defined in the Overlay module and are using VTK to create custom annotations.
  5. The mitk::BaseLayouter interface enables the implementation of layout managers, to handle the placement of the overlays.
-\section OverlaysModulePage_ArchitectureSection General Architecture -\section OverlaysModulePage_UsageSection Usage of Predefined Overlays +\section AnnotationModulePage_ArchitectureSection General Architecture +\section AnnotationModulePage_UsageSection Usage of Predefined Overlays -\subsection OverlaysModulePage_TextWidget2DUsageSubsection mitkTextOverlay2D +\subsection AnnotationModulePage_TextWidget2DUsageSubsection mitkTextOverlay2D This exemplary overlay can render UTF-8 encoded text as a 2D Overlay. The Overlay2DLayouter can be used to automatically place a group of overlays to a specific corner. \snippet OverlayExample.cpp TextOverlay2D \snippet OverlayExample.cpp SetLayouterToOverlay -\subsection OverlaysModulePage_TextWidget3DUsageSubsection mitkTextOverlay3D +\subsection AnnotationModulePage_TextWidget3DUsageSubsection mitkTextOverlay3D This overlay displays labels in 3D coordinates. The labels always face the camera. \snippet OverlayExample.cpp TextOverlay3D -\subsection OverlaysModulePage_NotManagedSubsection Manually Managed Overlays +\subsection AnnotationModulePage_NotManagedSubsection Manually Managed Overlays In order to integrate an Overlay into an mitk::Mapper, it is advised not to use the OverlayManager but to manually manage the Overlay. To do so, the update methods of the overlays have to be called manually before the start of each rendering procedure. It must only be called if the Properties have changed or if your custom overlay implements its own rendering mechanism. -\section OverlaysModulePage_CustomOverlaySection Implement a Custom Overlay +\section AnnotationModulePage_CustomOverlaySection Implement a Custom Overlay A new custom Overlay should derive from mitkOverlay or one of the later mentioned subclasses VtkOverlay2D oder VtkOverlay3D. There should always be an implementation for the methods AddOverlay, RemoveOverlay and Update Overlay. UpdateOverlay is the procedure that is called in each rendering step. If the Overlay is rendered by VTK, this method only applies the properties to the representation. If the custom Overlay requires additional properties, they should be made accessible by getters and setters for a better usability: \code void mitk::VtkOverlay3D::SetPosition3D(Point3D position3D, mitk::BaseRenderer *renderer) { mitk::Point3dProperty::Pointer position3dProperty = mitk::Point3dProperty::New(position3D); SetProperty("Position3D", position3dProperty,renderer); } mitk::Point3D mitk::VtkOverlay3D::GetPosition3D(mitk::BaseRenderer *renderer) { mitk::Point3D position3D; GetPropertyValue("Position3D", position3D, renderer); return position3D; } \endcode -\subsection OverlaysModulePage_CustomVTK2DOverlaySubsection VTK 2D Overlay +\subsection AnnotationModulePage_CustomVTK2DOverlaySubsection VTK 2D Overlay VTK based overlays which are meant to be displayed in 2D over the render window should derive from the mitk::VtkOverlay2D. The mitk::VtkOverlay2D is a subclass of Vtk::Overlay, that uses VTK to render the overlay. This class creates the Overlay representation as a vtkActor2D, and is very easy to implement because only UpdateVtkOverlay2D and GetVtkActor2D have to be implemented. The add, update and remove methods are implemented in the superclasses. UpdateVtkOverlay2D only needs to apply the specific properties and GetVtkActor2D simply returns the created vtkActor. -\subsection OverlaysModulePage_CustomVTK3DOverlaySubsection VTK 3D Overlay +\subsection AnnotationModulePage_CustomVTK3DOverlaySubsection VTK 3D Overlay The mitkVtkOverlay3D works just like mitkVtkOverlay2D, but it is designed for arbitrary 3D objects which derive from vtkProp, -\section OverlaysModulePage_CustomLayouterSection Implement a Custom Layouter +\section AnnotationModulePage_CustomLayouterSection Implement a Custom Layouter A Layouter is used for an automatic positioning of a group of Overlays and is derived from mitkBaseLayouter. Every Layouter that manages a group of Layouts should have a unique identifier which is used to register the Layouter in the OverlayManager. A Layouter is always uniquely defined by the identifier and one BaseRenderer. Before a Layouter can be used by the OverlayManager it has to be added, using the AddLayouter Method. An Overlay can then be added to a Layout as follows: \code overlayManager->SetLayouter(textOverlay.GetPointer(),mitk::Overlay2DLayouter::STANDARD_2D_TOPLEFT,axialRenderer); \endcode A new Layouter has to implement PrepareLayout which should parse the internal Overlay list and set their position as required. */ diff --git a/Modules/Annotation/include/mitkLayoutAnnotationRenderer.h b/Modules/Annotation/include/mitkLayoutAnnotationRenderer.h index a7715f4244..7b2059ca33 100644 --- a/Modules/Annotation/include/mitkLayoutAnnotationRenderer.h +++ b/Modules/Annotation/include/mitkLayoutAnnotationRenderer.h @@ -1,103 +1,107 @@ /*=================================================================== 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 LayoutAnnotationRenderer_H #define LayoutAnnotationRenderer_H #include "MitkAnnotationExports.h" #include "mitkAbstractAnnotationRenderer.h" namespace mitk { class BaseRenderer; - /** \brief The LayoutAnnotationRenderer updates and manages Annotation and the respective Layouters. */ - /** An Instance of the LayoutAnnotationRenderer can be registered to several BaseRenderer instances in order to - * call the update method of each Annotation during the rendering phase of the renderer. + /** \brief The LayoutAnnotationRenderer is used for the layouted placement of mitk::Annotation Objects. + * + * An instance of this service is registered for a specific Baserenderer and is used to manage all annotations which + * are added to it. + * The static function AddAnnotation is used to register an annotation to a specific service and to create this + * service if it does not exist yet. The position of the layouted annotation can be passed as a parameter. + * * See \ref AnnotationPage for more info. - */ + **/ class MITKANNOTATION_EXPORT LayoutAnnotationRenderer : public AbstractAnnotationRenderer { public: static const std::string PROP_LAYOUT; static const std::string PROP_LAYOUT_PRIORITY; static const std::string PROP_LAYOUT_ALIGNMENT; static const std::string PROP_LAYOUT_MARGIN; enum Alignment { TopLeft, Top, TopRight, BottomLeft, Bottom, BottomRight, Left, Right }; typedef std::multimap AnnotationRankedMap; typedef std::map AnnotationLayouterContainerMap; /** \brief virtual destructor in order to derive from this class */ virtual ~LayoutAnnotationRenderer(); const std::string GetID() const; static LayoutAnnotationRenderer *GetAnnotationRenderer(const std::string &rendererID); void OnRenderWindowModified(); static void AddAnnotation(Annotation *annotation, const std::string &rendererID, Alignment alignment = TopLeft, double marginX = 5, double marginY = 5, int priority = -1); static void AddAnnotation(Annotation *annotation, BaseRenderer *renderer, Alignment alignment = TopLeft, double marginX = 5, double marginY = 5, int priority = -1); void PrepareLayout(); private: LayoutAnnotationRenderer(const std::string &rendererId); static void AddAlignmentProperty(Annotation *annotation, Alignment activeAlignment, Point2D margin, int priority); void PrepareTopLeftLayout(int *displaySize); void PrepareTopLayout(int *displaySize); void PrepareTopRightLayout(int *displaySize); void PrepareBottomLeftLayout(int *displaySize); void PrepareBottomLayout(int *displaySize); void PrepareBottomRightLayout(int *displaySize); void PrepareLeftLayout(int *displaySize); void PrepareRightLayout(int *displaySize); static double GetHeight(AnnotationRankedMap &annotations, BaseRenderer *renderer); virtual void OnAnnotationRenderersChanged(); static const std::string ANNOTATIONRENDERER_ID; AnnotationLayouterContainerMap m_AnnotationContainerMap; static void SetMargin2D(Annotation *annotation, const Point2D &OffsetVector); static Point2D GetMargin2D(Annotation *annotation); }; } // namespace mitk #endif // LayoutAnnotationRenderer_H diff --git a/Modules/Annotation/include/mitkManualPlacementAnnotationRenderer.h b/Modules/Annotation/include/mitkManualPlacementAnnotationRenderer.h index a24a6a2f57..b25410768e 100644 --- a/Modules/Annotation/include/mitkManualPlacementAnnotationRenderer.h +++ b/Modules/Annotation/include/mitkManualPlacementAnnotationRenderer.h @@ -1,54 +1,57 @@ /*=================================================================== 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 ManualPlacementAnnotationRenderer_H #define ManualPlacementAnnotationRenderer_H #include "MitkAnnotationExports.h" #include "mitkAbstractAnnotationRenderer.h" #include "mitkAnnotation.h" namespace mitk { class BaseRenderer; - /** \brief The ManualPlacementAnnotationRenderer updates and manages Annotation and the respective Layouters. */ - /** An Instance of the ManualPlacementAnnotationRenderer can be registered to several BaseRenderer instances in order - * to - * call the update method of each Annotation during the rendering phase of the renderer. + /** \brief The ManualPlacementAnnotationRenderer is used for the simple placement of mitk::Annotation Objects. + * + * An instance of this service is registered for a specific Baserenderer and is used to manage all annotations which + * are added to it. + * The static function AddAnnotation is used to register an annotation to a specific service and to create this + * service if it does not exist yet. + * * See \ref AnnotationPage for more info. - */ + **/ class MITKANNOTATION_EXPORT ManualPlacementAnnotationRenderer : public AbstractAnnotationRenderer { public: /** \brief virtual destructor in order to derive from this class */ virtual ~ManualPlacementAnnotationRenderer(); static ManualPlacementAnnotationRenderer *GetAnnotationRenderer(const std::string &rendererID); static void AddAnnotation(Annotation *Annotation, const std::string &rendererID); static void AddAnnotation(Annotation *Annotation, BaseRenderer *renderer); private: ManualPlacementAnnotationRenderer(const std::string &rendererId); static const std::string ANNOTATIONRENDERER_ID; }; } // namespace mitk #endif // ManualPlacementAnnotationRenderer_H diff --git a/Modules/Core/include/mitkAbstractAnnotationRenderer.h b/Modules/Core/include/mitkAbstractAnnotationRenderer.h index c6fd0ee76d..8747bb0b7d 100644 --- a/Modules/Core/include/mitkAbstractAnnotationRenderer.h +++ b/Modules/Core/include/mitkAbstractAnnotationRenderer.h @@ -1,88 +1,82 @@ /*=================================================================== * 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 ABSTRACTANNOTATIONRENDERER_H #define ABSTRACTANNOTATIONRENDERER_H #include "mitkAnnotation.h" #include "mitkServiceInterface.h" #include "usGetModuleContext.h" #include "usServiceTracker.h" #include #include namespace mitk { class BaseRenderer; - /** @brief Baseclass of Annotation layouters */ - /** - *A AbstractAnnotationRenderer can be implemented to control a set of Annotation by means of position and size. - *AbstractAnnotationRenderer::PrepareLayout() should be implemented with a routine to set the position of the internal - *m_ManagedAnnotation List. - *A layouter is always connected to one BaseRenderer, so there is one instance of the layouter for each BaseRenderer. - *One type of layouter should always have a unique identifier. - *@ingroup Annotation + /** @brief Baseclass of Annotation layouters + * An AbstractAnnotationRenderer can be implemented to control a set of Annotation by means of position and size. + * @ingroup Annotation */ class MITKCORE_EXPORT AbstractAnnotationRenderer : public us::ServiceTracker { public: typedef us::ServiceTracker Superclass; AbstractAnnotationRenderer(const std::string &rendererID, const std::string &arID); /** \brief virtual destructor in order to derive from this class */ virtual ~AbstractAnnotationRenderer(); const std::string GetID() const; const std::string GetRendererID() const; void CurrentBaseRendererChanged(); virtual void OnRenderWindowModified() {} void RemoveAllAnnotation(); void Update(); - static const std::string US_INTERFACE_NAME; static const std::string US_PROPKEY_ID; static const std::string US_PROPKEY_RENDERER_ID; protected: BaseRenderer *GetCurrentBaseRenderer(); private: /** \brief copy constructor */ AbstractAnnotationRenderer(const AbstractAnnotationRenderer &); /** \brief assignment operator */ AbstractAnnotationRenderer &operator=(const AbstractAnnotationRenderer &); TrackedType AddingService(const ServiceReferenceType &reference) override; void ModifiedService(const ServiceReferenceType & /*reference*/, TrackedType tracked) override; void RemovedService(const ServiceReferenceType & /*reference*/, TrackedType tracked) override; virtual void OnAnnotationRenderersChanged() {} const std::string m_RendererID; const std::string m_ID; }; } // namespace mitk MITK_DECLARE_SERVICE_INTERFACE(mitk::AbstractAnnotationRenderer, "org.mitk.services.AbstractAnnotationRenderer") #endif // ABSTRACTANNOTATIONRENDERER_H diff --git a/Modules/Core/include/mitkAnnotation.h b/Modules/Core/include/mitkAnnotation.h index d0415a0e4d..0c8b1f4ef3 100644 --- a/Modules/Core/include/mitkAnnotation.h +++ b/Modules/Core/include/mitkAnnotation.h @@ -1,470 +1,462 @@ /*=================================================================== 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 Annotation_H #define Annotation_H #include "mitkServiceInterface.h" #include "usServiceRegistration.h" #include #include #include namespace mitk { - class AbstractAnnotationLayouter; - - /** \brief Base class for all Annotation */ - /** This class is to be implemented in order to create Annotation which are managed by the AnnotationManager and can be - placed by a AbstractAnnotationLayouter. - This class contains an internal Propertylist, and another PropertyList for each BaseRenderer. - A property that is specified for a specific renderer always overrides the general internal property of the same name. - AddAnnotation, RemoveAnnotation and UpdateAnnotation methods have to be implemented.*/ + /** \brief Base class for all Annotation + * This class is to be implemented in order to create Annotation which are managed by a AbstractAnnotationRenderer. + * This class contains an internal Propertylist for configuring the appearance of the implemented Overlay. */ class MITKCORE_EXPORT Annotation : public itk::Object { - friend class AbstractAnnotationLayouter; - public: /** \brief Container for position and size on the display.*/ struct Bounds { itk::Point Position; itk::Point Size; }; /** \brief Base class for mapper specific rendering ressources. */ class MITKCORE_EXPORT BaseLocalStorage { public: bool IsGenerateDataRequired(mitk::BaseRenderer *renderer, mitk::Annotation *Annotation); inline void UpdateGenerateDataTime() { m_LastGenerateDataTime.Modified(); } inline itk::TimeStamp &GetLastGenerateDataTime() { return m_LastGenerateDataTime; } protected: /** \brief timestamp of last update of stored data */ itk::TimeStamp m_LastGenerateDataTime; }; /** * @brief Set the property (instance of BaseProperty) with key @a propertyKey in the PropertyList * of the @a renderer (if NULL, use BaseRenderer-independent PropertyList). This is set-by-value. * * @warning Change in semantics since Aug 25th 2006. Check your usage of this method if you do * more with properties than just call SetProperty( "key", new SomeProperty("value") ). * * @sa GetProperty * @sa m_PropertyList * @sa m_MapOfPropertyLists */ void SetProperty(const std::string &propertyKey, const BaseProperty::Pointer &property); /** * @brief Replace the property (instance of BaseProperty) with key @a propertyKey in the PropertyList * of the @a renderer (if NULL, use BaseRenderer-independent PropertyList). This is set-by-reference. * * If @a renderer is @a NULL the property is set in the BaseRenderer-independent * PropertyList of this Annotation. * @sa GetProperty * @sa m_PropertyList * @sa m_MapOfPropertyLists */ void ReplaceProperty(const std::string &propertyKey, const BaseProperty::Pointer &property); /** * @brief Add the property (instance of BaseProperty) if it does * not exist (or always if \a overwrite is \a true) * with key @a propertyKey in the PropertyList * of the @a renderer (if NULL, use BaseRenderer-independent * PropertyList). This is set-by-value. * * For \a overwrite == \a false the property is \em not changed * if it already exists. For \a overwrite == \a true the method * is identical to SetProperty. * * @sa SetProperty * @sa GetProperty * @sa m_PropertyList * @sa m_MapOfPropertyLists */ void AddProperty(const std::string &propertyKey, const BaseProperty::Pointer &property, bool overwrite = false); /** * @brief Add values from another PropertyList. * * Overwrites values in m_PropertyList only when possible (i.e. when types are compatible). * If you want to allow for object type changes (replacing a "visible":BoolProperty with "visible":IntProperty, * set the @param replace. * * @param replace true: if @param pList contains a property "visible" of type ColorProperty and our m_PropertyList * also has a "visible" property of a different type (e.g. BoolProperty), change the type, i.e. replace the objects * behind the pointer. * * @sa SetProperty * @sa ReplaceProperty * @sa m_PropertyList */ void ConcatenatePropertyList(PropertyList *pList, bool replace = false); /** * @brief Get the property (instance of BaseProperty) with key @a propertyKey from the PropertyList * of the @a renderer, if available there, otherwise use the BaseRenderer-independent PropertyList. * * If @a renderer is @a NULL or the @a propertyKey cannot be found * in the PropertyList specific to @a renderer or is disabled there, the BaseRenderer-independent * PropertyList of this Annotation is queried. * @sa GetPropertyList * @sa m_PropertyList * @sa m_MapOfPropertyLists */ mitk::BaseProperty *GetProperty(const std::string &propertyKey) const; /** * @brief Get the property of type T with key @a propertyKey from the PropertyList * of the @a renderer, if available there, otherwise use the BaseRenderer-independent PropertyList. * * If @a renderer is @a NULL or the @a propertyKey cannot be found * in the PropertyList specific to @a renderer or is disabled there, the BaseRenderer-independent * PropertyList of this Annotation is queried. * @sa GetPropertyList * @sa m_PropertyList * @sa m_MapOfPropertyLists */ template bool GetProperty(itk::SmartPointer &property, const std::string &propertyKey) const { property = dynamic_cast(GetProperty(propertyKey)); return property.IsNotNull(); } /** * @brief Get the property of type T with key @a propertyKey from the PropertyList * of the @a renderer, if available there, otherwise use the BaseRenderer-independent PropertyList. * * If @a renderer is @a NULL or the @a propertyKey cannot be found * in the PropertyList specific to @a renderer or is disabled there, the BaseRenderer-independent * PropertyList of this Annotation is queried. * @sa GetPropertyList * @sa m_PropertyList * @sa m_MapOfPropertyLists */ template bool GetProperty(T *&property, const std::string &propertyKey) const { property = dynamic_cast(GetProperty(propertyKey)); return property != nullptr; } /** * @brief Convenience access method for GenericProperty properties * (T being the type of the second parameter) * @return @a true property was found */ template bool GetPropertyValue(const std::string &propertyKey, T &value) const { GenericProperty *gp = dynamic_cast *>(GetProperty(propertyKey)); if (gp != nullptr) { value = gp->GetValue(); return true; } return false; } /** * @brief Convenience access method for bool properties (instances of * BoolProperty) * @return @a true property was found */ bool GetBoolProperty(const std::string &propertyKey, bool &boolValue) const; /** * @brief Convenience access method for int properties (instances of * IntProperty) * @return @a true property was found */ bool GetIntProperty(const std::string &propertyKey, int &intValue) const; /** * @brief Convenience access method for float properties (instances of * FloatProperty) * @return @a true property was found */ bool GetFloatProperty(const std::string &propertyKey, float &floatValue) const; /** * @brief Convenience access method for double properties (instances of * DoubleProperty) * @return @a true property was found */ bool GetDoubleProperty(const std::string &propertyKey, double &doubleValue) const; /** * @brief Convenience access method for string properties (instances of * StringProperty) * @return @a true property was found */ bool GetStringProperty(const std::string &propertyKey, std::string &string) const; /** * @brief Convenience method for setting int properties (instances of * IntProperty) */ void SetIntProperty(const std::string &propertyKey, int intValue); /** * @brief Convenience method for setting int properties (instances of * IntProperty) */ void SetBoolProperty(const std::string &propertyKey, bool boolValue); /** * @brief Convenience method for setting int properties (instances of * IntProperty) */ void SetFloatProperty(const std::string &propertyKey, float floatValue); /** * @brief Convenience method for setting int properties (instances of * IntProperty) */ void SetDoubleProperty(const std::string &propertyKey, double doubleValue); /** * @brief Convenience method for setting int properties (instances of * IntProperty) */ void SetStringProperty(const std::string &propertyKey, const std::string &string); /** * @brief Convenience access method for boolean properties (instances * of BoolProperty). Return value is the value of the property. If the property is * not found, the value of @a defaultIsOn is returned. * * Thus, the return value has a different meaning than in the * GetBoolProperty method! * @sa GetBoolProperty */ bool IsOn(const std::string &propertyKey, bool defaultIsOn = true) const { GetBoolProperty(propertyKey, defaultIsOn); return defaultIsOn; } /** * @brief Convenience access method for accessing the name of an object (instance of * StringProperty with property-key "name") * @return @a true property was found */ bool GetName(std::string &nodeName, const std::string &propertyKey = "name") const; /** * @brief Extra convenience access method for accessing the name of an object (instance of * StringProperty with property-key "name"). * * This method does not take the renderer specific * propertylists into account, because the name of an object should never be renderer specific. * @returns a std::string with the name of the object (content of "name" Property). * If there is no "name" Property, an empty string will be returned. */ virtual std::string GetName() const; /** * @brief Extra convenience access method to set the name of an object. * * The name will be stored in the non-renderer-specific PropertyList in a StringProperty named "name". */ virtual void SetName(const std::string &name); /** * @brief Convenience access method for color properties (instances of * ColorProperty) * @return @a true property was found */ bool GetColor(float rgb[], const std::string &propertyKey = "color") const; /** * @brief Convenience method for setting color properties (instances of * ColorProperty) */ void SetColor(const mitk::Color &color, const std::string &propertyKey = "color"); /** * @brief Convenience method for setting color properties (instances of * ColorProperty) */ void SetColor(float red, float green, float blue, const std::string &propertyKey = "color"); /** * @brief Convenience method for setting color properties (instances of * ColorProperty) */ void SetColor(const float rgb[], const std::string &propertyKey = "color"); /** * @brief Convenience access method for opacity properties (instances of * FloatProperty) * @return @a true property was found */ bool GetOpacity(float &opacity, const std::string &propertyKey = "opacity") const; /** * @brief Convenience method for setting opacity properties (instances of * FloatProperty) */ void SetOpacity(float opacity, const std::string &propertyKey = "opacity"); void SetText(std::string text); std::string GetText() const; void SetFontSize(int fontSize); int GetFontSize() const; /** * @brief Convenience access method for visibility properties (instances * of BoolProperty with property-key "visible") * @return @a true property was found * @sa IsVisible */ bool GetVisibility(bool &visible, const std::string &propertyKey = "visible") const; /** * @brief Convenience access method for visibility properties (instances * of BoolProperty). Return value is the visibility. Default is * visible==true, i.e., true is returned even if the property (@a * propertyKey) is not found. * * Thus, the return value has a different meaning than in the * GetVisibility method! * @sa GetVisibility * @sa IsOn */ bool IsVisible(const std::string &propertyKey = "visible", bool defaultIsOn = true) const; /** * @brief Convenience method for setting visibility properties (instances * of BoolProperty) * @param visible If set to true, the data will be rendered. If false, the render will skip this data. * @param renderer Specify a renderer if the visibility shall be specific to a renderer * @param propertykey Can be used to specify a user defined name of the visibility propery. */ void SetVisibility(bool visible, const std::string &propertyKey = "visible"); - /** \brief Adds the Annotation to the specified renderer. Update Annotation should be called soon in order to apply all + /** \brief Adds the Annotation to the specified renderer. Update Annotation should be called soon in order to apply + * all * properties*/ virtual void AddToBaseRenderer(BaseRenderer *renderer) = 0; - /** \brief Adds the Annotation to the specified renderer. Update Annotation should be called soon in order to apply all + /** \brief Adds the Annotation to the specified renderer. Update Annotation should be called soon in order to apply + * all * properties*/ virtual void AddToRenderer(BaseRenderer *renderer, vtkRenderer *vtkrenderer) = 0; /** \brief Removes the Annotation from the specified renderer. It is not visible anymore then.*/ virtual void RemoveFromBaseRenderer(BaseRenderer *renderer) = 0; /** \brief Removes the Annotation from the specified renderer. It is not visible anymore then.*/ virtual void RemoveFromRenderer(BaseRenderer *renderer, vtkRenderer *vtkrenderer) = 0; /** \brief Applies all properties and should be called before the rendering procedure.*/ virtual void Update(BaseRenderer *renderer) = 0; /** \brief Returns position and size of the Annotation on the display.*/ virtual Bounds GetBoundsOnDisplay(BaseRenderer *renderer) const; /** \brief Sets position and size of the Annotation on the display.*/ virtual void SetBoundsOnDisplay(BaseRenderer *renderer, const Bounds &); void SetForceInForeground(bool forceForeground); bool IsForceInForeground() const; PropertyList *GetPropertyList() const; /** *\brief Returns the id that this device is registered with. The id will only be valid, if the * Annotation has been registered using RegisterAsMicroservice(). */ std::string GetMicroserviceID(); /** *\brief These Constants are used in conjunction with Microservices */ static const std::string US_INTERFACE_NAME; static const std::string US_PROPKEY_AnnotationNAME; static const std::string US_PROPKEY_ID; static const std::string US_PROPKEY_MODIFIED; static const std::string US_PROPKEY_RENDERER_ID; static const std::string US_PROPKEY_AR_ID; /** *\brief Registers this object as a Microservice, making it available to every module and/or plugin. * To unregister, call UnregisterMicroservice(). */ virtual void RegisterAsMicroservice(us::ServiceProperties props); /** *\brief Registers this object as a Microservice, making it available to every module and/or plugin. */ virtual void UnRegisterMicroservice(); void AnnotationModified(); mitkClassMacroItkParent(Annotation, itk::Object); protected: /** \brief explicit constructor which disallows implicit conversions */ Annotation(); /** \brief virtual destructor in order to derive from this class */ virtual ~Annotation(); /** * @brief BaseRenderer-independent PropertyList * * Properties herein can be overwritten specifically for each BaseRenderer * by the BaseRenderer-specific properties defined in m_MapOfPropertyLists. */ PropertyList::Pointer m_PropertyList; /** * @brief Timestamp of the last change of m_Data */ itk::TimeStamp m_DataReferenceChangedTime; void SetUSProperty(const std::string &propertyKey, us::Any value); private: /** \brief render this Annotation on a foreground renderer */ bool m_ForceInForeground; /** \brief copy constructor */ Annotation(const Annotation &); /** \brief assignment operator */ Annotation &operator=(const Annotation &); - /** \brief Reference to the layouter in which this Annotation is managed. */ - AbstractAnnotationLayouter *m_LayoutedBy; - private: us::ServiceRegistration m_ServiceRegistration; unsigned long m_PropertyListModifiedObserverTag; void PropertyListModified(const itk::Object *, const itk::EventObject &); }; } // namespace mitk MITK_DECLARE_SERVICE_INTERFACE(mitk::Annotation, "org.mitk.services.Annotation") #endif // Annotation_H diff --git a/Modules/Core/include/mitkAnnotationUtils.h b/Modules/Core/include/mitkAnnotationUtils.h index 9024138a09..ee4a42f2cf 100644 --- a/Modules/Core/include/mitkAnnotationUtils.h +++ b/Modules/Core/include/mitkAnnotationUtils.h @@ -1,60 +1,95 @@ /*=================================================================== 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 mitkAnnotationUtils_h #define mitkAnnotationUtils_h #include #include #include class vtkObject; namespace mitk { class AbstractAnnotationRenderer; class Annotation; class BaseRenderer; + /** + * @brief The AnnotationUtils class provides static functions for accsessing registered AnnotationRenderers and + * Annotations + */ class MITKCORE_EXPORT AnnotationUtils { public: typedef std::vector> AnnotationRendererServices; AnnotationUtils(); ~AnnotationUtils(); + /** + * @brief GetAnnotationRenderer returns a registered AnnotationRenderer of a specific type and for a BaseRenderer + * @param arTypeID name specifier of the AnnotationRenderer + * @param rendererID name specifier of the BaseRenderer + * @return + */ static AbstractAnnotationRenderer *GetAnnotationRenderer(const std::string &arTypeID, const std::string &rendererID); + /** + * @brief RegisterAnnotationRenderer registers an AnnotationRenderer as a microservice and saves a reference to it + * in a local static list. + * @param annotationRenderer + */ static void RegisterAnnotationRenderer(AbstractAnnotationRenderer *annotationRenderer); + /** + * @brief GetAnnotationRenderer returns a list of registered AnnotationRenderers for a specified BaseRenderer + * @param rendererID name specifier of the BaseRenderer + * @return + */ static std::vector GetAnnotationRenderer(const std::string &rendererID); + /** + * @brief UpdateAnnotationRenderer is a convenience function which calls AbstractAnnotationRenderer::Update for each + * registered AnnotationRenderer of a specific BaseRenderer. + * @param rendererID + */ static void UpdateAnnotationRenderer(const std::string &rendererID); + /** + * @brief BaseRendererChanged has to be called in the case that the actual BaseRenderer object for a BaseRenderer ID + * has changed. E.g. if a RenderWindow was closed and reopened. + * @param renderer The new BaseRenderer + */ static void BaseRendererChanged(BaseRenderer *renderer); + /** + * @brief GetAnnotation returns a registered Annotation for a specified ID. + * @param AnnotationID + * @return + */ static mitk::Annotation *GetAnnotation(const std::string &AnnotationID); private: AnnotationUtils(const AnnotationUtils &); AnnotationUtils &operator=(const AnnotationUtils &); static void RenderWindowCallback(vtkObject *caller, unsigned long, void *, void *); }; } #endif diff --git a/Modules/Core/src/Rendering/mitkAnnotation.cpp b/Modules/Core/src/Rendering/mitkAnnotation.cpp index a05287025f..11c25b95e0 100644 --- a/Modules/Core/src/Rendering/mitkAnnotation.cpp +++ b/Modules/Core/src/Rendering/mitkAnnotation.cpp @@ -1,350 +1,352 @@ /*=================================================================== 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. ===================================================================*/ #include "mitkAnnotation.h" #include "usGetModuleContext.h" const std::string mitk::Annotation::US_INTERFACE_NAME = "org.mitk.services.Annotation"; const std::string mitk::Annotation::US_PROPKEY_AnnotationNAME = US_INTERFACE_NAME + ".name"; const std::string mitk::Annotation::US_PROPKEY_ID = US_INTERFACE_NAME + ".id"; const std::string mitk::Annotation::US_PROPKEY_MODIFIED = US_INTERFACE_NAME + ".modified"; const std::string mitk::Annotation::US_PROPKEY_RENDERER_ID = US_INTERFACE_NAME + ".rendererId"; const std::string mitk::Annotation::US_PROPKEY_AR_ID = US_INTERFACE_NAME + ".arId"; -mitk::Annotation::Annotation() : m_LayoutedBy(nullptr), m_PropertyListModifiedObserverTag(0) +mitk::Annotation::Annotation() : m_PropertyListModifiedObserverTag(0) { m_PropertyList = mitk::PropertyList::New(); - itk::MemberCommand::Pointer _PropertyListModifiedCommand = itk::MemberCommand::New(); + itk::MemberCommand::Pointer _PropertyListModifiedCommand = + itk::MemberCommand::New(); _PropertyListModifiedCommand->SetCallbackFunction(this, &mitk::Annotation::PropertyListModified); m_PropertyListModifiedObserverTag = m_PropertyList->AddObserver(itk::ModifiedEvent(), _PropertyListModifiedCommand); this->SetName(this->GetNameOfClass()); this->SetVisibility(true); this->SetOpacity(1.0); } void mitk::Annotation::PropertyListModified(const itk::Object * /*caller*/, const itk::EventObject &) { AnnotationModified(); } mitk::Annotation::~Annotation() { this->UnRegisterMicroservice(); } void mitk::Annotation::SetUSProperty(const std::string &propertyKey, us::Any value) { if (this->m_ServiceRegistration) { us::ServiceProperties props; std::vector propertyKeys; m_ServiceRegistration.GetReference().GetPropertyKeys(propertyKeys); for (std::string key : propertyKeys) { props[key] = m_ServiceRegistration.GetReference().GetProperty(key); } props[propertyKey] = value; m_ServiceRegistration.SetProperties(props); } } void mitk::Annotation::SetProperty(const std::string &propertyKey, const BaseProperty::Pointer &propertyValue) { this->m_PropertyList->SetProperty(propertyKey, propertyValue); } void mitk::Annotation::ReplaceProperty(const std::string &propertyKey, const BaseProperty::Pointer &propertyValue) { this->m_PropertyList->ReplaceProperty(propertyKey, propertyValue); } void mitk::Annotation::AddProperty(const std::string &propertyKey, - const BaseProperty::Pointer &propertyValue, - bool overwrite) + const BaseProperty::Pointer &propertyValue, + bool overwrite) { if ((overwrite) || (GetProperty(propertyKey) == NULL)) { SetProperty(propertyKey, propertyValue); } } void mitk::Annotation::ConcatenatePropertyList(PropertyList *pList, bool replace) { m_PropertyList->ConcatenatePropertyList(pList, replace); } mitk::BaseProperty *mitk::Annotation::GetProperty(const std::string &propertyKey) const { mitk::BaseProperty::Pointer property = m_PropertyList->GetProperty(propertyKey); if (property.IsNotNull()) return property; // only to satisfy compiler! return NULL; } bool mitk::Annotation::GetBoolProperty(const std::string &propertyKey, bool &boolValue) const { mitk::BoolProperty::Pointer boolprop = dynamic_cast(GetProperty(propertyKey)); if (boolprop.IsNull()) return false; boolValue = boolprop->GetValue(); return true; } bool mitk::Annotation::GetIntProperty(const std::string &propertyKey, int &intValue) const { mitk::IntProperty::Pointer intprop = dynamic_cast(GetProperty(propertyKey)); if (intprop.IsNull()) return false; intValue = intprop->GetValue(); return true; } bool mitk::Annotation::GetFloatProperty(const std::string &propertyKey, float &floatValue) const { mitk::FloatProperty::Pointer floatprop = dynamic_cast(GetProperty(propertyKey)); if (floatprop.IsNull()) return false; floatValue = floatprop->GetValue(); return true; } bool mitk::Annotation::GetStringProperty(const std::string &propertyKey, std::string &string) const { mitk::StringProperty::Pointer stringProp = dynamic_cast(GetProperty(propertyKey)); if (stringProp.IsNull()) { return false; } else { // memcpy((void*)string, stringProp->GetValue(), strlen(stringProp->GetValue()) + 1 ); // looks dangerous string = stringProp->GetValue(); return true; } } void mitk::Annotation::SetIntProperty(const std::string &propertyKey, int intValue) { this->m_PropertyList->SetProperty(propertyKey, mitk::IntProperty::New(intValue)); Modified(); } void mitk::Annotation::SetBoolProperty(const std::string &propertyKey, bool boolValue) { this->m_PropertyList->SetProperty(propertyKey, mitk::BoolProperty::New(boolValue)); Modified(); } void mitk::Annotation::SetFloatProperty(const std::string &propertyKey, float floatValue) { this->m_PropertyList->SetProperty(propertyKey, mitk::FloatProperty::New(floatValue)); Modified(); } void mitk::Annotation::SetDoubleProperty(const std::string &propertyKey, double doubleValue) { this->m_PropertyList->SetProperty(propertyKey, mitk::DoubleProperty::New(doubleValue)); Modified(); } void mitk::Annotation::SetStringProperty(const std::string &propertyKey, const std::string &stringValue) { this->m_PropertyList->SetProperty(propertyKey, mitk::StringProperty::New(stringValue)); Modified(); } std::string mitk::Annotation::GetName() const { mitk::StringProperty *sp = dynamic_cast(this->GetProperty("name")); if (sp == NULL) return ""; return sp->GetValue(); } void mitk::Annotation::SetName(const std::string &name) { this->SetStringProperty("name", name); } bool mitk::Annotation::GetName(std::string &nodeName, const std::string &propertyKey) const { return GetStringProperty(propertyKey, nodeName); } void mitk::Annotation::SetText(std::string text) { SetStringProperty("Text", text.c_str()); } std::string mitk::Annotation::GetText() const { std::string text; GetStringProperty("Text", text); return text; } void mitk::Annotation::SetFontSize(int fontSize) { SetIntProperty("FontSize", fontSize); } int mitk::Annotation::GetFontSize() const { int fontSize = 1; GetIntProperty("FontSize", fontSize); return fontSize; } bool mitk::Annotation::GetVisibility(bool &visible, const std::string &propertyKey) const { return GetBoolProperty(propertyKey, visible); } bool mitk::Annotation::IsVisible(const std::string &propertyKey, bool defaultIsOn) const { return IsOn(propertyKey, defaultIsOn); } bool mitk::Annotation::GetColor(float rgb[], const std::string &propertyKey) const { mitk::ColorProperty::Pointer colorprop = dynamic_cast(GetProperty(propertyKey)); if (colorprop.IsNull()) return false; memcpy(rgb, colorprop->GetColor().GetDataPointer(), 3 * sizeof(float)); return true; } void mitk::Annotation::SetColor(const mitk::Color &color, const std::string &propertyKey) { mitk::ColorProperty::Pointer prop; prop = mitk::ColorProperty::New(color); this->m_PropertyList->SetProperty(propertyKey, prop); } void mitk::Annotation::SetColor(float red, float green, float blue, const std::string &propertyKey) { float color[3]; color[0] = red; color[1] = green; color[2] = blue; SetColor(color, propertyKey); } void mitk::Annotation::SetColor(const float rgb[], const std::string &propertyKey) { mitk::ColorProperty::Pointer prop; prop = mitk::ColorProperty::New(rgb); this->m_PropertyList->SetProperty(propertyKey, prop); } bool mitk::Annotation::GetOpacity(float &opacity, const std::string &propertyKey) const { mitk::FloatProperty::Pointer opacityprop = dynamic_cast(GetProperty(propertyKey)); if (opacityprop.IsNull()) return false; opacity = opacityprop->GetValue(); return true; } void mitk::Annotation::SetOpacity(float opacity, const std::string &propertyKey) { mitk::FloatProperty::Pointer prop; prop = mitk::FloatProperty::New(opacity); this->m_PropertyList->SetProperty(propertyKey, prop); } void mitk::Annotation::SetVisibility(bool visible, const std::string &propertyKey) { mitk::BoolProperty::Pointer prop; prop = mitk::BoolProperty::New(visible); this->m_PropertyList->SetProperty(propertyKey, prop); Modified(); } -bool mitk::Annotation::BaseLocalStorage::IsGenerateDataRequired(mitk::BaseRenderer *renderer, mitk::Annotation *Annotation) +bool mitk::Annotation::BaseLocalStorage::IsGenerateDataRequired(mitk::BaseRenderer *renderer, + mitk::Annotation *Annotation) { if (m_LastGenerateDataTime < Annotation->GetMTime()) return true; if (m_LastGenerateDataTime < Annotation->GetPropertyList()->GetMTime()) return true; if (renderer && m_LastGenerateDataTime < renderer->GetTimeStepUpdateTime()) return true; return false; } mitk::Annotation::Bounds mitk::Annotation::GetBoundsOnDisplay(mitk::BaseRenderer *) const { mitk::Annotation::Bounds bounds; bounds.Position[0] = bounds.Position[1] = bounds.Size[0] = bounds.Size[1] = 0; return bounds; } void mitk::Annotation::SetBoundsOnDisplay(mitk::BaseRenderer *, const mitk::Annotation::Bounds &) { } void mitk::Annotation::SetForceInForeground(bool forceForeground) { m_ForceInForeground = forceForeground; } bool mitk::Annotation::IsForceInForeground() const { return m_ForceInForeground; } mitk::PropertyList *mitk::Annotation::GetPropertyList() const { return m_PropertyList; } std::string mitk::Annotation::GetMicroserviceID() { return this->m_ServiceRegistration.GetReference().GetProperty(US_PROPKEY_ID).ToString(); } void mitk::Annotation::RegisterAsMicroservice(us::ServiceProperties props) { if (m_ServiceRegistration != NULL) m_ServiceRegistration.Unregister(); us::ModuleContext *context = us::GetModuleContext(); // Define ServiceProps mitk::UIDGenerator uidGen = mitk::UIDGenerator("org.mitk.services.Annotation.id_", 16); props[US_PROPKEY_ID] = uidGen.GetUID(); m_ServiceRegistration = context->RegisterService(this, props); } void mitk::Annotation::UnRegisterMicroservice() { if (m_ServiceRegistration != NULL) m_ServiceRegistration.Unregister(); m_ServiceRegistration = 0; } void mitk::Annotation::AnnotationModified() { Modified(); this->SetUSProperty(US_PROPKEY_MODIFIED, this->GetMTime()); } diff --git a/Plugins/org.mitk.gui.qt.overlaymanager/documentation/UserManual/QmitkOverlayManager.dox b/Plugins/org.mitk.gui.qt.overlaymanager/documentation/UserManual/QmitkOverlayManager.dox index ecb943f4e9..e34dbb5b5c 100644 --- a/Plugins/org.mitk.gui.qt.overlaymanager/documentation/UserManual/QmitkOverlayManager.dox +++ b/Plugins/org.mitk.gui.qt.overlaymanager/documentation/UserManual/QmitkOverlayManager.dox @@ -1,11 +1,11 @@ /** \page org_mitk_gui_qt_overlaymanager The OverlayManager Plugin \imageMacro{icon.png,"Icon of Overlaymanager",2.00} \tableofcontents \section org_mitk_gui_qt_overlaymanagerOverview Overview -The OverlayManager plugin allows to view all overlays currently managed by the mitk::OverlayManager. Properties of added overlays can be modified. Additionally it is possible to create some basic overlays and add them to the mitk::OverlayManager. +The OverlayManager plugin allows to view all annotations currently managed. Properties of added annotations can be modified. Additionally it is possible to create some basic overlays and register them. */ diff --git a/Plugins/org.mitk.gui.qt.overlaymanager/documentation/doxygen/modules.dox b/Plugins/org.mitk.gui.qt.overlaymanager/documentation/doxygen/modules.dox index 1858d3a08d..82586ab590 100644 --- a/Plugins/org.mitk.gui.qt.overlaymanager/documentation/doxygen/modules.dox +++ b/Plugins/org.mitk.gui.qt.overlaymanager/documentation/doxygen/modules.dox @@ -1,16 +1,16 @@ /** \defgroup org_mitk_gui_qt_overlaymanager org.mitk.gui.qt.overlaymanager \ingroup MITKPlugins - \brief This is the overlaymanager plugin. Overlays that have been addded to the OverlayManager can be viewed and modified. The plugin also allows to add new overlays. + \brief This is the overlaymanager plugin. Annotations that have been addded to the OverlayManager can be viewed and modified. The plugin also allows to add new annotations. */ /** \defgroup org_mitk_gui_qt_overlaymanager_internal Internal \ingroup org_mitk_gui_qt_overlaymanager \brief This subcategory includes the internal classes of the org.mitk.gui.qt.overlaymanager plugin. Other plugins must not rely on these classes. They contain implementation details and their interface may change at any time. We mean it. */