diff --git a/Documentation/Doxygen/3-DeveloperManual/Concepts/Annotation.dox b/Documentation/Doxygen/3-DeveloperManual/Concepts/Annotation.dox
new file mode 100644
index 0000000000..b75fbd7a25
--- /dev/null
+++ b/Documentation/Doxygen/3-DeveloperManual/Concepts/Annotation.dox
@@ -0,0 +1,51 @@
+/**
+\page AnnotationPage Annotation Concept
+
+\tableofcontents
+
+\section AnnotationPage_Introduction Annotations
+
+The annotations in MITK are a simple way to display additional information on the render windows. A class, deriving from mitk::Annotation represents an arbitrary
+2D or 3D object that can be rendered as an Annotation. This can for example be used for the annotation of 3D points or to Annotation despriptions in the window corners.
+Instances of the MicroService mitk::AbstractAnnotationRenderer are used to add the annotations to the renderwindows, updating them and depending on their implementation, organize them in a layout.
+This module contains implementations for mitk::AbstractAnnotationRenderer as well as mitk::Annotation. Currently, the following features are realized within the Annotation module.
+
+ - 2D and 3D textelements are already defined in the Annotation module and are using VTK to create custom annotations.
+
- 2D and 3D annotations can be placed freely by providing a display position
+
- 2D annotations can be placed in a layout, which organizes the annotations in the display corners.
+
+\section AnnotationPage_ArchitectureSection General Architecture
+
+The mitk::Annotation can be implemented using a custom rendering framework like VTK. In this diagram, the vtkAnnotation is shown as the superclass for all Annotations which use the vtk framework for rendering.
+The AnnotationManager can be registered to several BaseRenderer instances in order to call the update method of each Annotation during the rendering phase of the renderer.
+It also manages the respective Layouters which are used to manage the placement of a group of Annotations.
+
+\subsection AnnotationPage_AnnotationSubsection Annotation
+
+The mitk::Annotation is an abstract class that can manage property lists like the mitk::DataNode and provides the interfaces to the methods
+AddToBaseRenderer, AddToRenderer, RemoveFromBaseRenderer RemoveFromRenderer and Update. The subclasses of the mitk::Annotation have to implement these methods
+in order to provide the functionallity of an Annotation. There are already a few implementations of mitk::Annotation which are using VTK as a rendering
+framework to display the Annotations. In order to show an Annotation, it has to be registered as a MicroService.
+
+\subsection AnnotationPage_AnnotationRendererSubsection AbstractAnnotationRenderer
+
+The AbstractAnnotationRenderer is the base class for all types of AnnotationRenderers, which are used for the management of multiple annotations in a specific BaseRenderer.
+For each BaseRenderer, an AnnotationRenderer is registerered as a MicroService, using the type and the renderer name as a unique identifier. This way it is possible to keep the Annotations for a specific BaseRenderer
+even if this renderer is temporarilly not existent (e.g. when a RenderWindow was closed).
+
+Implementations of the AbstractAnnotationRenderer are using the us::ServiceTracker in order to manage all registered Annotations and to listen to the events which are thrown if a new Annotation is registered,
+if an Annotation was unregistered or if it was modified.
+
+\subsubsection AnnotationPage_ManualPlacementAnnotationRendererSubsection ManualPlacementAnnotationRenderer
+
+Using the ManualPlacementAnnotationRenderer, allows for a simple placement of Annotations. The Annotation manages its placement internally or using the Position2D / Position3D properties.
+
+\subsubsection AnnotationPage_LayoutAnnotationRendererSubsection LayoutAnnotationRenderer
+
+The LayoutAnnotationRenderer allows automatic placement in the RenderWindow corners and sorts the Annotations by a specified priority.
+
+\subsection AnnotationPage_AnnotationUtilsSubsection AnnotationUtils
+
+mitk::AnnotationUtils is a collection of static convenience functions, for the registration of AnnotationRenderers and to request certain registered Annotations.
+
+*/
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/Concepts/Overlays.dox b/Documentation/Doxygen/3-DeveloperManual/Concepts/Overlays.dox
deleted file mode 100644
index 38e8b8d1e1..0000000000
--- a/Documentation/Doxygen/3-DeveloperManual/Concepts/Overlays.dox
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
-\page OverlaysPage Overlays and Annotations Concepts
-
-\tableofcontents
-
-\section OverlaysPage_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.
-
- - Definition of graphical elements that can be displayed in the render windows.
-
- It is possible to manage multiple elements in each window.
-
- A single Overlay can be rendered on any number of available render windows.
-
- 2D and 3D textelements are already defined in the Overlay module and are using VTK to create custom annotations.
-
- The mitk::BaseLayouter interface enables the implementation of layout managers, to handle the placement of the overlays.
-
-
-\section OverlaysPage_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
-
-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
-
-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
-
-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
-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
-
-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
-
-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
-
-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
-
-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/images/annotation/annotationArchitecture.png b/Documentation/Doxygen/3-DeveloperManual/Concepts/images/annotation/annotationArchitecture.png
new file mode 100644
index 0000000000..da11554093
Binary files /dev/null and b/Documentation/Doxygen/3-DeveloperManual/Concepts/images/annotation/annotationArchitecture.png differ
diff --git a/Documentation/Doxygen/3-DeveloperManual/Toolkit/ModuleManuals/MITKModuleManualsList.dox b/Documentation/Doxygen/3-DeveloperManual/Toolkit/ModuleManuals/MITKModuleManualsList.dox
index 015179e6e2..9e69f81b3e 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Toolkit/ModuleManuals/MITKModuleManualsList.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Toolkit/ModuleManuals/MITKModuleManualsList.dox
@@ -1,28 +1,29 @@
/**
\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
+ \li \subpage OverlayMigration
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Toolkit/ModuleManuals/OverlayMigration.dox b/Documentation/Doxygen/3-DeveloperManual/Toolkit/ModuleManuals/OverlayMigration.dox
new file mode 100644
index 0000000000..2f3abc81bd
--- /dev/null
+++ b/Documentation/Doxygen/3-DeveloperManual/Toolkit/ModuleManuals/OverlayMigration.dox
@@ -0,0 +1,37 @@
+/**
+
+\page OverlayMigration Migration Guide from Overlays to the new Annotation concept
+
+\tableofcontents
+
+\section Howto How to adapt your code
+All classes have been renamed from "Overlay" to "Annotation", e.g. the mitk::TextOverlay2D is now mitk::TextAnnotation2D. Most of the interface of mitk::Overlay remains unchanged in
+mitk::Annotation, but it is no longer registered at the mitk::OverlayManager. Instead, mitk::ManualPlacementAnnotationRenderer and mitk::LayoutAnnotationRenderer are used the register an annotation.
+
+\code
+ // Old Overlay registration:
+ overlayManager->AddOverlay(textOverlay3D.GetPointer(), renderer);
+\endcode
+\code
+ // New Annotation registration:
+ mitk::ManualPlacementAnnotationRenderer::AddAnnotation(textAnnotation3D, renderer);
+\endcode
+
+A single mitk::Annotation is no longer automatically registered in all available RenderWindows. Each mitk::Annotation is shown only once. The user is also responsible for the memory management.
+When a created mitk::Annotation has no more SmartPointer references, it disappears.
+
+The Layouter concept was implemented in the mitk::LayoutAnnotationRenderer:
+\code
+ // Old way to layout an mitk::Overlay:
+ verlayManager->AddOverlay(textOverlay.GetPointer());
+ overlayManager->AddLayouter(
+ mitk::Overlay2DLayouter::CreateLayouter(mitk::Overlay2DLayouter::STANDARD_2D_TOPLEFT(), renderer2D).GetPointer());
+ overlayManager->SetLayouter(textOverlay.GetPointer(), mitk::Overlay2DLayouter::STANDARD_2D_TOPLEFT(), renderer2D);
+\endcode
+\code
+ // New way to layout an mitk::Annotation:
+ mitk::LayoutAnnotationRenderer::AddAnnotation(textAnnotation, rendererID, mitk::LayoutAnnotationRenderer::TopLeft, 5, 5, 1);
+ // The layouter gets parameters for margins and the priority for the placement in the RenderWindow corners.
+\endcode
+
+*/
diff --git a/Examples/Annotation/AnnotationExample.cpp b/Examples/Annotation/AnnotationExample.cpp
new file mode 100644
index 0000000000..a419c4bef3
--- /dev/null
+++ b/Examples/Annotation/AnnotationExample.cpp
@@ -0,0 +1,147 @@
+/*===================================================================
+
+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 "QmitkRegisterClasses.h"
+#include "QmitkRenderWindow.h"
+
+#include
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+//##Documentation
+//## @brief Load image (nrrd format) and display it in a 2D view
+int main(int argc, char *argv[])
+{
+ QApplication qtapplication(argc, argv);
+
+ if (argc < 2)
+ {
+ fprintf(stderr, "Usage: %s [filename] \n\n", itksys::SystemTools::GetFilenameName(argv[0]).c_str());
+ return 1;
+ }
+
+ // Register Qmitk-dependent global instances
+ QmitkRegisterClasses();
+
+ mitk::StandaloneDataStorage::Pointer ds = mitk::StandaloneDataStorage::New();
+
+ // Load datanode (eg. many image formats, surface formats, etc.)
+ mitk::IOUtil::Load(argv[1], *ds);
+
+ // Create a RenderWindow
+ QmitkRenderWindow renderWindow;
+
+ // Tell the RenderWindow which (part of) the datastorage to render
+ renderWindow.GetRenderer()->SetDataStorage(ds);
+
+ // Initialize the RenderWindow
+ mitk::TimeGeometry::Pointer geo = ds->ComputeBoundingGeometry3D(ds->GetAll());
+ mitk::RenderingManager::GetInstance()->InitializeViews(geo);
+ // mitk::RenderingManager::GetInstance()->InitializeViews();
+
+ // Add Overlays
+ //![TextAnnotation2D]
+ // Create a textAnnotation2D
+ mitk::TextAnnotation2D::Pointer textAnnotation = mitk::TextAnnotation2D::New();
+
+ textAnnotation->SetText("Test!"); // set UTF-8 encoded text to render
+ textAnnotation->SetFontSize(40);
+ textAnnotation->SetColor(1, 0, 0); // Set text color to red
+ textAnnotation->SetOpacity(1);
+
+ // The position of the Annotation can be set to a fixed coordinate on the display.
+ mitk::Point2D pos;
+ pos[0] = 10;
+ pos[1] = 20;
+ textAnnotation->SetPosition2D(pos);
+
+ std::string rendererID = renderWindow.GetRenderer()->GetName();
+
+ // The LayoutAnnotationRenderer can place the TextAnnotation2D at some defined corner positions
+ mitk::LayoutAnnotationRenderer::AddAnnotation(
+ textAnnotation, rendererID, mitk::LayoutAnnotationRenderer::TopLeft, 5, 5, 1);
+ //![TextAnnotation2D]
+
+ //![TextAnnotation3D]
+ mitk::PointSet::Pointer pointset = mitk::PointSet::New();
+
+ // This vector is used to define an offset for the annotations, in order to show them with a margin to the actual
+ // coordinate.
+ mitk::Point3D offset;
+ offset[0] = .5;
+ offset[1] = .5;
+ offset[2] = .5;
+
+ // save references to Annotations so that they do not get deregistered
+ std::vector annotationReferences;
+
+ // Just a loop to create some points
+ for (unsigned long i = 0; i < 10; i++)
+ {
+ // To each point, a TextAnnotation3D is created
+ mitk::TextAnnotation3D::Pointer textAnnotation3D = mitk::TextAnnotation3D::New();
+ mitk::Point3D point;
+ point[0] = i * 20;
+ point[1] = i * 30;
+ point[2] = -i * 50;
+ pointset->InsertPoint(i, point);
+ textAnnotation3D->SetText("A Point");
+
+ // The Position is set to the point coordinate to create an annotation to the point in the PointSet.
+ textAnnotation3D->SetPosition3D(point);
+
+ // move the annotation away from the actual point
+ textAnnotation3D->SetOffsetVector(offset);
+
+ annotationReferences.push_back(textAnnotation3D);
+ mitk::ManualPlacementAnnotationRenderer::AddAnnotation(textAnnotation3D, rendererID);
+ }
+
+ // Get the MicroserviceID of the registered textAnnotation
+ std::string serviceID = textAnnotation->GetMicroserviceID();
+
+ // The AnnotationUtils can retrieve any registered annotations by their microservice ID
+ mitk::Annotation *annotation = mitk::AnnotationUtils::GetAnnotation(serviceID);
+ // This way, it is possible to change the properties of Annotations without knowing their implementation
+ annotation->SetText("changed text!");
+
+ // also show the created pointset
+ mitk::DataNode::Pointer datanode = mitk::DataNode::New();
+ datanode->SetData(pointset);
+ datanode->SetName("pointSet");
+ ds->Add(datanode);
+ //! [TextAnnotation3D]
+ renderWindow.show();
+ renderWindow.resize(256, 256);
+
+ renderWindow.show();
+ renderWindow.resize(256, 256);
+
+ // cleanup: Remove References to DataStorage. This will delete the object
+ ds = NULL;
+}
+/**
+\example Step1.cpp
+*/
diff --git a/Examples/Annotation/CMakeLists.txt b/Examples/Annotation/CMakeLists.txt
new file mode 100644
index 0000000000..9b47f2ab52
--- /dev/null
+++ b/Examples/Annotation/CMakeLists.txt
@@ -0,0 +1,4 @@
+project(AnnotationExample)
+
+mitk_create_executable(${PROJECT_NAME} DEPENDS MitkQtWidgetsExt MitkAnnotation)
+
diff --git a/Examples/Annotation/files.cmake b/Examples/Annotation/files.cmake
new file mode 100644
index 0000000000..b2a623392a
--- /dev/null
+++ b/Examples/Annotation/files.cmake
@@ -0,0 +1 @@
+set(CPP_FILES AnnotationExample.cpp)
diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt
index 9db1edf188..957751fe99 100644
--- a/Examples/CMakeLists.txt
+++ b/Examples/CMakeLists.txt
@@ -1,53 +1,53 @@
set(MITK_DEFAULT_SUBPROJECTS MITK-Examples)
#-----------------------------------------------------------------------------
# Set-up example plugins
#-----------------------------------------------------------------------------
if(MITK_USE_BLUEBERRY)
# Specify which plug-ins belong to this project
macro(GetMyTargetLibraries all_target_libraries varname)
set(re_ctkplugin_mitk "^org_mitk_example_[a-zA-Z0-9_]+$")
set(_tmp_list)
list(APPEND _tmp_list ${all_target_libraries})
ctkMacroListFilter(_tmp_list re_ctkplugin_mitk OUTPUT_VARIABLE ${varname})
endmacro()
set(MITK_EXAMPLE_PLUGIN_TARGETS )
foreach(mitk_example_plugin ${MITK_EXAMPLE_PLUGINS})
ctkFunctionExtractOptionNameAndValue(${mitk_example_plugin} plugin_name plugin_value)
string(REPLACE "." "_" _plugin_target ${plugin_name})
list(APPEND MITK_EXAMPLE_PLUGIN_TARGETS ${_plugin_target})
mark_as_advanced(${${_plugin_target}_option_name})
endforeach()
endif()
#-----------------------------------------------------------------------------
# Add example executables
#-----------------------------------------------------------------------------
set(MITK_DIR ${PROJECT_BINARY_DIR})
set(MITK_EXPORTS_FILE_INCLUDED 1)
set(_example_dirs
Dump
MbiLog
QtFreeRender
Tutorial
FirstSteps
QuickRender
-# Overlays# depends on MitkQtWidgetsExt..
+ Annotation
)
if(MITK_USE_BLUEBERRY)
list(APPEND _example_dirs
BlueBerryExampleLauncher
)
endif()
foreach(_example_dir ${_example_dirs})
add_subdirectory(${_example_dir})
endforeach()
diff --git a/Examples/Overlays/CMakeLists.txt b/Examples/Overlays/CMakeLists.txt
deleted file mode 100644
index 4479c0f8b4..0000000000
--- a/Examples/Overlays/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-project(OverlayExample)
-
-mitk_create_executable(${PROJECT_NAME} DEPENDS MitkQtWidgets)
-
diff --git a/Examples/Overlays/OverlayExample.cpp b/Examples/Overlays/OverlayExample.cpp
deleted file mode 100644
index 6470f9a135..0000000000
--- a/Examples/Overlays/OverlayExample.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/*===================================================================
-
-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.
-
-===================================================================*/
-
-//! [includes]
-#include "QmitkRegisterClasses.h"
-#include "QmitkRenderWindow.h"
-
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-//! [includes]
-
-//##Documentation
-//## @brief Load image (nrrd format) and display it in a 2D view
-int main(int argc, char *argv[])
-{
- QApplication qtapplication(argc, argv);
-
- if (argc < 2)
- {
- fprintf(stderr, "Usage: %s [filename] \n\n", itksys::SystemTools::GetFilenameName(argv[0]).c_str());
- return 1;
- }
-
- // Register Qmitk-dependent global instances
- QmitkRegisterClasses();
-
- //*************************************************************************
- // Part I: Basic initialization
- //*************************************************************************
-
- // Create a DataStorage
- // The DataStorage manages all data objects. It is used by the
- // rendering mechanism to render all data objects
- // We use the standard implementation mitk::StandaloneDataStorage.
- mitk::StandaloneDataStorage::Pointer dataStorage = mitk::StandaloneDataStorage::New();
-
- //*************************************************************************
- // Part II: Create some data by reading a file
- //*************************************************************************
-
- // Create a DataNodeFactory to read a data format supported
- // by the DataNodeFactory (many image formats, surface formats, etc.)
- mitk::DataNodeFactory::Pointer reader = mitk::DataNodeFactory::New();
- const char *filename = argv[1];
- try
- {
- reader->SetFileName(filename);
- reader->Update();
- //*************************************************************************
- // Part III: Put the data into the datastorage
- //*************************************************************************
-
- // Add the node to the DataStorage
- dataStorage->Add(reader->GetOutput());
- }
- catch (...)
- {
- fprintf(stderr, "Could not open file %s \n\n", filename);
- exit(2);
- }
-
- //*************************************************************************
- // Part IV: Create window and pass the datastorage to it
- //*************************************************************************
-
- // Create a RenderWindow
- QmitkRenderWindow renderWindow;
-
- // Tell the RenderWindow which (part of) the datastorage to render
- renderWindow.GetRenderer()->SetDataStorage(dataStorage);
-
- // Initialize the RenderWindow
- mitk::TimeGeometry::Pointer geo = dataStorage->ComputeBoundingGeometry3D(dataStorage->GetAll());
- mitk::RenderingManager::GetInstance()->InitializeViews(geo);
- // mitk::RenderingManager::GetInstance()->InitializeViews();
-
- // Select a slice
- mitk::SliceNavigationController::Pointer sliceNaviController = renderWindow.GetSliceNavigationController();
- if (sliceNaviController)
- sliceNaviController->GetSlice()->SetPos(0);
-
- //*************************************************************************
- // Part V: Qt-specific initialization
- //*************************************************************************
-
- //! [CreateOverlayManager]
- mitk::OverlayManager::Pointer OverlayManagerInstance = mitk::OverlayManager::New();
- mitk::BaseRenderer *renderer = mitk::BaseRenderer::GetInstance(renderWindow.GetVtkRenderWindow());
- renderer->SetOverlayManager(OverlayManagerInstance);
- //! [CreateOverlayManager]
-
- //! [GetOverlayManagerInstance]
- // The id that is passed identifies the correct mitk::OverlayManager and is '0' by default.
- mitk::BaseRenderer *renderer2D = mitk::BaseRenderer::GetInstance(renderWindow.GetVtkRenderWindow());
- mitk::OverlayManager::Pointer overlayManager = renderer2D->GetOverlayManager();
- //! [GetOverlayManagerInstance]
-
- //! [AddLayouter]
- // This creates a 2DLayouter that is only active for the recently fetched axialRenderer and positione
- mitk::Overlay2DLayouter::Pointer topleftLayouter =
- mitk::Overlay2DLayouter::CreateLayouter(mitk::Overlay2DLayouter::STANDARD_2D_TOPLEFT(), renderer2D);
-
- // Now, the created Layouter is added to the OverlayManager and can be referred to by its identification string.
- overlayManager->AddLayouter(topleftLayouter.GetPointer());
-
- // Several other Layouters can be added to the overlayManager
- mitk::Overlay2DLayouter::Pointer bottomLayouter =
- mitk::Overlay2DLayouter::CreateLayouter(mitk::Overlay2DLayouter::STANDARD_2D_BOTTOM(), renderer2D);
- overlayManager->AddLayouter(bottomLayouter.GetPointer());
- //! [AddLayouter]
-
- //! [TextOverlay2D]
- // Create a textOverlay2D
- mitk::TextOverlay2D::Pointer textOverlay = mitk::TextOverlay2D::New();
-
- textOverlay->SetText("Test!"); // set UTF-8 encoded text to render
- textOverlay->SetFontSize(40);
- textOverlay->SetColor(1, 0, 0); // Set text color to red
- textOverlay->SetOpacity(1);
-
- // The position of the Overlay can be set to a fixed coordinate on the display.
- mitk::Point2D pos;
- pos[0] = 10, pos[1] = 20;
- textOverlay->SetPosition2D(pos);
-
- // Add the overlay to the overlayManager. It is added to all registered renderers automaticly
- overlayManager->AddOverlay(textOverlay.GetPointer());
-
- // Alternatively, a layouter can be used to manage the position of the overlay. If a layouter is set, the absolute
- // position of the overlay is not used anymore
- // The Standard TopLeft Layouter has to be registered to the OverlayManager first
- overlayManager->AddLayouter(
- mitk::Overlay2DLayouter::CreateLayouter(mitk::Overlay2DLayouter::STANDARD_2D_TOPLEFT(), renderer2D).GetPointer());
- //! [TextOverlay2D]
-
- //! [SetLayouterToOverlay]
- // Because a Layouter is specified by the identification string AND the Renderer, both have to be passed to the call.
- overlayManager->SetLayouter(textOverlay.GetPointer(), mitk::Overlay2DLayouter::STANDARD_2D_TOPLEFT(), renderer2D);
- //! [SetLayouterToOverlay]
-
- //! [TextOverlay3D]
- mitk::PointSet::Pointer pointset = mitk::PointSet::New();
-
- // This vector is used to define an offset for the annotations, in order to show them with a margin to the actual
- // coordinate.
- mitk::Point3D offset;
- offset[0] = .5;
- offset[1] = .5;
- offset[2] = .5;
-
- // Just a loop to create some points
- for (int i = 0; i < 10; i++)
- {
- // To each point, a TextOverlay3D is created
- mitk::TextOverlay3D::Pointer textOverlay3D = mitk::TextOverlay3D::New();
- mitk::Point3D point;
- point[0] = i * 20;
- point[1] = i * 30;
- point[2] = -i * 50;
- pointset->InsertPoint(i, point);
- textOverlay3D->SetText("A Point");
-
- // The Position is set to the point coordinate to create an annotation to the point in the PointSet.
- textOverlay3D->SetPosition3D(point);
-
- // move the annotation away from the actual point
- textOverlay3D->SetOffsetVector(offset);
-
- overlayManager->AddOverlay(textOverlay3D.GetPointer());
- }
-
- // also show the created pointset
- mitk::DataNode::Pointer datanode = mitk::DataNode::New();
- datanode->SetData(pointset);
- datanode->SetName("pointSet");
- dataStorage->Add(datanode);
- //! [TextOverlay3D]
- renderWindow.show();
- renderWindow.resize(256, 256);
-
- return qtapplication.exec();
-
- // cleanup: Remove References to DataStorage. This will delete the object
- dataStorage = NULL;
-}
-/**
-\example Step1.cpp
-*/
\ No newline at end of file
diff --git a/Examples/Overlays/files.cmake b/Examples/Overlays/files.cmake
deleted file mode 100644
index 3bcefd36f6..0000000000
--- a/Examples/Overlays/files.cmake
+++ /dev/null
@@ -1 +0,0 @@
-set(CPP_FILES OverlayExample.cpp)
diff --git a/Modules/Annotation/CMakeLists.txt b/Modules/Annotation/CMakeLists.txt
new file mode 100644
index 0000000000..8d9aa53868
--- /dev/null
+++ b/Modules/Annotation/CMakeLists.txt
@@ -0,0 +1,6 @@
+MITK_CREATE_MODULE(
+ DEPENDS MitkCore
+ WARNINGS_AS_ERRORS
+)
+
+add_subdirectory(test)
diff --git a/Modules/Annotation/doc/doxygen/AnnotationModule.dox b/Modules/Annotation/doc/doxygen/AnnotationModule.dox
new file mode 100644
index 0000000000..962d3a73b0
--- /dev/null
+++ b/Modules/Annotation/doc/doxygen/AnnotationModule.dox
@@ -0,0 +1,61 @@
+/**
+\page AnnotationModulePage Annotation Module
+
+\tableofcontents
+
+\section AnnotationModulePage_Introduction Annotations
+
+The annotations in MITK are a simple way to display additional information on the render windows. A class, deriving from mitk::Annotation represents an arbitrary
+2D or 3D object that can be rendered as an Annotation. This can for example be used for the annotation of 3D points or to Annotation despriptions in the window corners.
+Instances of the MicroService mitk::AbstractAnnotationRenderer are used to add the annotations to the renderwindows, updating them and depending on their implementation, organize them in a layout.
+This module contains implementations for mitk::AbstractAnnotationRenderer as well as mitk::Annotation. Currently, the following features are realized within the Annotation module.
+
+ - 2D and 3D textelements are already defined in the Annotation module and are using VTK to create custom annotations.
+
- 2D and 3D annotations can be placed freely by providing a display position
+
- 2D annotations can be placed in a layout, which organizes the annotations in the display corners.
+
+
+\section AnnotationModulePage_UsageSection Usage of Predefined Annotations
+
+\subsection AnnotationModulePage_TextWidget2DUsageSubsection mitkTextAnnotation2D
+This exemplary Annotation can render text as a 2D Annotation which can be placed with the LayoutAnnotationRenderer
+\snippet AnnotationExample.cpp TextAnnotation2D
+
+\subsection AnnotationModulePage_TextWidget3DUsageSubsection mitkTextAnnotation3D
+This Annotation displays labels in 3D coordinates. The labels always face the camera.
+
+\snippet AnnotationExample.cpp TextAnnotation3D
+
+\section AnnotationModulePage_CustomAnnotationSection Implement a Custom Annotation
+
+A new custom Annotation should derive from mitkAnnotation or one of the later mentioned subclasses VtkAnnotation2D oder VtkAnnotation3D. There should always be an implementation for the methods
+AddToBaseRenderer, AddToRenderer, RemoveFromBaseRenderer RemoveFromRenderer and Update.
+UpdateAnnotation is the procedure that is called when the Annotation properties have changed. If the Annotation is rendered by VTK, this method only applies the properties to the representation.
+If the custom Annotation requires additional properties, they should be made accessible by getters and setters for a better usability:
+\code
+void mitk::VtkAnnotation3D::SetPosition3D(Point3D position3D, mitk::BaseRenderer *renderer)
+{
+ mitk::Point3dProperty::Pointer position3dProperty = mitk::Point3dProperty::New(position3D);
+ SetProperty("Position3D", position3dProperty,renderer);
+}
+
+mitk::Point3D mitk::VtkAnnotation3D::GetPosition3D(mitk::BaseRenderer *renderer)
+{
+ mitk::Point3D position3D;
+ GetPropertyValue("Position3D", position3D, renderer);
+ return position3D;
+}
+\endcode
+
+\subsection AnnotationModulePage_CustomVTK2DAnnotationSubsection VTK 2D Annotation
+
+VTK based Annotations which are meant to be displayed in 2D over the render window should derive from the mitk::VtkAnnotation2D.
+The mitk::VtkAnnotation2D is a subclass of Vtk::Annotation, that uses VTK to render the Annotation. This class creates the Annotation representation as a vtkActor2D, and is very easy to implement
+because only UpdateVtkAnnotation2D and GetVtkActor2D have to be implemented. The add, update and remove methods are implemented in the superclasses.
+UpdateVtkAnnotation2D only needs to apply the specific properties and GetVtkActor2D simply returns the created vtkActor.
+
+\subsection AnnotationModulePage_CustomVTK3DAnnotationSubsection VTK 3D Annotation
+
+The mitkVtkAnnotation3D works just like mitkVtkAnnotation2D, but it is designed for arbitrary 3D objects which derive from vtkProp,
+
+*/
diff --git a/Modules/Annotation/files.cmake b/Modules/Annotation/files.cmake
new file mode 100644
index 0000000000..22111606ce
--- /dev/null
+++ b/Modules/Annotation/files.cmake
@@ -0,0 +1,17 @@
+file(GLOB_RECURSE H_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include/*")
+
+set(CPP_FILES
+ mitkManualPlacementAnnotationRenderer.cpp
+ mitkColorBarAnnotation.cpp
+ mitkLabelAnnotation3D.cpp
+ mitkLogoAnnotation.cpp
+ mitkLayoutAnnotationRenderer.cpp
+ mitkScaleLegendAnnotation.cpp
+ mitkTextAnnotation2D.cpp
+ mitkTextAnnotation3D.cpp
+ mitkVtkLogoRepresentation.cxx
+ mitkVtkAnnotation.cpp
+ mitkVtkAnnotation2D.cpp
+ mitkVtkAnnotation3D.cpp
+)
+
diff --git a/Modules/Overlays/mitkColorBarOverlay.h b/Modules/Annotation/include/mitkColorBarAnnotation.h
similarity index 79%
rename from Modules/Overlays/mitkColorBarOverlay.h
rename to Modules/Annotation/include/mitkColorBarAnnotation.h
index 10df36efd8..760efe568c 100644
--- a/Modules/Overlays/mitkColorBarOverlay.h
+++ b/Modules/Annotation/include/mitkColorBarAnnotation.h
@@ -1,97 +1,97 @@
/*===================================================================
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 COLORBAROVERLAY_H
-#define COLORBAROVERLAY_H
+#ifndef COLORBARAnnotation_H
+#define COLORBARAnnotation_H
-#include "MitkOverlaysExports.h"
+#include "MitkAnnotationExports.h"
#include
-#include
+#include
#include
#include
class vtkScalarBarActor;
namespace mitk
{
/** \brief Displays configurable scales on the renderwindow. The scale is determined by the image spacing. */
- class MITKOVERLAYS_EXPORT ColorBarOverlay : public mitk::VtkOverlay
+ class MITKANNOTATION_EXPORT ColorBarAnnotation : public mitk::VtkAnnotation
{
public:
- class LocalStorage : public mitk::Overlay::BaseLocalStorage
+ class LocalStorage : public mitk::Annotation::BaseLocalStorage
{
public:
/** \brief Actor of a 2D render window. */
vtkSmartPointer m_ScalarBarActor;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage();
};
- mitkClassMacro(ColorBarOverlay, mitk::VtkOverlay);
+ mitkClassMacro(ColorBarAnnotation, mitk::VtkAnnotation);
itkFactorylessNewMacro(Self) itkCloneMacro(Self)
void SetDrawAnnotations(bool annotations);
bool GetDrawAnnotations() const;
void SetOrientationToHorizontal();
void SetOrientationToVertical();
void SetOrientation(int orientation);
int GetOrientation() const;
void SetMaxNumberOfColors(int numberOfColors);
int GetMaxNumberOfColors() const;
void SetNumberOfLabels(int numberOfLabels);
int GetNumberOfLabels() const;
void SetLookupTable(vtkSmartPointer table);
vtkSmartPointer GetLookupTable() const;
void SetDrawTickLabels(bool ticks);
bool GetDrawTickLabels() const;
void SetAnnotationTextScaling(bool scale);
bool GetAnnotationTextScaling() const;
protected:
/** \brief The LocalStorageHandler holds all LocalStorages for the render windows. */
mutable mitk::LocalStorageHandler m_LSH;
virtual vtkProp *GetVtkProp(BaseRenderer *renderer) const override;
- virtual void UpdateVtkOverlay(BaseRenderer *renderer) override;
+ virtual void UpdateVtkAnnotation(BaseRenderer *renderer) override;
/** \brief explicit constructor which disallows implicit conversions */
- explicit ColorBarOverlay();
+ explicit ColorBarAnnotation();
/** \brief virtual destructor in order to derive from this class */
- virtual ~ColorBarOverlay();
+ virtual ~ColorBarAnnotation();
private:
/** \brief copy constructor */
- ColorBarOverlay(const ColorBarOverlay &);
+ ColorBarAnnotation(const ColorBarAnnotation &);
/** \brief assignment operator */
- ColorBarOverlay &operator=(const ColorBarOverlay &);
+ ColorBarAnnotation &operator=(const ColorBarAnnotation &);
};
} // namespace mitk
-#endif // COLORBAROVERLAY_H
+#endif // COLORBARAnnotation_H
diff --git a/Modules/Overlays/mitkLabelOverlay3D.h b/Modules/Annotation/include/mitkLabelAnnotation3D.h
similarity index 84%
rename from Modules/Overlays/mitkLabelOverlay3D.h
rename to Modules/Annotation/include/mitkLabelAnnotation3D.h
index 34ce6b7aaf..a059c90a8d 100644
--- a/Modules/Overlays/mitkLabelOverlay3D.h
+++ b/Modules/Annotation/include/mitkLabelAnnotation3D.h
@@ -1,112 +1,112 @@
/*===================================================================
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 LabelOverlay3D_H
-#define LabelOverlay3D_H
+#ifndef LabelAnnotation3D_H
+#define LabelAnnotation3D_H
-#include "MitkOverlaysExports.h"
+#include "MitkAnnotationExports.h"
#include
-#include
+#include
#include
class vtkStringArray;
class vtkPolyDataMapper;
class vtkPolyData;
class vtkActor2D;
class vtkProperty2D;
class vtkPointSetToLabelHierarchy;
class vtkLabelPlacementMapper;
class vtkIntArray;
namespace mitk
{
class PointSet;
/** \brief Can display a high amount of 3D labels to a PointSet */
- class MITKOVERLAYS_EXPORT LabelOverlay3D : public mitk::VtkOverlay3D
+ class MITKANNOTATION_EXPORT LabelAnnotation3D : public mitk::VtkAnnotation3D
{
public:
/** \brief Internal class holding the vtkActor, etc. for each of the render windows */
- class LocalStorage : public mitk::Overlay::BaseLocalStorage
+ class LocalStorage : public mitk::Annotation::BaseLocalStorage
{
public:
vtkSmartPointer m_Points;
vtkSmartPointer m_LabelsActor;
vtkSmartPointer m_Sizes;
vtkSmartPointer m_Labels;
vtkSmartPointer m_LabelMapper;
vtkSmartPointer m_PointSetToLabelHierarchyFilter;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage();
};
- mitkClassMacro(LabelOverlay3D, mitk::VtkOverlay3D);
+ mitkClassMacro(LabelAnnotation3D, mitk::VtkAnnotation3D);
itkFactorylessNewMacro(Self) itkCloneMacro(Self)
/** \brief Set the vector of labels that are shown to each corresponding point3D. The size has to be equal to the
provided LabelCoordinates. */
void SetLabelVector(const std::vector &LabelVector);
/** \brief Optional: Provide a vector of priorities. The labels with higher priorities will be visible in lower LOD
*/
void SetPriorityVector(const std::vector &PriorityVector);
/** \brief Coordinates of the labels */
void SetLabelCoordinates(itk::SmartPointer LabelCoordinates);
void PointSetModified(const itk::Object *, const itk::EventObject &);
protected:
/** \brief The LocalStorageHandler holds all LocalStorages for the render windows. */
mutable mitk::LocalStorageHandler m_LSH;
virtual vtkProp *GetVtkProp(BaseRenderer *renderer) const override;
- void UpdateVtkOverlay(mitk::BaseRenderer *renderer) override;
+ void UpdateVtkAnnotation(mitk::BaseRenderer *renderer) override;
/** \brief explicit constructor which disallows implicit conversions */
- explicit LabelOverlay3D();
+ explicit LabelAnnotation3D();
/** \brief virtual destructor in order to derive from this class */
- virtual ~LabelOverlay3D();
+ virtual ~LabelAnnotation3D();
private:
/** \brief The char arrays in this vector are displayed at the corresponding coordinates.*/
std::vector m_LabelVector;
/** \brief values in this array set a priority to each label. Higher priority labels are not covert by labels with
* lower priority.*/
std::vector m_PriorityVector;
/** \brief The coordinates of the labels. Indices must match the labelVector and the priorityVector.*/
itk::SmartPointer m_LabelCoordinates;
unsigned long m_PointSetModifiedObserverTag;
/** \brief copy constructor */
- LabelOverlay3D(const LabelOverlay3D &);
+ LabelAnnotation3D(const LabelAnnotation3D &);
/** \brief assignment operator */
- LabelOverlay3D &operator=(const LabelOverlay3D &);
+ LabelAnnotation3D &operator=(const LabelAnnotation3D &);
};
} // namespace mitk
-#endif // LabelOverlay3D_H
+#endif // LabelAnnotation3D_H
diff --git a/Modules/Annotation/include/mitkLayoutAnnotationRenderer.h b/Modules/Annotation/include/mitkLayoutAnnotationRenderer.h
new file mode 100644
index 0000000000..7b2059ca33
--- /dev/null
+++ b/Modules/Annotation/include/mitkLayoutAnnotationRenderer.h
@@ -0,0 +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 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/Overlays/mitkLogoOverlay.h b/Modules/Annotation/include/mitkLogoAnnotation.h
similarity index 69%
rename from Modules/Overlays/mitkLogoOverlay.h
rename to Modules/Annotation/include/mitkLogoAnnotation.h
index 57528421d0..b0080ad9ad 100644
--- a/Modules/Overlays/mitkLogoOverlay.h
+++ b/Modules/Annotation/include/mitkLogoAnnotation.h
@@ -1,102 +1,102 @@
/*===================================================================
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 LOGOOVERLAY_H
-#define LOGOOVERLAY_H
+#ifndef LOGOAnnotation_H
+#define LOGOAnnotation_H
-#include "MitkOverlaysExports.h"
+#include "MitkAnnotationExports.h"
#include
-#include
+#include
#include
class mitkVtkLogoRepresentation;
class vtkImageData;
class vtkImageReader2Factory;
class vtkImageImport;
namespace mitk
{
/** \brief Displays a logo on the renderwindow */
- class MITKOVERLAYS_EXPORT LogoOverlay : public mitk::VtkOverlay
+ class MITKANNOTATION_EXPORT LogoAnnotation : public mitk::VtkAnnotation
{
public:
- class LocalStorage : public mitk::Overlay::BaseLocalStorage
+ class LocalStorage : public mitk::Annotation::BaseLocalStorage
{
public:
/** \brief Actor of a 2D render window. */
vtkSmartPointer m_LogoImage;
vtkSmartPointer m_LogoRep;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage();
};
- mitkClassMacro(LogoOverlay, mitk::VtkOverlay);
+ mitkClassMacro(LogoAnnotation, mitk::VtkAnnotation);
itkFactorylessNewMacro(Self) itkCloneMacro(Self)
vtkSmartPointer m_readerFactory;
void SetLogoImagePath(std::string text);
std::string GetLogoImagePath() const;
/** \brief The relative offset to the corner position */
- void SetOffsetVector(const Point2D &OffsetVector, BaseRenderer *renderer = NULL);
- Point2D GetOffsetVector(mitk::BaseRenderer *renderer = NULL) const;
+ void SetOffsetVector(const Point2D &OffsetVector);
+ Point2D GetOffsetVector() const;
/** \brief The corner where the logo is displayed.
0 = Bottom left
1 = Bottom right
2 = Top right
3 = Top left
4 = Center*/
- void SetCornerPosition(const int &corner, BaseRenderer *renderer = NULL);
- int GetCornerPosition(mitk::BaseRenderer *renderer = NULL) const;
+ void SetCornerPosition(const int &corner);
+ int GetCornerPosition() const;
- void SetRelativeSize(const float &size, BaseRenderer *renderer = NULL);
- float GetRelativeSize(mitk::BaseRenderer *renderer = NULL) const;
+ void SetRelativeSize(const float &size);
+ float GetRelativeSize() const;
protected:
/** \brief The LocalStorageHandler holds all LocalStorages for the render windows. */
mutable mitk::LocalStorageHandler m_LSH;
virtual vtkProp *GetVtkProp(BaseRenderer *renderer) const override;
- void UpdateVtkOverlay(mitk::BaseRenderer *renderer) override;
+ void UpdateVtkAnnotation(mitk::BaseRenderer *renderer) override;
vtkImageData *CreateMbiLogo();
/** \brief explicit constructor which disallows implicit conversions */
- explicit LogoOverlay();
+ explicit LogoAnnotation();
/** \brief virtual destructor in order to derive from this class */
- virtual ~LogoOverlay();
+ virtual ~LogoAnnotation();
private:
vtkSmartPointer m_VtkImageImport;
/** \brief copy constructor */
- LogoOverlay(const LogoOverlay &);
+ LogoAnnotation(const LogoAnnotation &);
/** \brief assignment operator */
- LogoOverlay &operator=(const LogoOverlay &);
+ LogoAnnotation &operator=(const LogoAnnotation &);
};
} // namespace mitk
-#endif // LOGOOVERLAY_H
+#endif // LOGOAnnotation_H
diff --git a/Modules/Annotation/include/mitkManualPlacementAnnotationRenderer.h b/Modules/Annotation/include/mitkManualPlacementAnnotationRenderer.h
new file mode 100644
index 0000000000..b25410768e
--- /dev/null
+++ b/Modules/Annotation/include/mitkManualPlacementAnnotationRenderer.h
@@ -0,0 +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 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/Overlays/mitkScaleLegendOverlay.h b/Modules/Annotation/include/mitkScaleLegendAnnotation.h
similarity index 67%
rename from Modules/Overlays/mitkScaleLegendOverlay.h
rename to Modules/Annotation/include/mitkScaleLegendAnnotation.h
index 93e404e3ef..db3bc511a7 100644
--- a/Modules/Overlays/mitkScaleLegendOverlay.h
+++ b/Modules/Annotation/include/mitkScaleLegendAnnotation.h
@@ -1,94 +1,106 @@
/*===================================================================
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 SCALELEGENDOVERLAY_H
-#define SCALELEGENDOVERLAY_H
+#ifndef SCALELEGENDAnnotation_H
+#define SCALELEGENDAnnotation_H
-#include "MitkOverlaysExports.h"
+#include "MitkAnnotationExports.h"
#include
-#include
+#include
#include
class vtkLegendScaleActor;
namespace mitk
{
/** \brief Displays configurable scales on the renderwindow. The scale is determined by the image spacing. */
- class MITKOVERLAYS_EXPORT ScaleLegendOverlay : public mitk::VtkOverlay
+ class MITKANNOTATION_EXPORT ScaleLegendAnnotation : public mitk::VtkAnnotation
{
public:
- class LocalStorage : public mitk::Overlay::BaseLocalStorage
+ class LocalStorage : public mitk::Annotation::BaseLocalStorage
{
public:
/** \brief Actor of a 2D render window. */
vtkSmartPointer m_legendScaleActor;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage();
};
- mitkClassMacro(ScaleLegendOverlay, mitk::VtkOverlay);
+ mitkClassMacro(ScaleLegendAnnotation, mitk::VtkAnnotation);
itkFactorylessNewMacro(Self) itkCloneMacro(Self)
void SetRightAxisVisibility(bool visibility);
bool GetRightAxisVisibility() const;
void SetLeftAxisVisibility(bool visibility);
bool GetLeftAxisVisibility() const;
void SetTopAxisVisibility(bool visibility);
bool GetTopAxisVisibility() const;
void SetBottomAxisVisibility(bool visibility);
bool GetBottomAxisVisibility() const;
void SetLegendVisibility(bool visibility);
bool GetLegendVisibility() const;
void SetRightBorderOffset(int offset);
int GetRightBorderOffset() const;
- void SetCornerOffsetFactor(float offsetFactor);
- float GetCornerOffsetFactor() const;
+ void SetLeftBorderOffset(int offset);
+ int GetLeftBorderOffset() const;
+
+ void SetTopBorderOffset(int offset);
+ int GetTopBorderOffset() const;
+
+ void SetBottomBorderOffset(int offset);
+ int GetBottomBorderOffset() const;
+
+ void SetFontFactor(double fontFactor);
+ double GetFontFactor() const;
+
+ void SetCornerOffsetFactor(double offsetFactor);
+ double GetCornerOffsetFactor() const;
protected:
/** \brief The LocalStorageHandler holds all LocalStorages for the render windows. */
mutable mitk::LocalStorageHandler m_LSH;
virtual vtkProp *GetVtkProp(BaseRenderer *renderer) const override;
- virtual void UpdateVtkOverlay(BaseRenderer *renderer) override;
+ virtual void UpdateVtkAnnotation(BaseRenderer *renderer) override;
/** \brief explicit constructor which disallows implicit conversions */
- explicit ScaleLegendOverlay();
+ explicit ScaleLegendAnnotation();
/** \brief virtual destructor in order to derive from this class */
- virtual ~ScaleLegendOverlay();
+ virtual ~ScaleLegendAnnotation();
private:
/** \brief copy constructor */
- ScaleLegendOverlay(const ScaleLegendOverlay &);
+ ScaleLegendAnnotation(const ScaleLegendAnnotation &);
/** \brief assignment operator */
- ScaleLegendOverlay &operator=(const ScaleLegendOverlay &);
+ ScaleLegendAnnotation &operator=(const ScaleLegendAnnotation &);
};
} // namespace mitk
-#endif // SCALELEGENDOVERLAY_H
+#endif // SCALELEGENDAnnotation_H
diff --git a/Modules/Overlays/mitkTextOverlay2D.h b/Modules/Annotation/include/mitkTextAnnotation2D.h
similarity index 74%
rename from Modules/Overlays/mitkTextOverlay2D.h
rename to Modules/Annotation/include/mitkTextAnnotation2D.h
index c4ccedcfe0..cac8c9ada3 100644
--- a/Modules/Overlays/mitkTextOverlay2D.h
+++ b/Modules/Annotation/include/mitkTextAnnotation2D.h
@@ -1,86 +1,86 @@
/*===================================================================
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 TEXTOVERLAY2D_H
-#define TEXTOVERLAY2D_H
+#ifndef TEXTAnnotation2D_H
+#define TEXTAnnotation2D_H
-#include "MitkOverlaysExports.h"
+#include "MitkAnnotationExports.h"
#include
-#include
+#include
#include
class vtkTextActor;
class vtkPropAssembly;
namespace mitk
{
/** \brief Displays text on the renderwindow */
- class MITKOVERLAYS_EXPORT TextOverlay2D : public mitk::VtkOverlay2D
+ class MITKANNOTATION_EXPORT TextAnnotation2D : public mitk::VtkAnnotation2D
{
public:
- class LocalStorage : public mitk::Overlay::BaseLocalStorage
+ class LocalStorage : public mitk::Annotation::BaseLocalStorage
{
public:
/** \brief Actor of a 2D render window. */
vtkSmartPointer m_TextActor;
vtkSmartPointer m_TextProp;
vtkSmartPointer m_STextActor;
vtkSmartPointer m_STextProp;
vtkSmartPointer m_Assembly;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage();
};
- mitkClassMacro(TextOverlay2D, mitk::VtkOverlay2D);
+ mitkClassMacro(TextAnnotation2D, mitk::VtkAnnotation2D);
itkFactorylessNewMacro(Self) itkCloneMacro(Self)
- virtual Overlay::Bounds GetBoundsOnDisplay(BaseRenderer *renderer) const override;
+ virtual Annotation::Bounds GetBoundsOnDisplay(BaseRenderer *renderer) const override;
virtual void SetBoundsOnDisplay(BaseRenderer *renderer, const Bounds &bounds) override;
protected:
/** \brief The LocalStorageHandler holds all LocalStorages for the render windows. */
mutable mitk::LocalStorageHandler m_LSH;
vtkProp *GetVtkProp(BaseRenderer *renderer) const override;
virtual vtkActor2D *GetVtkActor2D(BaseRenderer *renderer) const override;
- void UpdateVtkOverlay2D(mitk::BaseRenderer *renderer) override;
+ void UpdateVtkAnnotation2D(mitk::BaseRenderer *renderer) override;
/** \brief explicit constructor which disallows implicit conversions */
- explicit TextOverlay2D();
+ explicit TextAnnotation2D();
/** \brief virtual destructor in order to derive from this class */
- virtual ~TextOverlay2D();
+ virtual ~TextAnnotation2D();
private:
/** \brief copy constructor */
- TextOverlay2D(const TextOverlay2D &);
+ TextAnnotation2D(const TextAnnotation2D &);
/** \brief assignment operator */
- TextOverlay2D &operator=(const TextOverlay2D &);
+ TextAnnotation2D &operator=(const TextAnnotation2D &);
};
} // namespace mitk
-#endif // TEXTOVERLAY2D_H
+#endif // TEXTAnnotation2D_H
diff --git a/Modules/Overlays/mitkTextOverlay3D.h b/Modules/Annotation/include/mitkTextAnnotation3D.h
similarity index 72%
rename from Modules/Overlays/mitkTextOverlay3D.h
rename to Modules/Annotation/include/mitkTextAnnotation3D.h
index 7f4d4aa32f..832f7b6f60 100644
--- a/Modules/Overlays/mitkTextOverlay3D.h
+++ b/Modules/Annotation/include/mitkTextAnnotation3D.h
@@ -1,84 +1,84 @@
/*===================================================================
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 TextOverlay3D_H
-#define TextOverlay3D_H
+#ifndef TextAnnotation3D_H
+#define TextAnnotation3D_H
-#include "MitkOverlaysExports.h"
+#include "MitkAnnotationExports.h"
#include
-#include
+#include
class vtkFollower;
class vtkVectorText;
class vtkTextActor3D;
namespace mitk
{
/** \brief Displays at 3D position, always facing the camera */
- class MITKOVERLAYS_EXPORT TextOverlay3D : public mitk::VtkOverlay3D
+ class MITKANNOTATION_EXPORT TextAnnotation3D : public mitk::VtkAnnotation3D
{
public:
/** \brief Internal class holding the mapper, actor, etc. for each of the render windows */
/**
- * To render the Overlay on transveral, coronal, and sagittal, the update method
+ * To render the Annotation on transveral, coronal, and sagittal, the update method
* is called for each renderwindow. For performance reasons, the corresponding data
* for each view is saved in the internal helper class LocalStorage.
- * This allows rendering n views with just 1 mitkOverlay using n vtkMapper.
+ * This allows rendering n views with just 1 mitkAnnotation using n vtkMapper.
* */
- class LocalStorage : public mitk::Overlay::BaseLocalStorage
+ class LocalStorage : public mitk::Annotation::BaseLocalStorage
{
public:
/** \brief Actor of a 2D render window. */
vtkSmartPointer m_follower;
vtkSmartPointer m_textSource;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage();
};
- mitkClassMacro(TextOverlay3D, mitk::VtkOverlay3D);
+ mitkClassMacro(TextAnnotation3D, mitk::VtkAnnotation3D);
itkFactorylessNewMacro(Self) itkCloneMacro(Self)
protected :
/** \brief The LocalStorageHandler holds all LocalStorages for the render windows. */
mutable mitk::LocalStorageHandler m_LSH;
virtual vtkProp *GetVtkProp(BaseRenderer *renderer) const override;
- void UpdateVtkOverlay(mitk::BaseRenderer *renderer) override;
+ void UpdateVtkAnnotation(mitk::BaseRenderer *renderer) override;
/** \brief explicit constructor which disallows implicit conversions */
- explicit TextOverlay3D();
+ explicit TextAnnotation3D();
/** \brief virtual destructor in order to derive from this class */
- virtual ~TextOverlay3D();
+ virtual ~TextAnnotation3D();
private:
/** \brief copy constructor */
- TextOverlay3D(const TextOverlay3D &);
+ TextAnnotation3D(const TextAnnotation3D &);
/** \brief assignment operator */
- TextOverlay3D &operator=(const TextOverlay3D &);
+ TextAnnotation3D &operator=(const TextAnnotation3D &);
};
} // namespace mitk
-#endif // TextOverlay3D_H
+#endif // TextAnnotation3D_H
diff --git a/Modules/Core/include/mitkVtkOverlay.h b/Modules/Annotation/include/mitkVtkAnnotation.h
similarity index 62%
rename from Modules/Core/include/mitkVtkOverlay.h
rename to Modules/Annotation/include/mitkVtkAnnotation.h
index c16a46b5c3..9543c9449c 100644
--- a/Modules/Core/include/mitkVtkOverlay.h
+++ b/Modules/Annotation/include/mitkVtkAnnotation.h
@@ -1,75 +1,75 @@
/*===================================================================
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 VTKOVERLAY_H
-#define VTKOVERLAY_H
+#ifndef VTKAnnotation_H
+#define VTKAnnotation_H
-#include "mitkOverlay.h"
-#include
+#include "mitkAnnotation.h"
+#include
#include
class vtkProp;
namespace mitk
{
/**
- * @brief The VtkOverlay class is the base for all Overlays which are using the VTK framework to render
+ * @brief The VtkAnnotation class is the base for all Annotation which are using the VTK framework to render
*the elements.
*/
- class MITKCORE_EXPORT VtkOverlay : public Overlay
+ class MITKANNOTATION_EXPORT VtkAnnotation : public Annotation
{
public:
- mitkClassMacro(VtkOverlay, Overlay);
+ mitkClassMacro(VtkAnnotation, Annotation);
void Update(BaseRenderer *renderer) override;
void AddToBaseRenderer(BaseRenderer *renderer) override;
void AddToRenderer(BaseRenderer *renderer, vtkRenderer *vtkrenderer) override;
void RemoveFromRenderer(BaseRenderer *renderer, vtkRenderer *vtkrenderer) override;
void RemoveFromBaseRenderer(BaseRenderer *renderer) override;
/**
- * \brief Paints the overlay.
+ * \brief Paints the Annotation.
*
- * This method forces a paint of the overlay as it is configured at the moment.
- * \warn Should only be used as alternative to the OverlayManager mechanism
+ * This method forces a paint of the Annotation as it is configured at the moment.
+ * \warn Should only be used as alternative to the AnnotationManager mechanism
* in GL-Mappers.
*/
void Paint(BaseRenderer *renderer);
protected:
/**
- * @brief This method is implemented by the specific VTKOverlays in order to create the element as a vtkProp
+ * @brief This method is implemented by the specific VTKAnnotation in order to create the element as a vtkProp
* @param renderer
* @return The element that was created by the subclasses as a vtkProp.
*/
virtual vtkProp *GetVtkProp(BaseRenderer *renderer) const = 0;
- virtual void UpdateVtkOverlay(BaseRenderer *renderer) = 0;
+ virtual void UpdateVtkAnnotation(BaseRenderer *renderer) = 0;
/** \brief explicit constructor which disallows implicit conversions */
- explicit VtkOverlay();
+ explicit VtkAnnotation();
/** \brief virtual destructor in order to derive from this class */
- virtual ~VtkOverlay();
+ virtual ~VtkAnnotation();
private:
/** \brief copy constructor */
- VtkOverlay(const VtkOverlay &);
+ VtkAnnotation(const VtkAnnotation &);
/** \brief assignment operator */
- VtkOverlay &operator=(const VtkOverlay &);
+ VtkAnnotation &operator=(const VtkAnnotation &);
};
} // namespace mitk
-#endif // OVERLAY_H
+#endif // Annotation_H
diff --git a/Modules/Core/include/mitkVtkOverlay2D.h b/Modules/Annotation/include/mitkVtkAnnotation2D.h
similarity index 54%
rename from Modules/Core/include/mitkVtkOverlay2D.h
rename to Modules/Annotation/include/mitkVtkAnnotation2D.h
index 04f6be06bc..0d6aa50f3c 100644
--- a/Modules/Core/include/mitkVtkOverlay2D.h
+++ b/Modules/Annotation/include/mitkVtkAnnotation2D.h
@@ -1,69 +1,69 @@
/*===================================================================
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 VTKOVERLAY2D_H
-#define VTKOVERLAY2D_H
+#ifndef VTKAnnotation2D_H
+#define VTKAnnotation2D_H
-#include "mitkVtkOverlay.h"
-#include
+#include "mitkVtkAnnotation.h"
+#include
#include
class vtkActor2D;
class vtkProperty2D;
namespace mitk
{
/**
- * @brief The VtkOverlay2D class is the basis for all VTK based Overlays which create
+ * @brief The VtkAnnotation2D class is the basis for all VTK based Annotation which create
* a vtkActor2D element that will be drawn on the renderer.
*/
- class MITKCORE_EXPORT VtkOverlay2D : public VtkOverlay
+ class MITKANNOTATION_EXPORT VtkAnnotation2D : public VtkAnnotation
{
public:
- mitkClassMacro(VtkOverlay2D, VtkOverlay);
- virtual Overlay::Bounds GetBoundsOnDisplay(BaseRenderer *renderer) const override;
+ mitkClassMacro(VtkAnnotation2D, VtkAnnotation);
+ virtual Annotation::Bounds GetBoundsOnDisplay(BaseRenderer *renderer) const override;
virtual void SetBoundsOnDisplay(BaseRenderer *renderer, const Bounds &bounds) override;
- void SetPosition2D(const Point2D &position2D, mitk::BaseRenderer *renderer = NULL);
+ void SetPosition2D(const Point2D &position2D);
- Point2D GetPosition2D(mitk::BaseRenderer *renderer = NULL) const;
+ Point2D GetPosition2D() const;
- void SetOffsetVector(const Point2D &OffsetVector, BaseRenderer *renderer = NULL);
+ void SetOffsetVector(const Point2D &OffsetVector);
- Point2D GetOffsetVector(mitk::BaseRenderer *renderer = NULL) const;
+ Point2D GetOffsetVector() const;
protected:
virtual vtkProp *GetVtkProp(BaseRenderer *renderer) const override;
- virtual void UpdateVtkOverlay(BaseRenderer *renderer) override;
- virtual void UpdateVtkOverlay2D(BaseRenderer *renderer) = 0;
+ virtual void UpdateVtkAnnotation(BaseRenderer *renderer) override;
+ virtual void UpdateVtkAnnotation2D(BaseRenderer *renderer) = 0;
virtual vtkActor2D *GetVtkActor2D(BaseRenderer *renderer) const = 0;
/** \brief explicit constructor which disallows implicit conversions */
- explicit VtkOverlay2D();
+ explicit VtkAnnotation2D();
/** \brief virtual destructor in order to derive from this class */
- virtual ~VtkOverlay2D();
+ virtual ~VtkAnnotation2D();
private:
/** \brief copy constructor */
- VtkOverlay2D(const VtkOverlay2D &);
+ VtkAnnotation2D(const VtkAnnotation2D &);
/** \brief assignment operator */
- VtkOverlay2D &operator=(const VtkOverlay2D &);
+ VtkAnnotation2D &operator=(const VtkAnnotation2D &);
};
} // namespace mitk
-#endif // VTKOVERLAY2D_H
+#endif // VTKAnnotation2D_H
diff --git a/Modules/Core/include/mitkVtkOverlay3D.h b/Modules/Annotation/include/mitkVtkAnnotation3D.h
similarity index 51%
rename from Modules/Core/include/mitkVtkOverlay3D.h
rename to Modules/Annotation/include/mitkVtkAnnotation3D.h
index c299323ee6..65a3d8cb4d 100644
--- a/Modules/Core/include/mitkVtkOverlay3D.h
+++ b/Modules/Annotation/include/mitkVtkAnnotation3D.h
@@ -1,61 +1,61 @@
/*===================================================================
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 VTKOVERLAY3D_H
-#define VTKOVERLAY3D_H
+#ifndef VTKAnnotation3D_H
+#define VTKAnnotation3D_H
-#include "mitkVtkOverlay.h"
-#include
+#include "mitkVtkAnnotation.h"
+#include
#include
namespace mitk
{
/**
- * @brief The VtkOverlay3D class is the basis for all VTK based Overlays which create
+ * @brief The VtkAnnotation3D class is the basis for all VTK based Annotation which create
* any 3D element as a vtkProp that will be drawn on the renderer.
*/
- class MITKCORE_EXPORT VtkOverlay3D : public VtkOverlay
+ class MITKANNOTATION_EXPORT VtkAnnotation3D : public VtkAnnotation
{
public:
- void SetPosition3D(const Point3D &position3D, mitk::BaseRenderer *renderer = NULL);
+ void SetPosition3D(const Point3D &position3D);
- Point3D GetPosition3D(mitk::BaseRenderer *renderer = NULL) const;
+ Point3D GetPosition3D() const;
- void SetOffsetVector(const Point3D &OffsetVector, mitk::BaseRenderer *renderer = NULL);
+ void SetOffsetVector(const Point3D &OffsetVector);
- Point3D GetOffsetVector(mitk::BaseRenderer *renderer = NULL) const;
+ Point3D GetOffsetVector() const;
- mitkClassMacro(VtkOverlay3D, VtkOverlay);
+ mitkClassMacro(VtkAnnotation3D, VtkAnnotation);
protected:
- virtual void UpdateVtkOverlay(BaseRenderer *renderer) override = 0;
+ virtual void UpdateVtkAnnotation(BaseRenderer *renderer) override = 0;
/** \brief explicit constructor which disallows implicit conversions */
- explicit VtkOverlay3D();
+ explicit VtkAnnotation3D();
/** \brief virtual destructor in order to derive from this class */
- virtual ~VtkOverlay3D();
+ virtual ~VtkAnnotation3D();
private:
/** \brief copy constructor */
- VtkOverlay3D(const VtkOverlay3D &);
+ VtkAnnotation3D(const VtkAnnotation3D &);
/** \brief assignment operator */
- VtkOverlay3D &operator=(const VtkOverlay3D &);
+ VtkAnnotation3D &operator=(const VtkAnnotation3D &);
};
} // namespace mitk
-#endif // OVERLAY_H
+#endif // Annotation_H
diff --git a/Modules/Overlays/mitkVtkLogoRepresentation.h b/Modules/Annotation/include/mitkVtkLogoRepresentation.h
similarity index 100%
rename from Modules/Overlays/mitkVtkLogoRepresentation.h
rename to Modules/Annotation/include/mitkVtkLogoRepresentation.h
diff --git a/Modules/Overlays/mitkColorBarOverlay.cpp b/Modules/Annotation/src/mitkColorBarAnnotation.cpp
similarity index 51%
rename from Modules/Overlays/mitkColorBarOverlay.cpp
rename to Modules/Annotation/src/mitkColorBarAnnotation.cpp
index 20a2cf9653..6d854a7e34 100644
--- a/Modules/Overlays/mitkColorBarOverlay.cpp
+++ b/Modules/Annotation/src/mitkColorBarAnnotation.cpp
@@ -1,183 +1,190 @@
/*===================================================================
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 "mitkColorBarOverlay.h"
+#include "mitkColorBarAnnotation.h"
#include "mitkLookupTable.h"
#include "mitkLookupTableProperty.h"
#include
-mitk::ColorBarOverlay::ColorBarOverlay()
+mitk::ColorBarAnnotation::ColorBarAnnotation()
{
SetDrawAnnotations(true);
SetDrawTickLabels(true);
SetOrientationToVertical();
SetMaxNumberOfColors(100);
SetNumberOfLabels(4);
SetAnnotationTextScaling(false);
SetLookupTable(NULL);
}
-mitk::ColorBarOverlay::~ColorBarOverlay()
+mitk::ColorBarAnnotation::~ColorBarAnnotation()
{
+ for (BaseRenderer *renderer : m_LSH.GetRegisteredBaseRenderer())
+ {
+ if (renderer)
+ {
+ this->RemoveFromBaseRenderer(renderer);
+ }
+ }
}
-mitk::ColorBarOverlay::LocalStorage::~LocalStorage()
+mitk::ColorBarAnnotation::LocalStorage::~LocalStorage()
{
}
-mitk::ColorBarOverlay::LocalStorage::LocalStorage()
+mitk::ColorBarAnnotation::LocalStorage::LocalStorage()
{
m_ScalarBarActor = vtkSmartPointer::New();
}
-void mitk::ColorBarOverlay::UpdateVtkOverlay(mitk::BaseRenderer *renderer)
+void mitk::ColorBarAnnotation::UpdateVtkAnnotation(mitk::BaseRenderer *renderer)
{
LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
if (ls->IsGenerateDataRequired(renderer, this))
{
ls->m_ScalarBarActor->SetDrawAnnotations(this->GetDrawAnnotations());
ls->m_ScalarBarActor->SetLookupTable(this->GetLookupTable());
ls->m_ScalarBarActor->SetOrientation(this->GetOrientation());
ls->m_ScalarBarActor->SetDrawTickLabels(this->GetDrawTickLabels());
ls->m_ScalarBarActor->SetMaximumNumberOfColors(this->GetMaxNumberOfColors());
ls->m_ScalarBarActor->SetNumberOfLabels(this->GetNumberOfLabels());
ls->m_ScalarBarActor->SetAnnotationTextScaling(this->GetAnnotationTextScaling());
// manually set position so there is no overlap with mitk logo in 3d renderwindow
if (this->GetOrientation() == 1)
{
ls->m_ScalarBarActor->SetPosition(0.80, 0.15);
ls->m_ScalarBarActor->SetWidth(0.15);
ls->m_ScalarBarActor->SetHeight(0.85);
}
else
{
ls->m_ScalarBarActor->SetPosition(0.03, 0.03);
ls->m_ScalarBarActor->SetWidth(0.8);
ls->m_ScalarBarActor->SetHeight(0.15);
}
}
}
-vtkProp *mitk::ColorBarOverlay::GetVtkProp(BaseRenderer *renderer) const
+vtkProp *mitk::ColorBarAnnotation::GetVtkProp(BaseRenderer *renderer) const
{
LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
return ls->m_ScalarBarActor;
}
-void mitk::ColorBarOverlay::SetDrawAnnotations(bool annotations)
+void mitk::ColorBarAnnotation::SetDrawAnnotations(bool annotations)
{
- SetBoolProperty("ColorBarOverlay.DrawAnnotations", annotations);
+ SetBoolProperty("ColorBarAnnotation.DrawAnnotations", annotations);
}
-bool mitk::ColorBarOverlay::GetDrawAnnotations() const
+bool mitk::ColorBarAnnotation::GetDrawAnnotations() const
{
bool annotations;
- GetPropertyList()->GetBoolProperty("ColorBarOverlay.DrawAnnotations", annotations);
+ GetPropertyList()->GetBoolProperty("ColorBarAnnotation.DrawAnnotations", annotations);
return annotations;
}
-void mitk::ColorBarOverlay::SetLookupTable(vtkSmartPointer table)
+void mitk::ColorBarAnnotation::SetLookupTable(vtkSmartPointer table)
{
mitk::LookupTable::Pointer lut = mitk::LookupTable::New();
mitk::LookupTableProperty::Pointer prop = mitk::LookupTableProperty::New(lut);
lut->SetVtkLookupTable(table);
prop->SetLookupTable(lut);
- SetProperty("ColorBarOverlay.LookupTable", prop.GetPointer());
+ SetProperty("ColorBarAnnotation.LookupTable", prop.GetPointer());
}
-vtkSmartPointer mitk::ColorBarOverlay::GetLookupTable() const
+vtkSmartPointer mitk::ColorBarAnnotation::GetLookupTable() const
{
mitk::LookupTable::Pointer lut = mitk::LookupTable::New();
- lut = dynamic_cast(GetPropertyList()->GetProperty("ColorBarOverlay.LookupTable"))
+ lut = dynamic_cast(GetPropertyList()->GetProperty("ColorBarAnnotation.LookupTable"))
->GetLookupTable();
return lut->GetVtkLookupTable();
}
-void mitk::ColorBarOverlay::SetOrientation(int orientation)
+void mitk::ColorBarAnnotation::SetOrientation(int orientation)
{
- SetIntProperty("ColorBarOverlay.Orientation", orientation);
+ SetIntProperty("ColorBarAnnotation.Orientation", orientation);
}
-int mitk::ColorBarOverlay::GetOrientation() const
+int mitk::ColorBarAnnotation::GetOrientation() const
{
int orientation;
- GetPropertyList()->GetIntProperty("ColorBarOverlay.Orientation", orientation);
+ GetPropertyList()->GetIntProperty("ColorBarAnnotation.Orientation", orientation);
return orientation;
}
-void mitk::ColorBarOverlay::SetDrawTickLabels(bool ticks)
+void mitk::ColorBarAnnotation::SetDrawTickLabels(bool ticks)
{
- SetBoolProperty("ColorBarOverlay.DrawTicks", ticks);
+ SetBoolProperty("ColorBarAnnotation.DrawTicks", ticks);
}
-bool mitk::ColorBarOverlay::GetDrawTickLabels() const
+bool mitk::ColorBarAnnotation::GetDrawTickLabels() const
{
bool ticks;
- GetPropertyList()->GetBoolProperty("ColorBarOverlay.DrawTicks", ticks);
+ GetPropertyList()->GetBoolProperty("ColorBarAnnotation.DrawTicks", ticks);
return ticks;
}
-void mitk::ColorBarOverlay::SetOrientationToHorizontal()
+void mitk::ColorBarAnnotation::SetOrientationToHorizontal()
{
SetOrientation(0);
}
-void mitk::ColorBarOverlay::SetOrientationToVertical()
+void mitk::ColorBarAnnotation::SetOrientationToVertical()
{
SetOrientation(1);
}
-void mitk::ColorBarOverlay::SetMaxNumberOfColors(int numberOfColors)
+void mitk::ColorBarAnnotation::SetMaxNumberOfColors(int numberOfColors)
{
- SetIntProperty("ColorBarOverlay.MaximumNumberOfColors", numberOfColors);
+ SetIntProperty("ColorBarAnnotation.MaximumNumberOfColors", numberOfColors);
}
-int mitk::ColorBarOverlay::GetMaxNumberOfColors() const
+int mitk::ColorBarAnnotation::GetMaxNumberOfColors() const
{
int numberOfColors;
- GetPropertyList()->GetIntProperty("ColorBarOverlay.MaximumNumberOfColors", numberOfColors);
+ GetPropertyList()->GetIntProperty("ColorBarAnnotation.MaximumNumberOfColors", numberOfColors);
return numberOfColors;
}
-void mitk::ColorBarOverlay::SetNumberOfLabels(int numberOfLabels)
+void mitk::ColorBarAnnotation::SetNumberOfLabels(int numberOfLabels)
{
- SetIntProperty("ColorBarOverlay.NumberOfLabels", numberOfLabels);
+ SetIntProperty("ColorBarAnnotation.NumberOfLabels", numberOfLabels);
}
-int mitk::ColorBarOverlay::GetNumberOfLabels() const
+int mitk::ColorBarAnnotation::GetNumberOfLabels() const
{
int numberOfLabels;
- GetPropertyList()->GetIntProperty("ColorBarOverlay.NumberOfLabels", numberOfLabels);
+ GetPropertyList()->GetIntProperty("ColorBarAnnotation.NumberOfLabels", numberOfLabels);
return numberOfLabels;
}
-void mitk::ColorBarOverlay::SetAnnotationTextScaling(bool scale)
+void mitk::ColorBarAnnotation::SetAnnotationTextScaling(bool scale)
{
- SetBoolProperty("ColorBarOverlay.ScaleAnnotationText", scale);
+ SetBoolProperty("ColorBarAnnotation.ScaleAnnotationText", scale);
}
-bool mitk::ColorBarOverlay::GetAnnotationTextScaling() const
+bool mitk::ColorBarAnnotation::GetAnnotationTextScaling() const
{
bool scale;
- GetPropertyList()->GetBoolProperty("ColorBarOverlay.ScaleAnnotationText", scale);
+ GetPropertyList()->GetBoolProperty("ColorBarAnnotation.ScaleAnnotationText", scale);
return scale;
}
diff --git a/Modules/Overlays/mitkLabelOverlay3D.cpp b/Modules/Annotation/src/mitkLabelAnnotation3D.cpp
similarity index 73%
rename from Modules/Overlays/mitkLabelOverlay3D.cpp
rename to Modules/Annotation/src/mitkLabelAnnotation3D.cpp
index 68882570fa..f3c0bb0ff7 100644
--- a/Modules/Overlays/mitkLabelOverlay3D.cpp
+++ b/Modules/Annotation/src/mitkLabelAnnotation3D.cpp
@@ -1,163 +1,170 @@
/*===================================================================
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 "mitkLabelOverlay3D.h"
+#include "mitkLabelAnnotation3D.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
-mitk::LabelOverlay3D::LabelOverlay3D() : m_PointSetModifiedObserverTag(0)
+mitk::LabelAnnotation3D::LabelAnnotation3D() : m_PointSetModifiedObserverTag(0)
{
}
-mitk::LabelOverlay3D::~LabelOverlay3D()
+mitk::LabelAnnotation3D::~LabelAnnotation3D()
{
if (m_LabelCoordinates.IsNotNull())
m_LabelCoordinates->RemoveObserver(m_PointSetModifiedObserverTag);
+ for (BaseRenderer *renderer : m_LSH.GetRegisteredBaseRenderer())
+ {
+ if (renderer)
+ {
+ this->RemoveFromBaseRenderer(renderer);
+ }
+ }
}
-mitk::LabelOverlay3D::LocalStorage::~LocalStorage()
+mitk::LabelAnnotation3D::LocalStorage::~LocalStorage()
{
}
-mitk::LabelOverlay3D::LocalStorage::LocalStorage()
+mitk::LabelAnnotation3D::LocalStorage::LocalStorage()
{
m_Points = vtkSmartPointer::New();
// Add label array.
m_Labels = vtkSmartPointer::New();
m_Labels->SetNumberOfValues(0);
m_Labels->SetName("labels");
// Add priority array.
m_Sizes = vtkSmartPointer::New();
m_Sizes->SetNumberOfValues(0);
m_Sizes->SetName("sizes");
m_Points->GetPointData()->AddArray(m_Sizes);
m_Points->GetPointData()->AddArray(m_Labels);
m_PointSetToLabelHierarchyFilter = vtkSmartPointer::New();
m_PointSetToLabelHierarchyFilter->SetInputData(m_Points);
m_PointSetToLabelHierarchyFilter->SetLabelArrayName("labels");
m_PointSetToLabelHierarchyFilter->SetPriorityArrayName("sizes");
m_PointSetToLabelHierarchyFilter->Update();
m_LabelMapper = vtkSmartPointer::New();
m_LabelMapper->SetInputConnection(m_PointSetToLabelHierarchyFilter->GetOutputPort());
m_LabelsActor = vtkSmartPointer::New();
m_LabelsActor->SetMapper(m_LabelMapper);
}
-void mitk::LabelOverlay3D::UpdateVtkOverlay(mitk::BaseRenderer *renderer)
+void mitk::LabelAnnotation3D::UpdateVtkAnnotation(mitk::BaseRenderer *renderer)
{
if (m_LabelCoordinates.IsNull())
{
MITK_WARN << "No pointset defined to print labels!";
return;
}
LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
if (ls->IsGenerateDataRequired(renderer, this))
{
vtkSmartPointer points = vtkSmartPointer::New();
size_t pointsetsize = (size_t)m_LabelCoordinates->GetSize();
ls->m_Labels->SetNumberOfValues(pointsetsize);
ls->m_Sizes->SetNumberOfValues(pointsetsize);
for (size_t i = 0; i < pointsetsize; i++)
{
mitk::Point3D coordinate = m_LabelCoordinates->GetPoint(i);
- points->InsertNextPoint(coordinate[0] + GetOffsetVector(renderer)[0],
- coordinate[1] + GetOffsetVector(renderer)[1],
- coordinate[2] + GetOffsetVector(renderer)[2]);
+ points->InsertNextPoint(coordinate[0] + GetOffsetVector()[0],
+ coordinate[1] + GetOffsetVector()[1],
+ coordinate[2] + GetOffsetVector()[2]);
if (m_LabelVector.size() > i)
ls->m_Labels->SetValue(i, m_LabelVector[i]);
else
ls->m_Labels->SetValue(i, "");
if (m_PriorityVector.size() > i)
ls->m_Sizes->SetValue(i, m_PriorityVector[i]);
else
ls->m_Sizes->SetValue(i, 1);
}
ls->m_Points->SetPoints(points);
ls->m_PointSetToLabelHierarchyFilter->Update();
ls->m_LabelMapper->Update();
float color[3] = {1, 1, 1};
float opacity = 1.0;
- GetColor(color, renderer);
- GetOpacity(opacity, renderer);
+ GetColor(color);
+ GetOpacity(opacity);
ls->m_LabelsActor->GetProperty()->SetColor(color[0], color[1], color[2]);
ls->m_LabelsActor->GetProperty()->SetOpacity(opacity);
ls->UpdateGenerateDataTime();
}
}
-vtkProp *mitk::LabelOverlay3D::GetVtkProp(BaseRenderer *renderer) const
+vtkProp *mitk::LabelAnnotation3D::GetVtkProp(BaseRenderer *renderer) const
{
LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
return ls->m_LabelsActor;
}
-void mitk::LabelOverlay3D::SetLabelVector(const std::vector &LabelVector)
+void mitk::LabelAnnotation3D::SetLabelVector(const std::vector &LabelVector)
{
m_LabelVector = LabelVector;
this->Modified();
}
-void mitk::LabelOverlay3D::SetPriorityVector(const std::vector &PriorityVector)
+void mitk::LabelAnnotation3D::SetPriorityVector(const std::vector &PriorityVector)
{
m_PriorityVector = PriorityVector;
this->Modified();
}
-void mitk::LabelOverlay3D::SetLabelCoordinates(mitk::PointSet::Pointer LabelCoordinates)
+void mitk::LabelAnnotation3D::SetLabelCoordinates(mitk::PointSet::Pointer LabelCoordinates)
{
if (m_LabelCoordinates.IsNotNull())
{
m_LabelCoordinates->RemoveObserver(m_PointSetModifiedObserverTag);
m_PointSetModifiedObserverTag = 0;
m_LabelCoordinates = NULL;
}
if (LabelCoordinates.IsNull())
{
return;
}
m_LabelCoordinates = LabelCoordinates;
- itk::MemberCommand::Pointer _PropertyListModifiedCommand =
- itk::MemberCommand::New();
- _PropertyListModifiedCommand->SetCallbackFunction(this, &mitk::LabelOverlay3D::PointSetModified);
+ itk::MemberCommand::Pointer _PropertyListModifiedCommand =
+ itk::MemberCommand::New();
+ _PropertyListModifiedCommand->SetCallbackFunction(this, &mitk::LabelAnnotation3D::PointSetModified);
m_PointSetModifiedObserverTag = m_LabelCoordinates->AddObserver(itk::ModifiedEvent(), _PropertyListModifiedCommand);
this->Modified();
}
-void mitk::LabelOverlay3D::PointSetModified(const itk::Object * /*caller*/, const itk::EventObject &)
+void mitk::LabelAnnotation3D::PointSetModified(const itk::Object * /*caller*/, const itk::EventObject &)
{
this->Modified();
}
diff --git a/Modules/Annotation/src/mitkLayoutAnnotationRenderer.cpp b/Modules/Annotation/src/mitkLayoutAnnotationRenderer.cpp
new file mode 100644
index 0000000000..8fa1049f9e
--- /dev/null
+++ b/Modules/Annotation/src/mitkLayoutAnnotationRenderer.cpp
@@ -0,0 +1,346 @@
+/*===================================================================
+
+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 "mitkLayoutAnnotationRenderer.h"
+#include "mitkBaseRenderer.h"
+
+#include "mitkAnnotationUtils.h"
+#include "mitkEnumerationProperty.h"
+#include
+
+namespace mitk
+{
+ const std::string LayoutAnnotationRenderer::ANNOTATIONRENDERER_ID = "LayoutAnnotationRenderer";
+
+ const std::string LayoutAnnotationRenderer::PROP_LAYOUT = "Layout";
+ const std::string LayoutAnnotationRenderer::PROP_LAYOUT_PRIORITY = PROP_LAYOUT + ".priority";
+ const std::string LayoutAnnotationRenderer::PROP_LAYOUT_ALIGNMENT = PROP_LAYOUT + ".alignment";
+ const std::string LayoutAnnotationRenderer::PROP_LAYOUT_MARGIN = PROP_LAYOUT + ".margin";
+
+ void LayoutAnnotationRenderer::SetMargin2D(Annotation *Annotation, const Point2D &OffsetVector)
+ {
+ mitk::Point2dProperty::Pointer OffsetVectorProperty = mitk::Point2dProperty::New(OffsetVector);
+ Annotation->SetProperty(PROP_LAYOUT_MARGIN, OffsetVectorProperty.GetPointer());
+ }
+
+ Point2D LayoutAnnotationRenderer::GetMargin2D(Annotation *Annotation)
+ {
+ mitk::Point2D OffsetVector;
+ OffsetVector.Fill(0);
+ Annotation->GetPropertyValue(PROP_LAYOUT_MARGIN, OffsetVector);
+ return OffsetVector;
+ }
+
+ LayoutAnnotationRenderer::LayoutAnnotationRenderer(const std::string &rendererId)
+ : AbstractAnnotationRenderer(rendererId, LayoutAnnotationRenderer::ANNOTATIONRENDERER_ID)
+ {
+ }
+
+ void LayoutAnnotationRenderer::AddAlignmentProperty(Annotation *Annotation,
+ Alignment activeAlignment,
+ Point2D margin,
+ int priority)
+ {
+ EnumerationProperty::Pointer alignmentProperty(mitk::EnumerationProperty::New());
+ alignmentProperty->AddEnum("TopLeft", TopLeft);
+ alignmentProperty->AddEnum("Top", Top);
+ alignmentProperty->AddEnum("TopRight", TopRight);
+ alignmentProperty->AddEnum("BottomLeft ", BottomLeft);
+ alignmentProperty->AddEnum("Bottom", Bottom);
+ alignmentProperty->AddEnum("BottomRight", BottomRight);
+ alignmentProperty->AddEnum("Left", Left);
+ alignmentProperty->AddEnum("Right", Right);
+ alignmentProperty->SetValue(activeAlignment);
+ Annotation->AddProperty(PROP_LAYOUT_ALIGNMENT, alignmentProperty.GetPointer());
+ Annotation->SetIntProperty(PROP_LAYOUT_PRIORITY, priority);
+ SetMargin2D(Annotation, margin);
+ }
+
+ void LayoutAnnotationRenderer::OnAnnotationRenderersChanged()
+ {
+ if (!this->GetCurrentBaseRenderer())
+ return;
+ m_AnnotationContainerMap.clear();
+ for (Annotation *annotation : this->GetServices())
+ {
+ if (!annotation)
+ continue;
+ BaseProperty *prop = annotation->GetProperty(PROP_LAYOUT_ALIGNMENT);
+ EnumerationProperty *enumProb = dynamic_cast(prop);
+ Alignment currentAlignment = TopLeft;
+ Point2D margin;
+ margin.Fill(5);
+ int priority = -1;
+ annotation->GetIntProperty(PROP_LAYOUT_PRIORITY, priority);
+ if (!enumProb)
+ {
+ AddAlignmentProperty(annotation, currentAlignment, margin, priority);
+ }
+ else
+ { // TODO19786 insert
+ currentAlignment = static_cast(enumProb->GetValueAsId());
+ }
+ AnnotationRankedMap &AnnotationVec = m_AnnotationContainerMap[currentAlignment];
+ if (!AnnotationVec.empty() && priority < 0)
+ {
+ int max = AnnotationVec.rbegin()->first;
+ if (max < 100)
+ priority = 100;
+ else
+ priority = max + 1;
+ }
+ AnnotationVec.insert(std::pair(priority, annotation));
+ }
+ this->PrepareLayout();
+ }
+
+ LayoutAnnotationRenderer::~LayoutAnnotationRenderer() {}
+ const std::string LayoutAnnotationRenderer::GetID() const { return ANNOTATIONRENDERER_ID; }
+ LayoutAnnotationRenderer *LayoutAnnotationRenderer::GetAnnotationRenderer(const std::string &rendererID)
+ {
+ LayoutAnnotationRenderer *result = nullptr;
+ AbstractAnnotationRenderer *registeredService =
+ AnnotationUtils::GetAnnotationRenderer(ANNOTATIONRENDERER_ID, rendererID);
+ if (registeredService)
+ result = dynamic_cast(registeredService);
+ if (!result)
+ {
+ result = new LayoutAnnotationRenderer(rendererID);
+ AnnotationUtils::RegisterAnnotationRenderer(result);
+ }
+ return result;
+ }
+
+ void LayoutAnnotationRenderer::OnRenderWindowModified() { PrepareLayout(); }
+ void LayoutAnnotationRenderer::AddAnnotation(Annotation *Annotation,
+ const std::string &rendererID,
+ Alignment alignment,
+ double marginX,
+ double marginY,
+ int priority)
+ {
+ GetAnnotationRenderer(rendererID);
+ us::ServiceProperties props;
+ props[Annotation::US_PROPKEY_AR_ID] = ANNOTATIONRENDERER_ID;
+ props[Annotation::US_PROPKEY_RENDERER_ID] = rendererID;
+ Annotation->RegisterAsMicroservice(props);
+ Point2D margin;
+ margin[0] = marginX;
+ margin[1] = marginY;
+ AddAlignmentProperty(Annotation, alignment, margin, priority);
+ }
+
+ void LayoutAnnotationRenderer::AddAnnotation(
+ Annotation *Annotation, BaseRenderer *renderer, Alignment alignment, double marginX, double marginY, int priority)
+ {
+ AddAnnotation(Annotation, renderer->GetName(), alignment, marginX, marginY, priority);
+ }
+
+ void LayoutAnnotationRenderer::PrepareLayout()
+ {
+ if (!this->GetCurrentBaseRenderer())
+ return;
+ int *size = this->GetCurrentBaseRenderer()->GetVtkRenderer()->GetSize();
+ PrepareTopLeftLayout(size);
+ PrepareTopLayout(size);
+ PrepareTopRightLayout(size);
+ PrepareBottomLeftLayout(size);
+ PrepareBottomLayout(size);
+ PrepareBottomRightLayout(size);
+ PrepareLeftLayout(size);
+ PrepareRightLayout(size);
+ }
+ void LayoutAnnotationRenderer::PrepareTopLeftLayout(int *displaySize)
+ {
+ double posX, posY;
+ Point2D margin;
+ posX = 0;
+ posY = displaySize[1];
+ mitk::Annotation::Bounds bounds;
+ AnnotationRankedMap &AnnotationMap = m_AnnotationContainerMap[TopLeft];
+ for (auto it = AnnotationMap.cbegin(); it != AnnotationMap.cend(); ++it)
+ {
+ Annotation *Annotation = it->second;
+ margin = GetMargin2D(Annotation);
+ bounds = Annotation->GetBoundsOnDisplay(this->GetCurrentBaseRenderer());
+
+ posY -= bounds.Size[1] + margin[1];
+ bounds.Position[0] = posX + margin[0];
+ bounds.Position[1] = posY;
+ Annotation->SetBoundsOnDisplay(this->GetCurrentBaseRenderer(), bounds);
+ }
+ }
+ void LayoutAnnotationRenderer::PrepareTopLayout(int *displaySize)
+ {
+ double posX, posY;
+ Point2D margin;
+ posX = 0;
+ posY = displaySize[1];
+ mitk::Annotation::Bounds bounds;
+ AnnotationRankedMap &AnnotationMap = m_AnnotationContainerMap[Top];
+ for (auto it = AnnotationMap.cbegin(); it != AnnotationMap.cend(); ++it)
+ {
+ Annotation *Annotation = it->second;
+ margin = GetMargin2D(Annotation);
+ bounds = Annotation->GetBoundsOnDisplay(this->GetCurrentBaseRenderer());
+
+ posX = displaySize[0] / 2 - bounds.Size[0] / 2;
+ posY -= bounds.Size[1] + margin[1];
+ bounds.Position[0] = posX;
+ bounds.Position[1] = posY;
+ Annotation->SetBoundsOnDisplay(this->GetCurrentBaseRenderer(), bounds);
+ }
+ }
+ void LayoutAnnotationRenderer::PrepareTopRightLayout(int *displaySize)
+ {
+ double posX, posY;
+ Point2D margin;
+ posX = 0;
+ posY = displaySize[1];
+ mitk::Annotation::Bounds bounds;
+ AnnotationRankedMap &AnnotationMap = m_AnnotationContainerMap[TopRight];
+ for (auto it = AnnotationMap.cbegin(); it != AnnotationMap.cend(); ++it)
+ {
+ Annotation *Annotation = it->second;
+ margin = GetMargin2D(Annotation);
+ bounds = Annotation->GetBoundsOnDisplay(this->GetCurrentBaseRenderer());
+
+ posX = displaySize[0] - (bounds.Size[0] + margin[0]);
+ posY -= bounds.Size[1] + margin[1];
+ bounds.Position[0] = posX;
+ bounds.Position[1] = posY;
+ Annotation->SetBoundsOnDisplay(this->GetCurrentBaseRenderer(), bounds);
+ }
+ }
+
+ void LayoutAnnotationRenderer::PrepareRightLayout(int *displaySize)
+ {
+ double posY;
+ Point2D margin;
+ double height = GetHeight(m_AnnotationContainerMap[Right], GetCurrentBaseRenderer());
+ posY = (height / 2.0 + displaySize[1]) / 2.0;
+ mitk::Annotation::Bounds bounds;
+ AnnotationRankedMap &AnnotationMap = m_AnnotationContainerMap[Right];
+ for (auto it = AnnotationMap.cbegin(); it != AnnotationMap.cend(); ++it)
+ {
+ Annotation *Annotation = it->second;
+ margin = GetMargin2D(Annotation);
+ bounds = Annotation->GetBoundsOnDisplay(this->GetCurrentBaseRenderer());
+
+ posY -= bounds.Size[1] + margin[1];
+ bounds.Position[0] = displaySize[0] - (bounds.Size[0] + margin[0]);
+ bounds.Position[1] = posY + margin[1];
+ Annotation->SetBoundsOnDisplay(this->GetCurrentBaseRenderer(), bounds);
+ }
+ }
+
+ void LayoutAnnotationRenderer::PrepareLeftLayout(int *displaySize)
+ {
+ double posY;
+ Point2D margin;
+ double height = GetHeight(m_AnnotationContainerMap[Left], GetCurrentBaseRenderer());
+ posY = (height / 2.0 + displaySize[1]) / 2.0;
+ mitk::Annotation::Bounds bounds;
+ AnnotationRankedMap &AnnotationMap = m_AnnotationContainerMap[Left];
+ for (auto it = AnnotationMap.cbegin(); it != AnnotationMap.cend(); ++it)
+ {
+ Annotation *Annotation = it->second;
+ margin = GetMargin2D(Annotation);
+ bounds = Annotation->GetBoundsOnDisplay(this->GetCurrentBaseRenderer());
+
+ posY -= bounds.Size[1] + margin[1];
+ bounds.Position[0] = margin[0];
+ bounds.Position[1] = posY;
+ Annotation->SetBoundsOnDisplay(this->GetCurrentBaseRenderer(), bounds);
+ }
+ }
+
+ void LayoutAnnotationRenderer::PrepareBottomLeftLayout(int * /*displaySize*/)
+ {
+ double posX, posY;
+ Point2D margin;
+ posX = 0;
+ posY = 0;
+ mitk::Annotation::Bounds bounds;
+ AnnotationRankedMap &AnnotationMap = m_AnnotationContainerMap[BottomLeft];
+ for (auto it = AnnotationMap.cbegin(); it != AnnotationMap.cend(); ++it)
+ {
+ Annotation *Annotation = it->second;
+ margin = GetMargin2D(Annotation);
+ bounds = Annotation->GetBoundsOnDisplay(this->GetCurrentBaseRenderer());
+
+ bounds.Position[0] = posX + margin[0];
+ bounds.Position[1] = posY + margin[1];
+ Annotation->SetBoundsOnDisplay(this->GetCurrentBaseRenderer(), bounds);
+ posY += bounds.Size[1] + margin[1];
+ }
+ }
+ void LayoutAnnotationRenderer::PrepareBottomLayout(int *displaySize)
+ {
+ double posX, posY;
+ Point2D margin;
+ posX = 0;
+ posY = 0;
+ mitk::Annotation::Bounds bounds;
+ AnnotationRankedMap &AnnotationMap = m_AnnotationContainerMap[Bottom];
+ for (auto it = AnnotationMap.cbegin(); it != AnnotationMap.cend(); ++it)
+ {
+ Annotation *Annotation = it->second;
+ margin = GetMargin2D(Annotation);
+ bounds = Annotation->GetBoundsOnDisplay(this->GetCurrentBaseRenderer());
+
+ posX = displaySize[0] / 2 - bounds.Size[0] / 2;
+ bounds.Position[0] = posX;
+ bounds.Position[1] = posY + margin[1];
+ Annotation->SetBoundsOnDisplay(this->GetCurrentBaseRenderer(), bounds);
+ posY += bounds.Size[1] + margin[1];
+ }
+ }
+ void LayoutAnnotationRenderer::PrepareBottomRightLayout(int *displaySize)
+ {
+ double posX, posY;
+ Point2D margin;
+ posX = 0;
+ posY = 0;
+ mitk::Annotation::Bounds bounds;
+ AnnotationRankedMap &AnnotationMap = m_AnnotationContainerMap[BottomRight];
+ for (auto it = AnnotationMap.cbegin(); it != AnnotationMap.cend(); ++it)
+ {
+ Annotation *Annotation = it->second;
+ margin = GetMargin2D(Annotation);
+ bounds = Annotation->GetBoundsOnDisplay(this->GetCurrentBaseRenderer());
+
+ posX = displaySize[0] - (bounds.Size[0] + margin[0]);
+ bounds.Position[0] = posX;
+ bounds.Position[1] = posY + margin[1];
+ Annotation->SetBoundsOnDisplay(this->GetCurrentBaseRenderer(), bounds);
+ posY += bounds.Size[1] + margin[1];
+ }
+ }
+
+ double LayoutAnnotationRenderer::GetHeight(AnnotationRankedMap &annotations, BaseRenderer *renderer)
+ {
+ double height = 0;
+ for (auto it = annotations.cbegin(); it != annotations.cend(); ++it)
+ {
+ Annotation *annotation = it->second;
+ Annotation::Bounds bounds = annotation->GetBoundsOnDisplay(renderer);
+ height += bounds.Size[0];
+ height += GetMargin2D(annotation)[0];
+ }
+ return height;
+ }
+}
diff --git a/Modules/Overlays/mitkLogoOverlay.cpp b/Modules/Annotation/src/mitkLogoAnnotation.cpp
similarity index 69%
rename from Modules/Overlays/mitkLogoOverlay.cpp
rename to Modules/Annotation/src/mitkLogoAnnotation.cpp
index 3c5d6ae241..d27d5b96ba 100644
--- a/Modules/Overlays/mitkLogoOverlay.cpp
+++ b/Modules/Annotation/src/mitkLogoAnnotation.cpp
@@ -1,196 +1,204 @@
/*===================================================================
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 "mitkLogoOverlay.h"
+#include "mitkLogoAnnotation.h"
#include "vtkUnicodeString.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
-mitk::LogoOverlay::LogoOverlay()
+mitk::LogoAnnotation::LogoAnnotation()
{
m_readerFactory = vtkSmartPointer::New();
mitk::Point2D offset;
offset.Fill(0.03);
SetOffsetVector(offset);
SetRelativeSize(0.2);
+ SetLogoImagePath("mbiLogo");
SetCornerPosition(3);
m_VtkImageImport = vtkSmartPointer::New();
}
-mitk::LogoOverlay::~LogoOverlay()
+mitk::LogoAnnotation::~LogoAnnotation()
{
+ for (BaseRenderer *renderer : m_LSH.GetRegisteredBaseRenderer())
+ {
+ if (renderer)
+ {
+ this->RemoveFromBaseRenderer(renderer);
+ }
+ }
}
-mitk::LogoOverlay::LocalStorage::~LocalStorage()
+mitk::LogoAnnotation::LocalStorage::~LocalStorage()
{
}
-mitk::LogoOverlay::LocalStorage::LocalStorage()
+mitk::LogoAnnotation::LocalStorage::LocalStorage()
{
m_LogoRep = vtkSmartPointer::New();
}
-void mitk::LogoOverlay::UpdateVtkOverlay(mitk::BaseRenderer *renderer)
+void mitk::LogoAnnotation::UpdateVtkAnnotation(mitk::BaseRenderer *renderer)
{
LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
if (ls->IsGenerateDataRequired(renderer, this))
{
if (GetLogoImagePath().empty())
{
ls->m_LogoRep->SetVisibility(0);
return;
}
vtkImageReader2 *imageReader = m_readerFactory->CreateImageReader2(GetLogoImagePath().c_str());
if (imageReader)
{
imageReader->SetFileName(GetLogoImagePath().c_str());
imageReader->Update();
ls->m_LogoImage = imageReader->GetOutput();
imageReader->Delete();
}
else
{
ls->m_LogoImage = CreateMbiLogo();
}
ls->m_LogoRep->SetImage(ls->m_LogoImage);
ls->m_LogoRep->SetDragable(false);
ls->m_LogoRep->SetMoving(false);
ls->m_LogoRep->SetPickable(false);
ls->m_LogoRep->SetShowBorder(true);
ls->m_LogoRep->SetRenderer(renderer->GetVtkRenderer());
- float size = GetRelativeSize(renderer);
+ float size = GetRelativeSize();
ls->m_LogoRep->SetPosition2(size, size);
- int corner = GetCornerPosition(renderer);
+ int corner = GetCornerPosition();
ls->m_LogoRep->SetCornerPosition(corner);
- mitk::Point2D offset = GetOffsetVector(renderer);
+ mitk::Point2D offset = GetOffsetVector();
ls->m_LogoRep->SetPosition(offset[0], offset[1]);
float opacity = 1.0;
- GetOpacity(opacity, renderer);
+ GetOpacity(opacity);
ls->m_LogoRep->GetImageProperty()->SetOpacity(opacity);
ls->m_LogoRep->BuildRepresentation();
ls->UpdateGenerateDataTime();
}
}
-vtkImageData *mitk::LogoOverlay::CreateMbiLogo()
+vtkImageData *mitk::LogoAnnotation::CreateMbiLogo()
{
m_VtkImageImport->SetDataScalarTypeToUnsignedChar();
m_VtkImageImport->SetNumberOfScalarComponents(mbiLogo_NumberOfScalars);
m_VtkImageImport->SetWholeExtent(0, mbiLogo_Width - 1, 0, mbiLogo_Height - 1, 0, 1 - 1);
m_VtkImageImport->SetDataExtentToWholeExtent();
char *ImageData;
// flip mbi logo around y axis and change color order
ImageData = new char[mbiLogo_Height * mbiLogo_Width * mbiLogo_NumberOfScalars];
unsigned int column, row;
char *dest = ImageData;
char *source = (char *)&mbiLogo_Data[0];
;
char r, g, b, a;
for (column = 0; column < mbiLogo_Height; column++)
for (row = 0; row < mbiLogo_Width; row++)
{ // change r with b
b = *source++;
g = *source++;
r = *source++;
a = *source++;
*dest++ = r;
*dest++ = g;
*dest++ = b;
*dest++ = a;
}
m_VtkImageImport->SetImportVoidPointer(ImageData);
m_VtkImageImport->Modified();
m_VtkImageImport->Update();
return m_VtkImageImport->GetOutput();
}
-void mitk::LogoOverlay::SetLogoImagePath(std::string path)
+void mitk::LogoAnnotation::SetLogoImagePath(std::string path)
{
- SetStringProperty("Overlay.LogoImagePath", path.c_str());
+ SetStringProperty("Annotation.LogoImagePath", path.c_str());
Modified();
}
-std::string mitk::LogoOverlay::GetLogoImagePath() const
+std::string mitk::LogoAnnotation::GetLogoImagePath() const
{
std::string path;
- GetPropertyList()->GetStringProperty("Overlay.LogoImagePath", path);
+ GetPropertyList()->GetStringProperty("Annotation.LogoImagePath", path);
return path;
}
-void mitk::LogoOverlay::SetOffsetVector(const Point2D &OffsetVector, mitk::BaseRenderer *renderer)
+void mitk::LogoAnnotation::SetOffsetVector(const Point2D &OffsetVector)
{
mitk::Point2dProperty::Pointer OffsetVectorProperty = mitk::Point2dProperty::New(OffsetVector);
- SetProperty("Overlay.OffsetVector", OffsetVectorProperty.GetPointer(), renderer);
+ SetProperty("Annotation.OffsetVector", OffsetVectorProperty.GetPointer());
Modified();
}
-mitk::Point2D mitk::LogoOverlay::GetOffsetVector(mitk::BaseRenderer *renderer) const
+mitk::Point2D mitk::LogoAnnotation::GetOffsetVector() const
{
mitk::Point2D OffsetVector;
OffsetVector.Fill(0);
- GetPropertyValue("Overlay.OffsetVector", OffsetVector, renderer);
+ GetPropertyValue("Annotation.OffsetVector", OffsetVector);
return OffsetVector;
}
-void mitk::LogoOverlay::SetCornerPosition(const int &corner, mitk::BaseRenderer *renderer)
+void mitk::LogoAnnotation::SetCornerPosition(const int &corner)
{
- SetIntProperty("Overlay.CornerPosition", corner, renderer);
+ SetIntProperty("Annotation.CornerPosition", corner);
Modified();
}
-int mitk::LogoOverlay::GetCornerPosition(mitk::BaseRenderer *renderer) const
+int mitk::LogoAnnotation::GetCornerPosition() const
{
int corner = 0;
- GetIntProperty("Overlay.CornerPosition", corner, renderer);
+ GetIntProperty("Annotation.CornerPosition", corner);
return corner;
}
-void mitk::LogoOverlay::SetRelativeSize(const float &size, mitk::BaseRenderer *renderer)
+void mitk::LogoAnnotation::SetRelativeSize(const float &size)
{
- SetFloatProperty("Overlay.RelativeSize", size, renderer);
+ SetFloatProperty("Annotation.RelativeSize", size);
Modified();
}
-float mitk::LogoOverlay::GetRelativeSize(mitk::BaseRenderer *renderer) const
+float mitk::LogoAnnotation::GetRelativeSize() const
{
float size = 0;
- GetFloatProperty("Overlay.RelativeSize", size, renderer);
+ GetFloatProperty("Annotation.RelativeSize", size);
return size;
}
-vtkProp *mitk::LogoOverlay::GetVtkProp(BaseRenderer *renderer) const
+vtkProp *mitk::LogoAnnotation::GetVtkProp(BaseRenderer *renderer) const
{
LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
return ls->m_LogoRep;
}
diff --git a/Modules/Annotation/src/mitkManualPlacementAnnotationRenderer.cpp b/Modules/Annotation/src/mitkManualPlacementAnnotationRenderer.cpp
new file mode 100644
index 0000000000..14926d0e7d
--- /dev/null
+++ b/Modules/Annotation/src/mitkManualPlacementAnnotationRenderer.cpp
@@ -0,0 +1,60 @@
+/*===================================================================
+
+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 "mitkManualPlacementAnnotationRenderer.h"
+#include "mitkBaseRenderer.h"
+
+#include "mitkAnnotationUtils.h"
+#include
+
+namespace mitk
+{
+ const std::string ManualPlacementAnnotationRenderer::ANNOTATIONRENDERER_ID = "ManualPlacementAnnotationRenderer";
+
+ ManualPlacementAnnotationRenderer::ManualPlacementAnnotationRenderer(const std::string &rendererId)
+ : AbstractAnnotationRenderer(rendererId, ManualPlacementAnnotationRenderer::ANNOTATIONRENDERER_ID)
+ {
+ }
+ ManualPlacementAnnotationRenderer::~ManualPlacementAnnotationRenderer() {}
+ ManualPlacementAnnotationRenderer *ManualPlacementAnnotationRenderer::GetAnnotationRenderer(const std::string &rendererID)
+ {
+ ManualPlacementAnnotationRenderer *result = nullptr;
+ AbstractAnnotationRenderer *registeredService =
+ AnnotationUtils::GetAnnotationRenderer(ANNOTATIONRENDERER_ID, rendererID);
+ if (registeredService)
+ result = dynamic_cast(registeredService);
+ if (!result)
+ {
+ result = new ManualPlacementAnnotationRenderer(rendererID);
+ AnnotationUtils::RegisterAnnotationRenderer(result);
+ }
+ return result;
+ }
+
+ void ManualPlacementAnnotationRenderer::AddAnnotation(Annotation *Annotation, const std::string &rendererID)
+ {
+ GetAnnotationRenderer(rendererID); // rename ??
+ us::ServiceProperties props;
+ props[Annotation::US_PROPKEY_AR_ID] = ANNOTATIONRENDERER_ID;
+ props[Annotation::US_PROPKEY_RENDERER_ID] = rendererID;
+ Annotation->RegisterAsMicroservice(props);
+ }
+
+ void ManualPlacementAnnotationRenderer::AddAnnotation(Annotation *Annotation, BaseRenderer *renderer)
+ {
+ AddAnnotation(Annotation, renderer->GetName());
+ }
+}
diff --git a/Modules/Annotation/src/mitkScaleLegendAnnotation.cpp b/Modules/Annotation/src/mitkScaleLegendAnnotation.cpp
new file mode 100644
index 0000000000..9e4926da1d
--- /dev/null
+++ b/Modules/Annotation/src/mitkScaleLegendAnnotation.cpp
@@ -0,0 +1,216 @@
+/*===================================================================
+
+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 "mitkScaleLegendAnnotation.h"
+#include
+#include
+#include
+
+mitk::ScaleLegendAnnotation::ScaleLegendAnnotation()
+{
+ SetRightAxisVisibility(true);
+ SetLeftAxisVisibility(true);
+ SetTopAxisVisibility(true);
+ SetBottomAxisVisibility(true);
+ SetLegendVisibility(true);
+ SetRightBorderOffset(50);
+ SetLeftBorderOffset(50);
+ SetTopBorderOffset(30);
+ SetBottomBorderOffset(30);
+ SetCornerOffsetFactor(2.0);
+ SetFontFactor(1.0);
+}
+
+mitk::ScaleLegendAnnotation::~ScaleLegendAnnotation()
+{
+ for (BaseRenderer *renderer : m_LSH.GetRegisteredBaseRenderer())
+ {
+ if (renderer)
+ {
+ this->RemoveFromBaseRenderer(renderer);
+ }
+ }
+}
+
+mitk::ScaleLegendAnnotation::LocalStorage::~LocalStorage()
+{
+}
+
+mitk::ScaleLegendAnnotation::LocalStorage::LocalStorage()
+{
+ m_legendScaleActor = vtkSmartPointer::New();
+}
+
+void mitk::ScaleLegendAnnotation::UpdateVtkAnnotation(mitk::BaseRenderer *renderer)
+{
+ LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
+
+ if (ls->IsGenerateDataRequired(renderer, this))
+ {
+ ls->m_legendScaleActor->SetRightAxisVisibility(this->GetRightAxisVisibility());
+ ls->m_legendScaleActor->SetTopAxisVisibility(this->GetTopAxisVisibility());
+ ls->m_legendScaleActor->SetLeftAxisVisibility(this->GetLeftAxisVisibility());
+ ls->m_legendScaleActor->SetBottomAxisVisibility(this->GetBottomAxisVisibility());
+ ls->m_legendScaleActor->SetLegendVisibility(this->GetLegendVisibility());
+ ls->m_legendScaleActor->SetRightBorderOffset(this->GetRightBorderOffset());
+ ls->m_legendScaleActor->SetLeftBorderOffset(this->GetLeftBorderOffset());
+ ls->m_legendScaleActor->SetTopBorderOffset(this->GetTopBorderOffset());
+ ls->m_legendScaleActor->SetBottomBorderOffset(this->GetBottomBorderOffset());
+ ls->m_legendScaleActor->SetCornerOffsetFactor(this->GetCornerOffsetFactor());
+ ls->m_legendScaleActor->GetLeftAxis()->SetFontFactor(this->GetFontFactor());
+ ls->m_legendScaleActor->GetRightAxis()->SetFontFactor(this->GetFontFactor());
+ ls->m_legendScaleActor->GetTopAxis()->SetFontFactor(this->GetFontFactor());
+ ls->m_legendScaleActor->GetBottomAxis()->SetFontFactor(this->GetFontFactor());
+ }
+}
+
+vtkProp *mitk::ScaleLegendAnnotation::GetVtkProp(BaseRenderer *renderer) const
+{
+ LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
+ return ls->m_legendScaleActor;
+}
+
+void mitk::ScaleLegendAnnotation::SetRightAxisVisibility(bool visibility)
+{
+ SetBoolProperty("ScaleLegendAnnotation.RightAxisVisibility", visibility);
+}
+
+bool mitk::ScaleLegendAnnotation::GetRightAxisVisibility() const
+{
+ bool visibility;
+ GetPropertyList()->GetBoolProperty("ScaleLegendAnnotation.RightAxisVisibility", visibility);
+ return visibility;
+}
+
+void mitk::ScaleLegendAnnotation::SetLeftAxisVisibility(bool visibility)
+{
+ SetBoolProperty("ScaleLegendAnnotation.LeftAxisVisibility", visibility);
+}
+
+bool mitk::ScaleLegendAnnotation::GetLeftAxisVisibility() const
+{
+ bool visibility;
+ GetPropertyList()->GetBoolProperty("ScaleLegendAnnotation.LeftAxisVisibility", visibility);
+ return visibility;
+}
+
+void mitk::ScaleLegendAnnotation::SetTopAxisVisibility(bool visibility)
+{
+ SetBoolProperty("ScaleLegendAnnotation.TopAxisVisibility", visibility);
+}
+
+bool mitk::ScaleLegendAnnotation::GetTopAxisVisibility() const
+{
+ bool visibility;
+ GetPropertyList()->GetBoolProperty("ScaleLegendAnnotation.TopAxisVisibility", visibility);
+ return visibility;
+}
+
+void mitk::ScaleLegendAnnotation::SetBottomAxisVisibility(bool visibility)
+{
+ SetBoolProperty("ScaleLegendAnnotation.BottomAxisVisibility", visibility);
+}
+
+bool mitk::ScaleLegendAnnotation::GetBottomAxisVisibility() const
+{
+ bool visibility;
+ GetPropertyList()->GetBoolProperty("ScaleLegendAnnotation.BottomAxisVisibility", visibility);
+ return visibility;
+}
+
+void mitk::ScaleLegendAnnotation::SetLegendVisibility(bool visibility)
+{
+ SetBoolProperty("ScaleLegendAnnotation.SetLegendVisibility", visibility);
+}
+
+bool mitk::ScaleLegendAnnotation::GetLegendVisibility() const
+{
+ bool visibility;
+ GetPropertyList()->GetBoolProperty("ScaleLegendAnnotation.SetLegendVisibility", visibility);
+ return visibility;
+}
+
+void mitk::ScaleLegendAnnotation::SetRightBorderOffset(int offset)
+{
+ SetIntProperty("ScaleLegendAnnotation.RightBorderOffset", offset);
+}
+
+int mitk::ScaleLegendAnnotation::GetRightBorderOffset() const
+{
+ int offset;
+ GetPropertyList()->GetIntProperty("ScaleLegendAnnotation.RightBorderOffset", offset);
+ return offset;
+}
+
+void mitk::ScaleLegendAnnotation::SetLeftBorderOffset(int offset)
+{
+ SetIntProperty("ScaleLegendAnnotation.LeftBorderOffset", offset);
+}
+
+int mitk::ScaleLegendAnnotation::GetLeftBorderOffset() const
+{
+ int offset;
+ GetPropertyList()->GetIntProperty("ScaleLegendAnnotation.LeftBorderOffset", offset);
+ return offset;
+}
+
+void mitk::ScaleLegendAnnotation::SetTopBorderOffset(int offset)
+{
+ SetIntProperty("ScaleLegendAnnotation.TopBorderOffset", offset);
+}
+
+int mitk::ScaleLegendAnnotation::GetTopBorderOffset() const
+{
+ int offset;
+ GetPropertyList()->GetIntProperty("ScaleLegendAnnotation.TopBorderOffset", offset);
+ return offset;
+}
+
+void mitk::ScaleLegendAnnotation::SetBottomBorderOffset(int offset)
+{
+ SetIntProperty("ScaleLegendAnnotation.BottomBorderOffset", offset);
+}
+
+int mitk::ScaleLegendAnnotation::GetBottomBorderOffset() const
+{
+ int offset;
+ GetPropertyList()->GetIntProperty("ScaleLegendAnnotation.BottomBorderOffset", offset);
+ return offset;
+}
+
+void mitk::ScaleLegendAnnotation::SetCornerOffsetFactor(double offsetFactor)
+{
+ SetDoubleProperty("ScaleLegendAnnotation.CornerOffsetFactor", offsetFactor);
+}
+
+double mitk::ScaleLegendAnnotation::GetCornerOffsetFactor() const
+{
+ double offsetFactor;
+ GetPropertyList()->GetDoubleProperty("ScaleLegendAnnotation.CornerOffsetFactor", offsetFactor);
+ return offsetFactor;
+}
+
+void mitk::ScaleLegendAnnotation::SetFontFactor(double fontFactor)
+{
+ SetDoubleProperty("ScaleLegendAnnotation.FontFactor", fontFactor);
+}
+
+double mitk::ScaleLegendAnnotation::GetFontFactor() const
+{
+ double offsetFactor;
+ GetPropertyList()->GetDoubleProperty("ScaleLegendAnnotation.FontFactor", offsetFactor);
+ return offsetFactor;
+}
diff --git a/Modules/Overlays/mitkTextOverlay2D.cpp b/Modules/Annotation/src/mitkTextAnnotation2D.cpp
similarity index 78%
rename from Modules/Overlays/mitkTextOverlay2D.cpp
rename to Modules/Annotation/src/mitkTextAnnotation2D.cpp
index b1807b2d5f..c7d9107b58 100644
--- a/Modules/Overlays/mitkTextOverlay2D.cpp
+++ b/Modules/Annotation/src/mitkTextAnnotation2D.cpp
@@ -1,152 +1,159 @@
/*===================================================================
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 "mitkTextOverlay2D.h"
+#include "mitkTextAnnotation2D.h"
#include "vtkUnicodeString.h"
#include
#include
#include
-mitk::TextOverlay2D::TextOverlay2D()
+mitk::TextAnnotation2D::TextAnnotation2D()
{
mitk::Point2D position;
position[0] = position[1] = 0;
this->SetPosition2D(position);
this->SetOffsetVector(position);
this->SetText("");
this->SetFontSize(20);
this->SetColor(1.0, 1.0, 1.0);
this->SetStringProperty("font.family", "Arial");
this->SetBoolProperty("font.bold", false);
this->SetBoolProperty("font.italic", false);
this->SetBoolProperty("drawShadow", false);
}
-mitk::TextOverlay2D::~TextOverlay2D()
+mitk::TextAnnotation2D::~TextAnnotation2D()
{
+ for (BaseRenderer *renderer : m_LSH.GetRegisteredBaseRenderer())
+ {
+ if (renderer)
+ {
+ this->RemoveFromBaseRenderer(renderer);
+ }
+ }
}
-mitk::Overlay::Bounds mitk::TextOverlay2D::GetBoundsOnDisplay(mitk::BaseRenderer *renderer) const
+mitk::Annotation::Bounds mitk::TextAnnotation2D::GetBoundsOnDisplay(mitk::BaseRenderer *renderer) const
{
LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
- mitk::Overlay::Bounds bounds;
+ mitk::Annotation::Bounds bounds;
bounds.Position = ls->m_TextActor->GetPosition();
double size[2];
ls->m_TextActor->GetSize(renderer->GetVtkRenderer(), size);
bounds.Size[0] = size[0];
bounds.Size[1] = size[1];
return bounds;
}
-void mitk::TextOverlay2D::SetBoundsOnDisplay(mitk::BaseRenderer *renderer, const mitk::Overlay::Bounds &bounds)
+void mitk::TextAnnotation2D::SetBoundsOnDisplay(mitk::BaseRenderer *renderer, const mitk::Annotation::Bounds &bounds)
{
LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
mitk::Point2D posT, posS;
posT[0] = bounds.Position[0];
posT[1] = bounds.Position[1];
posS[0] = posT[0] + 1;
posS[1] = posT[1] - 1;
ls->m_TextActor->SetDisplayPosition(posT[0], posT[1]);
ls->m_STextActor->SetDisplayPosition(posS[0], posS[1]);
}
-mitk::TextOverlay2D::LocalStorage::~LocalStorage()
+mitk::TextAnnotation2D::LocalStorage::~LocalStorage()
{
}
-mitk::TextOverlay2D::LocalStorage::LocalStorage()
+mitk::TextAnnotation2D::LocalStorage::LocalStorage()
{
m_TextActor = vtkSmartPointer::New();
m_TextProp = vtkSmartPointer::New();
m_STextActor = vtkSmartPointer::New();
m_STextProp = vtkSmartPointer::New();
m_TextActor->SetTextProperty(m_TextProp);
m_STextActor->SetTextProperty(m_STextProp);
m_Assembly = vtkSmartPointer::New();
m_Assembly->AddPart(m_STextActor);
m_Assembly->AddPart(m_TextActor);
}
-void mitk::TextOverlay2D::UpdateVtkOverlay2D(mitk::BaseRenderer *renderer)
+void mitk::TextAnnotation2D::UpdateVtkAnnotation2D(mitk::BaseRenderer *renderer)
{
LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
if (ls->IsGenerateDataRequired(renderer, this))
{
float color[3] = {0.0, 1.0, 0.0};
float opacity = 1.0;
- GetColor(color, renderer);
- GetOpacity(opacity, renderer);
+ GetColor(color);
+ GetOpacity(opacity);
ls->m_TextProp->SetColor(color[0], color[1], color[2]);
ls->m_STextProp->SetColor(0, 0, 0);
ls->m_TextProp->SetFontSize(GetFontSize());
ls->m_TextProp->SetOpacity(opacity);
ls->m_STextProp->SetFontSize(GetFontSize());
ls->m_STextProp->SetOpacity(opacity);
std::string fontFamilyAsString;
if (GetStringProperty("font.family", fontFamilyAsString) == false)
{
fontFamilyAsString = "Arial";
}
ls->m_TextProp->SetFontFamilyAsString(fontFamilyAsString.c_str());
ls->m_STextProp->SetFontFamilyAsString(fontFamilyAsString.c_str());
bool boldFont(false);
GetBoolProperty("font.bold", boldFont);
ls->m_TextProp->SetBold(boldFont);
ls->m_STextProp->SetBold(boldFont);
bool italicFont(false);
GetBoolProperty("font.italic", italicFont);
ls->m_TextProp->SetBold(italicFont);
ls->m_STextProp->SetBold(italicFont);
bool drawShadow;
GetBoolProperty("drawShadow", drawShadow);
ls->m_TextProp->SetShadow(false);
ls->m_STextProp->SetShadow(false);
ls->m_STextActor->SetVisibility(drawShadow);
ls->m_TextActor->SetInput(GetText().c_str());
ls->m_STextActor->SetInput(GetText().c_str());
mitk::Point2D posT, posS;
- posT[0] = GetPosition2D(renderer)[0] + GetOffsetVector(renderer)[0];
- posT[1] = GetPosition2D(renderer)[1] + GetOffsetVector(renderer)[1];
+ posT[0] = GetPosition2D()[0] + GetOffsetVector()[0];
+ posT[1] = GetPosition2D()[1] + GetOffsetVector()[1];
posS[0] = posT[0] + 1;
posS[1] = posT[1] - 1;
ls->m_TextActor->SetDisplayPosition(posT[0], posT[1]);
ls->m_STextActor->SetDisplayPosition(posS[0], posS[1]);
ls->UpdateGenerateDataTime();
}
}
-vtkProp *mitk::TextOverlay2D::GetVtkProp(mitk::BaseRenderer *renderer) const
+vtkProp *mitk::TextAnnotation2D::GetVtkProp(mitk::BaseRenderer *renderer) const
{
LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
return ls->m_Assembly;
}
-vtkActor2D *mitk::TextOverlay2D::GetVtkActor2D(BaseRenderer *renderer) const
+vtkActor2D *mitk::TextAnnotation2D::GetVtkActor2D(BaseRenderer *renderer) const
{
LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
return ls->m_TextActor;
}
diff --git a/Modules/Overlays/mitkTextOverlay3D.cpp b/Modules/Annotation/src/mitkTextAnnotation3D.cpp
similarity index 80%
rename from Modules/Overlays/mitkTextOverlay3D.cpp
rename to Modules/Annotation/src/mitkTextAnnotation3D.cpp
index 71cdb11cae..1f4e571766 100644
--- a/Modules/Overlays/mitkTextOverlay3D.cpp
+++ b/Modules/Annotation/src/mitkTextAnnotation3D.cpp
@@ -1,105 +1,112 @@
/*===================================================================
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 "mitkTextOverlay3D.h"
+#include "mitkTextAnnotation3D.h"
#include
#include
#include
#include
#include
#include
#include
#include
-mitk::TextOverlay3D::TextOverlay3D()
+mitk::TextAnnotation3D::TextAnnotation3D()
{
mitk::Point3D position;
position.Fill(0);
this->SetPosition3D(position);
this->SetOffsetVector(position);
this->SetText("");
this->SetFontSize(20);
this->SetColor(1.0, 1.0, 1.0);
}
-mitk::TextOverlay3D::~TextOverlay3D()
+mitk::TextAnnotation3D::~TextAnnotation3D()
{
+ for (BaseRenderer *renderer : m_LSH.GetRegisteredBaseRenderer())
+ {
+ if (renderer)
+ {
+ this->RemoveFromBaseRenderer(renderer);
+ }
+ }
}
-mitk::TextOverlay3D::LocalStorage::~LocalStorage()
+mitk::TextAnnotation3D::LocalStorage::~LocalStorage()
{
}
-mitk::TextOverlay3D::LocalStorage::LocalStorage()
+mitk::TextAnnotation3D::LocalStorage::LocalStorage()
{
// Create some text
m_textSource = vtkSmartPointer::New();
// Create a mapper
vtkSmartPointer mapper = vtkSmartPointer::New();
mapper->SetInputConnection(m_textSource->GetOutputPort());
// Create a subclass of vtkActor: a vtkFollower that remains facing the camera
m_follower = vtkSmartPointer::New();
m_follower->SetMapper(mapper);
m_follower->GetProperty()->SetColor(1, 0, 0); // red
m_follower->SetScale(1);
}
-void mitk::TextOverlay3D::UpdateVtkOverlay(mitk::BaseRenderer *renderer)
+void mitk::TextAnnotation3D::UpdateVtkAnnotation(mitk::BaseRenderer *renderer)
{
LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
if (ls->IsGenerateDataRequired(renderer, this))
{
- Point3D pos3d = GetPosition3D(renderer);
+ Point3D pos3d = GetPosition3D();
vtkRenderer *vtkRender = renderer->GetVtkRenderer();
if (vtkRender)
{
vtkCamera *camera = vtkRender->GetActiveCamera();
ls->m_follower->SetCamera(camera);
if (camera != nullptr)
{
// calculate the offset relative to the camera's view direction
- Point3D offset = GetOffsetVector(renderer);
+ Point3D offset = GetOffsetVector();
Vector3D viewUp;
camera->GetViewUp(viewUp.GetDataPointer());
Vector3D cameraDirection;
camera->GetDirectionOfProjection(cameraDirection.GetDataPointer());
Vector3D viewRight;
vtkMath::Cross(cameraDirection.GetDataPointer(), viewUp.GetDataPointer(), viewRight.GetDataPointer());
pos3d = pos3d + viewRight * offset[0] + viewUp * offset[1] + cameraDirection * offset[2];
}
}
ls->m_follower->SetPosition(pos3d.GetDataPointer());
ls->m_textSource->SetText(GetText().c_str());
float color[3] = {1, 1, 1};
float opacity = 1.0;
- GetColor(color, renderer);
- GetOpacity(opacity, renderer);
+ GetColor(color);
+ GetOpacity(opacity);
ls->m_follower->GetProperty()->SetColor(color[0], color[1], color[2]);
ls->m_follower->GetProperty()->SetOpacity(opacity);
ls->m_follower->SetScale(this->GetFontSize());
ls->UpdateGenerateDataTime();
}
}
-vtkProp *mitk::TextOverlay3D::GetVtkProp(BaseRenderer *renderer) const
+vtkProp *mitk::TextAnnotation3D::GetVtkProp(BaseRenderer *renderer) const
{
LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
return ls->m_follower;
}
diff --git a/Modules/Core/src/Rendering/mitkVtkOverlay.cpp b/Modules/Annotation/src/mitkVtkAnnotation.cpp
similarity index 72%
rename from Modules/Core/src/Rendering/mitkVtkOverlay.cpp
rename to Modules/Annotation/src/mitkVtkAnnotation.cpp
index 3ea51f2241..07b7ce68ea 100644
--- a/Modules/Core/src/Rendering/mitkVtkOverlay.cpp
+++ b/Modules/Annotation/src/mitkVtkAnnotation.cpp
@@ -1,87 +1,87 @@
/*===================================================================
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 "mitkVtkOverlay.h"
+#include "mitkVtkAnnotation.h"
#include
#include
-mitk::VtkOverlay::VtkOverlay()
+mitk::VtkAnnotation::VtkAnnotation()
{
}
-mitk::VtkOverlay::~VtkOverlay()
+mitk::VtkAnnotation::~VtkAnnotation()
{
}
-void mitk::VtkOverlay::Update(mitk::BaseRenderer *renderer)
+void mitk::VtkAnnotation::Update(mitk::BaseRenderer *renderer)
{
vtkSmartPointer prop = GetVtkProp(renderer);
- if (!IsVisible(renderer))
+ if (!IsVisible())
{
prop->SetVisibility(false);
return;
}
else
{
prop->SetVisibility(true);
- UpdateVtkOverlay(renderer);
+ UpdateVtkAnnotation(renderer);
}
}
-void mitk::VtkOverlay::AddToBaseRenderer(mitk::BaseRenderer *renderer)
+void mitk::VtkAnnotation::AddToBaseRenderer(mitk::BaseRenderer *renderer)
{
if (!renderer)
return;
AddToRenderer(renderer, renderer->GetVtkRenderer());
}
-void mitk::VtkOverlay::AddToRenderer(mitk::BaseRenderer *renderer, vtkRenderer *vtkrenderer)
+void mitk::VtkAnnotation::AddToRenderer(mitk::BaseRenderer *renderer, vtkRenderer *vtkrenderer)
{
if (!renderer || !vtkrenderer)
return;
Update(renderer);
vtkSmartPointer vtkProp = GetVtkProp(renderer);
if (renderer && vtkrenderer && !vtkrenderer->HasViewProp(vtkProp))
{
vtkrenderer->AddViewProp(vtkProp);
mitk::RenderingManager::GetInstance()->RequestUpdate(vtkrenderer->GetRenderWindow());
}
}
-void mitk::VtkOverlay::RemoveFromBaseRenderer(mitk::BaseRenderer *renderer)
+void mitk::VtkAnnotation::RemoveFromBaseRenderer(mitk::BaseRenderer *renderer)
{
if (!renderer)
return;
RemoveFromRenderer(renderer, renderer->GetVtkRenderer());
}
-void mitk::VtkOverlay::RemoveFromRenderer(mitk::BaseRenderer *renderer, vtkRenderer *vtkrenderer)
+void mitk::VtkAnnotation::RemoveFromRenderer(mitk::BaseRenderer *renderer, vtkRenderer *vtkrenderer)
{
if (!renderer || !vtkrenderer)
return;
vtkSmartPointer vtkProp = GetVtkProp(renderer);
if (vtkrenderer->HasViewProp(vtkProp))
{
vtkrenderer->RemoveViewProp(vtkProp);
mitk::RenderingManager::GetInstance()->RequestUpdate(vtkrenderer->GetRenderWindow());
}
}
-void mitk::VtkOverlay::Paint(BaseRenderer *renderer)
+void mitk::VtkAnnotation::Paint(BaseRenderer *renderer)
{
GetVtkProp(renderer)->RenderOpaqueGeometry(renderer->GetVtkRenderer());
GetVtkProp(renderer)->RenderOverlay(renderer->GetVtkRenderer());
}
diff --git a/Modules/Core/src/Rendering/mitkVtkOverlay2D.cpp b/Modules/Annotation/src/mitkVtkAnnotation2D.cpp
similarity index 54%
rename from Modules/Core/src/Rendering/mitkVtkOverlay2D.cpp
rename to Modules/Annotation/src/mitkVtkAnnotation2D.cpp
index 1f3fa7cbfc..ebbdc2b12e 100644
--- a/Modules/Core/src/Rendering/mitkVtkOverlay2D.cpp
+++ b/Modules/Annotation/src/mitkVtkAnnotation2D.cpp
@@ -1,90 +1,90 @@
/*===================================================================
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 "mitkVtkOverlay2D.h"
+#include "mitkVtkAnnotation2D.h"
#include
#include
#include
-mitk::VtkOverlay2D::VtkOverlay2D()
+mitk::VtkAnnotation2D::VtkAnnotation2D()
{
}
-mitk::VtkOverlay2D::~VtkOverlay2D()
+mitk::VtkAnnotation2D::~VtkAnnotation2D()
{
}
-mitk::Overlay::Bounds mitk::VtkOverlay2D::GetBoundsOnDisplay(mitk::BaseRenderer *renderer) const
+mitk::Annotation::Bounds mitk::VtkAnnotation2D::GetBoundsOnDisplay(mitk::BaseRenderer *renderer) const
{
- mitk::Overlay::Bounds bounds;
+ mitk::Annotation::Bounds bounds;
vtkSmartPointer actor = GetVtkActor2D(renderer);
bounds.Position = actor->GetPosition();
bounds.Size = actor->GetPosition2();
return bounds;
}
-void mitk::VtkOverlay2D::SetBoundsOnDisplay(mitk::BaseRenderer *renderer, const mitk::Overlay::Bounds &bounds)
+void mitk::VtkAnnotation2D::SetBoundsOnDisplay(mitk::BaseRenderer *renderer, const mitk::Annotation::Bounds &bounds)
{
vtkSmartPointer actor = GetVtkActor2D(renderer);
actor->SetDisplayPosition(bounds.Position[0], bounds.Position[1]);
actor->SetWidth(bounds.Size[0]);
actor->SetHeight(bounds.Size[1]);
}
-void mitk::VtkOverlay2D::UpdateVtkOverlay(mitk::BaseRenderer *renderer)
+void mitk::VtkAnnotation2D::UpdateVtkAnnotation(mitk::BaseRenderer *renderer)
{
vtkActor2D *prop = GetVtkActor2D(renderer);
float color[3] = {1, 1, 1};
float opacity = 1.0;
- GetColor(color, renderer);
- GetOpacity(opacity, renderer);
+ GetColor(color);
+ GetOpacity(opacity);
prop->GetProperty()->SetColor(color[0], color[1], color[2]);
prop->GetProperty()->SetOpacity(opacity);
- UpdateVtkOverlay2D(renderer);
+ UpdateVtkAnnotation2D(renderer);
}
-void mitk::VtkOverlay2D::SetPosition2D(const Point2D &position2D, mitk::BaseRenderer *renderer)
+void mitk::VtkAnnotation2D::SetPosition2D(const Point2D &position2D)
{
mitk::Point2dProperty::Pointer position2dProperty = mitk::Point2dProperty::New(position2D);
- SetProperty("VtkOverlay2D.Position2D", position2dProperty.GetPointer(), renderer);
+ SetProperty("VtkAnnotation2D.Position2D", position2dProperty.GetPointer());
}
-mitk::Point2D mitk::VtkOverlay2D::GetPosition2D(mitk::BaseRenderer *renderer) const
+mitk::Point2D mitk::VtkAnnotation2D::GetPosition2D() const
{
mitk::Point2D position2D;
position2D.Fill(0);
- GetPropertyValue("VtkOverlay2D.Position2D", position2D, renderer);
+ GetPropertyValue("VtkAnnotation2D.Position2D", position2D);
return position2D;
}
-void mitk::VtkOverlay2D::SetOffsetVector(const Point2D &OffsetVector, mitk::BaseRenderer *renderer)
+void mitk::VtkAnnotation2D::SetOffsetVector(const Point2D &OffsetVector)
{
mitk::Point2dProperty::Pointer OffsetVectorProperty = mitk::Point2dProperty::New(OffsetVector);
- SetProperty("VtkOverlay2D.OffsetVector", OffsetVectorProperty.GetPointer(), renderer);
+ SetProperty("VtkAnnotation2D.OffsetVector", OffsetVectorProperty.GetPointer());
}
-mitk::Point2D mitk::VtkOverlay2D::GetOffsetVector(mitk::BaseRenderer *renderer) const
+mitk::Point2D mitk::VtkAnnotation2D::GetOffsetVector() const
{
mitk::Point2D OffsetVector;
OffsetVector.Fill(0);
- GetPropertyValue("VtkOverlay2D.OffsetVector", OffsetVector, renderer);
+ GetPropertyValue("VtkAnnotation2D.OffsetVector", OffsetVector);
return OffsetVector;
}
-vtkProp *mitk::VtkOverlay2D::GetVtkProp(mitk::BaseRenderer *renderer) const
+vtkProp *mitk::VtkAnnotation2D::GetVtkProp(mitk::BaseRenderer *renderer) const
{
return GetVtkActor2D(renderer);
}
diff --git a/Modules/Core/src/Rendering/mitkVtkOverlay3D.cpp b/Modules/Annotation/src/mitkVtkAnnotation3D.cpp
similarity index 54%
rename from Modules/Core/src/Rendering/mitkVtkOverlay3D.cpp
rename to Modules/Annotation/src/mitkVtkAnnotation3D.cpp
index c4cabd1036..d6fc4d25a2 100644
--- a/Modules/Core/src/Rendering/mitkVtkOverlay3D.cpp
+++ b/Modules/Annotation/src/mitkVtkAnnotation3D.cpp
@@ -1,56 +1,56 @@
/*===================================================================
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 "mitkVtkOverlay3D.h"
+#include "mitkVtkAnnotation3D.h"
-mitk::VtkOverlay3D::VtkOverlay3D()
+mitk::VtkAnnotation3D::VtkAnnotation3D()
{
mitk::Point3D offsetVector;
offsetVector.Fill(0);
SetOffsetVector(offsetVector);
}
-mitk::VtkOverlay3D::~VtkOverlay3D()
+mitk::VtkAnnotation3D::~VtkAnnotation3D()
{
}
-void mitk::VtkOverlay3D::SetPosition3D(const Point3D &position3D, mitk::BaseRenderer *renderer)
+void mitk::VtkAnnotation3D::SetPosition3D(const Point3D &position3D)
{
mitk::Point3dProperty::Pointer position3dProperty = mitk::Point3dProperty::New(position3D);
- SetProperty("VtkOverlay3D.Position3D", position3dProperty.GetPointer(), renderer);
+ SetProperty("VtkAnnotation3D.Position3D", position3dProperty.GetPointer());
}
-mitk::Point3D mitk::VtkOverlay3D::GetPosition3D(mitk::BaseRenderer *renderer) const
+mitk::Point3D mitk::VtkAnnotation3D::GetPosition3D() const
{
mitk::Point3D position3D;
position3D.Fill(0);
- GetPropertyValue("VtkOverlay3D.Position3D", position3D, renderer);
+ GetPropertyValue("VtkAnnotation3D.Position3D", position3D);
return position3D;
}
-void mitk::VtkOverlay3D::SetOffsetVector(const Point3D &OffsetVector, mitk::BaseRenderer *renderer)
+void mitk::VtkAnnotation3D::SetOffsetVector(const Point3D &OffsetVector)
{
mitk::Point3dProperty::Pointer OffsetVectorProperty = mitk::Point3dProperty::New(OffsetVector);
- SetProperty("VtkOverlay3D.OffsetVector", OffsetVectorProperty.GetPointer(), renderer);
+ SetProperty("VtkAnnotation3D.OffsetVector", OffsetVectorProperty.GetPointer());
}
-mitk::Point3D mitk::VtkOverlay3D::GetOffsetVector(mitk::BaseRenderer *renderer) const
+mitk::Point3D mitk::VtkAnnotation3D::GetOffsetVector() const
{
mitk::Point3D OffsetVector;
OffsetVector.Fill(0);
- GetPropertyValue("VtkOverlay3D.OffsetVector", OffsetVector, renderer);
+ GetPropertyValue("VtkAnnotation3D.OffsetVector", OffsetVector);
return OffsetVector;
}
diff --git a/Modules/Overlays/mitkVtkLogoRepresentation.cxx b/Modules/Annotation/src/mitkVtkLogoRepresentation.cxx
similarity index 100%
rename from Modules/Overlays/mitkVtkLogoRepresentation.cxx
rename to Modules/Annotation/src/mitkVtkLogoRepresentation.cxx
diff --git a/Modules/Annotation/test/CMakeLists.txt b/Modules/Annotation/test/CMakeLists.txt
new file mode 100644
index 0000000000..153cd81e2e
--- /dev/null
+++ b/Modules/Annotation/test/CMakeLists.txt
@@ -0,0 +1 @@
+MITK_CREATE_MODULE_TESTS()
diff --git a/Modules/Annotation/test/files.cmake b/Modules/Annotation/test/files.cmake
new file mode 100644
index 0000000000..8b6efdd163
--- /dev/null
+++ b/Modules/Annotation/test/files.cmake
@@ -0,0 +1,18 @@
+
+set(MODULE_TESTS
+ mitkAnnotationTest.cpp
+)
+
+if(MITK_ENABLE_RENDERING_TESTING)
+set(MODULE_TESTS
+ ${MODULE_TESTS}
+ mitkManualPlacementAnnotationRendererTest.cpp
+ mitkColorBarAnnotationTest.cpp
+ mitkLabelAnnotation3DTest.cpp
+ mitkLogoAnnotationTest.cpp
+ mitkLayoutAnnotationRendererTest.cpp
+ mitkScaleLegendAnnotationTest.cpp
+ mitkTextAnnotation2DTest.cpp
+ mitkTextAnnotation3DTest.cpp
+)
+endif()
diff --git a/Modules/Annotation/test/mitkAnnotationTest.cpp b/Modules/Annotation/test/mitkAnnotationTest.cpp
new file mode 100644
index 0000000000..d59b7e2296
--- /dev/null
+++ b/Modules/Annotation/test/mitkAnnotationTest.cpp
@@ -0,0 +1,59 @@
+/*===================================================================
+
+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
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "mitkManualPlacementAnnotationRenderer.h"
+#include "mitkLayoutAnnotationRenderer.h"
+
+class mitkAnnotationTestSuite : public mitk::TestFixture
+{
+ CPPUNIT_TEST_SUITE(mitkAnnotationTestSuite);
+ MITK_TEST(AnnotationUtilsTest);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+public:
+ void setUp() override {}
+ void AnnotationUtilsTest()
+ {
+ mitk::ManualPlacementAnnotationRenderer *ap1_test1 = mitk::ManualPlacementAnnotationRenderer::GetAnnotationRenderer("test1");
+ CPPUNIT_ASSERT_MESSAGE("Testing availability of ManualPlacementAnnotationRenderer service", ap1_test1);
+ mitk::ManualPlacementAnnotationRenderer *ap2_test1 = mitk::ManualPlacementAnnotationRenderer::GetAnnotationRenderer("test1");
+ CPPUNIT_ASSERT_MESSAGE("Testing if ManualPlacementAnnotationRenderer of same kind stays avaliable", ap1_test1 == ap2_test1);
+ mitk::ManualPlacementAnnotationRenderer *ap1_test2 = mitk::ManualPlacementAnnotationRenderer::GetAnnotationRenderer("test2");
+ CPPUNIT_ASSERT_MESSAGE("Testing if new instance can be created by using different ID", ap1_test2 != ap1_test1);
+
+ mitk::LayoutAnnotationRenderer *ol1_test1 = mitk::LayoutAnnotationRenderer::GetAnnotationRenderer("test1");
+ CPPUNIT_ASSERT_MESSAGE("Testing availability of LayoutAnnotationRenderer service", ol1_test1);
+ mitk::LayoutAnnotationRenderer *ol2_test1 = mitk::LayoutAnnotationRenderer::GetAnnotationRenderer("test1");
+ CPPUNIT_ASSERT_MESSAGE("Testing if LayoutAnnotationRenderer of same kind stays avaliable", ol2_test1 == ol1_test1);
+ mitk::LayoutAnnotationRenderer *ol1_test2 = mitk::LayoutAnnotationRenderer::GetAnnotationRenderer("test2");
+ CPPUNIT_ASSERT_MESSAGE("Testing if new instance can be created by using different ID", ol1_test2 != ol1_test1);
+
+ CPPUNIT_ASSERT_MESSAGE(
+ "Testing if LayoutAnnotationRenderer and ManualPlacementAnnotationRenderer services are different",
+ (mitk::AbstractAnnotationRenderer *)ol1_test1 != (mitk::AbstractAnnotationRenderer *)ap1_test1);
+ }
+
+ void AnnotationTest() {}
+};
+MITK_TEST_SUITE_REGISTRATION(mitkAnnotation)
diff --git a/Modules/Annotation/test/mitkColorBarAnnotationTest.cpp b/Modules/Annotation/test/mitkColorBarAnnotationTest.cpp
new file mode 100644
index 0000000000..4c3ed07466
--- /dev/null
+++ b/Modules/Annotation/test/mitkColorBarAnnotationTest.cpp
@@ -0,0 +1,99 @@
+/*===================================================================
+
+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.
+
+===================================================================*/
+
+// MITK
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+class mitkColorBarAnnotationTestSuite : public mitk::TestFixture
+{
+ CPPUNIT_TEST_SUITE(mitkColorBarAnnotationTestSuite);
+ MITK_TEST(RenderColorBarAnnotation);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ /** Members used inside the different test methods. All members are initialized via setUp().*/
+ mitk::RenderingTestHelper m_RenderingTestHelper;
+ std::vector m_CommandlineArgs;
+ std::string m_PathToBall;
+ std::string m_PathToImage;
+ std::string m_ReferenceImagePath;
+
+public:
+ /**
+ * @brief mitkManualPlacementAnnotationRendererTestSuite Because the RenderingTestHelper does not have an
+ * empty default constructor, we need this constructor to initialize the helper with a
+ * resolution.
+ */
+ mitkColorBarAnnotationTestSuite() : m_RenderingTestHelper(300, 300) {}
+ /**
+ * @brief Setup Initialize a fresh rendering test helper and a vector of strings
+ * to simulate commandline arguments for vtkTesting::Test.
+ */
+ void setUp()
+ {
+ m_RenderingTestHelper = mitk::RenderingTestHelper(300, 300);
+
+ m_PathToBall = GetTestDataFilePath("ball.stl");
+ m_PathToImage = GetTestDataFilePath("Pic3D.nrrd");
+ m_ReferenceImagePath = "RenderingTestData/ReferenceScreenshots/Annotation/";
+
+ // Build a command line for the vtkTesting::Test method.
+ // See VTK documentation and RenderingTestHelper for more information.
+ // Use the following command line option to save the difference image
+ // and the test image in some tmp folder
+ // m_CommandlineArgs.push_back("-T");
+ // m_CommandlineArgs.push_back("/path/to/save/tmp/difference/images/");
+ m_CommandlineArgs.push_back("-V");
+ }
+
+ void tearDown() {}
+ void RenderColorBarAnnotation()
+ {
+ mitk::DataNode::Pointer ballnode = mitk::DataNode::New();
+ ballnode->SetData(mitk::IOUtil::Load(m_PathToBall)[0]);
+ m_RenderingTestHelper.AddNodeToStorage(ballnode);
+
+ mitk::DataNode::Pointer imagenode = mitk::DataNode::New();
+ imagenode->SetData(mitk::IOUtil::Load(m_PathToImage)[0]);
+ m_RenderingTestHelper.AddNodeToStorage(imagenode);
+
+ std::string refImagePath = GetTestDataFilePath(m_ReferenceImagePath + "mitkColorBarAnnotation.png");
+
+ // reference screenshot for this test
+ m_CommandlineArgs.push_back(refImagePath);
+ // Convert vector of strings to argc/argv
+ mitk::RenderingTestHelper::ArgcHelperClass arg(m_CommandlineArgs);
+ m_RenderingTestHelper.SetViewDirection(mitk::SliceNavigationController::Sagittal);
+
+ mitk::ColorBarAnnotation::Pointer colorbar = mitk::ColorBarAnnotation::New();
+
+ mitk::BaseRenderer *renderer = mitk::BaseRenderer::GetInstance(m_RenderingTestHelper.GetVtkRenderWindow());
+ mitk::ManualPlacementAnnotationRenderer::AddAnnotation(colorbar.GetPointer(), renderer);
+
+ m_RenderingTestHelper.Render();
+ m_RenderingTestHelper.SaveReferenceScreenShot(refImagePath);
+ m_RenderingTestHelper.SetAutomaticallyCloseRenderWindow(true);
+ CPPUNIT_ASSERT(m_RenderingTestHelper.CompareRenderWindowAgainstReference(arg.GetArgc(), arg.GetArgv()) == true);
+ }
+};
+MITK_TEST_SUITE_REGISTRATION(mitkColorBarAnnotation)
diff --git a/Modules/Annotation/test/mitkLabelAnnotation3DTest.cpp b/Modules/Annotation/test/mitkLabelAnnotation3DTest.cpp
new file mode 100644
index 0000000000..7efcd56cf6
--- /dev/null
+++ b/Modules/Annotation/test/mitkLabelAnnotation3DTest.cpp
@@ -0,0 +1,169 @@
+/*===================================================================
+
+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.
+
+===================================================================*/
+
+// MITK
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+class mitkLabelAnnotation3DTestSuite : public mitk::TestFixture
+{
+ CPPUNIT_TEST_SUITE(mitkLabelAnnotation3DTestSuite);
+ MITK_TEST(Render2DAnnotation);
+ MITK_TEST(Render3DAnnotation);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ /** Members used inside the different test methods. All members are initialized via setUp().*/
+ mitk::RenderingTestHelper m_RenderingTestHelper;
+ std::vector m_CommandlineArgs;
+ std::string m_PathToBall;
+ std::string m_PathToImage;
+ std::string m_ReferenceImagePath;
+
+public:
+ /**
+ * @brief mitkManualPlacementAnnotationRendererTestSuite Because the RenderingTestHelper does not have an
+ * empty default constructor, we need this constructor to initialize the helper with a
+ * resolution.
+ */
+ mitkLabelAnnotation3DTestSuite() : m_RenderingTestHelper(300, 300) {}
+ /**
+ * @brief Setup Initialize a fresh rendering test helper and a vector of strings
+ * to simulate commandline arguments for vtkTesting::Test.
+ */
+ void setUp()
+ {
+ m_RenderingTestHelper = mitk::RenderingTestHelper(300, 300);
+
+ m_PathToBall = GetTestDataFilePath("ball.stl");
+ m_PathToImage = GetTestDataFilePath("Pic3D.nrrd");
+ m_ReferenceImagePath = "RenderingTestData/ReferenceScreenshots/Annotation/";
+
+ // Build a command line for the vtkTesting::Test method.
+ // See VTK documentation and RenderingTestHelper for more information.
+ // Use the following command line option to save the difference image
+ // and the test image in some tmp folder
+ // m_CommandlineArgs.push_back("-T");
+ // m_CommandlineArgs.push_back("/path/to/save/tmp/difference/images/");
+ m_CommandlineArgs.push_back("-V");
+ }
+
+ void tearDown() {}
+ void Render2DAnnotation()
+ {
+ std::string refImagePath = GetTestDataFilePath(m_ReferenceImagePath + "mitkLabelAnnotation3D.png");
+ // reference screenshot for this test
+ m_CommandlineArgs.push_back(refImagePath);
+ // Convert vector of strings to argc/argv
+ mitk::RenderingTestHelper::ArgcHelperClass arg(m_CommandlineArgs);
+ m_RenderingTestHelper.SetViewDirection(mitk::SliceNavigationController::Sagittal);
+
+ mitk::PointSet::Pointer pointset = mitk::PointSet::New();
+ mitk::LabelAnnotation3D::Pointer label3d = mitk::LabelAnnotation3D::New();
+ mitk::Point3D offset;
+ offset[0] = .5;
+ offset[1] = .5;
+ offset[2] = .5;
+
+ std::vector labels;
+ unsigned long idx = 0;
+ for (int i = -10; i < 10; i += 4)
+ {
+ for (int j = -10; j < 10; j += 4)
+ {
+ mitk::Point3D point;
+ point[0] = i;
+ point[1] = j;
+ point[2] = (i * j) / 10;
+ pointset->InsertPoint(idx++, point);
+ labels.push_back("test");
+ }
+ }
+
+ label3d->SetLabelCoordinates(pointset);
+ label3d->SetLabelVector(labels);
+ label3d->SetOffsetVector(offset);
+
+ mitk::DataNode::Pointer datanode = mitk::DataNode::New();
+ datanode->SetData(pointset);
+ datanode->SetName("pointSet");
+ m_RenderingTestHelper.AddNodeToStorage(datanode);
+
+ mitk::BaseRenderer *renderer = mitk::BaseRenderer::GetInstance(m_RenderingTestHelper.GetVtkRenderWindow());
+ mitk::ManualPlacementAnnotationRenderer::AddAnnotation(label3d.GetPointer(), renderer);
+
+ m_RenderingTestHelper.Render();
+ m_RenderingTestHelper.SaveReferenceScreenShot(refImagePath);
+ m_RenderingTestHelper.SetAutomaticallyCloseRenderWindow(true);
+ CPPUNIT_ASSERT(m_RenderingTestHelper.CompareRenderWindowAgainstReference(arg.GetArgc(), arg.GetArgv()) == true);
+ }
+
+ void Render3DAnnotation()
+ {
+ std::string refImagePath = GetTestDataFilePath(m_ReferenceImagePath + "mitkLabelAnnotation3D.png");
+ // reference screenshot for this test
+ m_CommandlineArgs.push_back(refImagePath);
+ // Convert vector of strings to argc/argv
+ mitk::RenderingTestHelper::ArgcHelperClass arg(m_CommandlineArgs);
+ m_RenderingTestHelper.SetMapperIDToRender3D();
+
+ mitk::PointSet::Pointer pointset = mitk::PointSet::New();
+ mitk::LabelAnnotation3D::Pointer label3d = mitk::LabelAnnotation3D::New();
+ mitk::Point3D offset;
+ offset[0] = .5;
+ offset[1] = .5;
+ offset[2] = .5;
+
+ std::vector labels;
+ unsigned long idx = 0;
+ for (int i = -10; i < 10; i += 4)
+ {
+ for (int j = -10; j < 10; j += 4)
+ {
+ mitk::Point3D point;
+ point[0] = i;
+ point[1] = j;
+ point[2] = (i * j) / 10;
+ pointset->InsertPoint(idx++, point);
+ labels.push_back("test");
+ }
+ }
+
+ label3d->SetLabelCoordinates(pointset);
+ label3d->SetLabelVector(labels);
+ label3d->SetOffsetVector(offset);
+
+ mitk::DataNode::Pointer datanode = mitk::DataNode::New();
+ datanode->SetData(pointset);
+ datanode->SetName("pointSet");
+ m_RenderingTestHelper.AddNodeToStorage(datanode);
+
+ mitk::BaseRenderer *renderer = mitk::BaseRenderer::GetInstance(m_RenderingTestHelper.GetVtkRenderWindow());
+ mitk::ManualPlacementAnnotationRenderer::AddAnnotation(label3d.GetPointer(), renderer);
+
+ m_RenderingTestHelper.Render();
+ m_RenderingTestHelper.SaveReferenceScreenShot(refImagePath);
+ m_RenderingTestHelper.SetAutomaticallyCloseRenderWindow(true);
+ CPPUNIT_ASSERT(m_RenderingTestHelper.CompareRenderWindowAgainstReference(arg.GetArgc(), arg.GetArgv()) == true);
+ }
+};
+MITK_TEST_SUITE_REGISTRATION(mitkLabelAnnotation3D)
diff --git a/Modules/Annotation/test/mitkLayoutAnnotationRendererTest.cpp b/Modules/Annotation/test/mitkLayoutAnnotationRendererTest.cpp
new file mode 100644
index 0000000000..68ff4bceb7
--- /dev/null
+++ b/Modules/Annotation/test/mitkLayoutAnnotationRendererTest.cpp
@@ -0,0 +1,162 @@
+/*===================================================================
+
+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.
+
+===================================================================*/
+
+// MITK
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+void createTextAnnotationWithLayouter(std::vector &Annotation,
+ mitk::LayoutAnnotationRenderer::Alignment align,
+ mitk::BaseRenderer *renderer,
+ int fontsize,
+ float red,
+ float green,
+ float blue,
+ int prio,
+ std::string text)
+{
+ // Create a textAnnotation2D
+ mitk::TextAnnotation2D::Pointer textAnnotation = mitk::TextAnnotation2D::New();
+
+ textAnnotation->SetText(text);
+ textAnnotation->SetFontSize(fontsize);
+ textAnnotation->SetColor(red, green, blue);
+ textAnnotation->SetOpacity(1);
+
+ mitk::LayoutAnnotationRenderer::AddAnnotation(textAnnotation, renderer, align, 5, 5, prio);
+ Annotation.push_back(textAnnotation);
+}
+
+class mitkLayoutAnnotationRendererTestSuite : public mitk::TestFixture
+{
+ CPPUNIT_TEST_SUITE(mitkLayoutAnnotationRendererTestSuite);
+ MITK_TEST(Render2DAnnotation);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ /** Members used inside the different test methods. All members are initialized via setUp().*/
+ mitk::RenderingTestHelper m_RenderingTestHelper;
+ std::vector m_CommandlineArgs;
+ std::string m_PathToBall;
+ std::string m_PathToImage;
+ std::string m_ReferenceImagePath;
+
+public:
+ /**
+ * @brief mitkManualPlacementAnnotationRendererTestSuite Because the RenderingTestHelper does not have an
+ * empty default constructor, we need this constructor to initialize the helper with a
+ * resolution.
+ */
+ mitkLayoutAnnotationRendererTestSuite() : m_RenderingTestHelper(500, 500) {}
+ /**
+ * @brief Setup Initialize a fresh rendering test helper and a vector of strings
+ * to simulate commandline arguments for vtkTesting::Test.
+ */
+ void setUp()
+ {
+ m_RenderingTestHelper = mitk::RenderingTestHelper(500, 500);
+
+ m_PathToBall = GetTestDataFilePath("ball.stl");
+ m_PathToImage = GetTestDataFilePath("Pic3D.nrrd");
+ m_ReferenceImagePath = "RenderingTestData/ReferenceScreenshots/Annotation/";
+
+ // Build a command line for the vtkTesting::Test method.
+ // See VTK documentation and RenderingTestHelper for more information.
+ // Use the following command line option to save the difference image
+ // and the test image in some tmp folder
+ // m_CommandlineArgs.push_back("-T");
+ // m_CommandlineArgs.push_back("/path/to/save/tmp/difference/images/");
+ m_CommandlineArgs.push_back("-V");
+ }
+
+ void tearDown() {}
+ void Render2DAnnotation()
+ {
+ mitk::DataNode::Pointer ballnode = mitk::DataNode::New();
+ ballnode->SetData(mitk::IOUtil::Load(m_PathToBall)[0]);
+ m_RenderingTestHelper.AddNodeToStorage(ballnode);
+
+ mitk::DataNode::Pointer imagenode = mitk::DataNode::New();
+ imagenode->SetData(mitk::IOUtil::Load(m_PathToImage)[0]);
+ m_RenderingTestHelper.AddNodeToStorage(imagenode);
+
+ std::string refImagePath = GetTestDataFilePath(m_ReferenceImagePath + "LayoutAnnotationRenderer.png");
+ // reference screenshot for this test
+ m_CommandlineArgs.push_back(refImagePath);
+ // Convert vector of strings to argc/argv
+ mitk::RenderingTestHelper::ArgcHelperClass arg(m_CommandlineArgs);
+ m_RenderingTestHelper.SetViewDirection(mitk::SliceNavigationController::Sagittal);
+
+ std::vector Annotation;
+ mitk::BaseRenderer *renderer = mitk::BaseRenderer::GetInstance(m_RenderingTestHelper.GetVtkRenderWindow());
+
+ createTextAnnotationWithLayouter(
+ Annotation, mitk::LayoutAnnotationRenderer::TopLeft, renderer, 20, 1.0, 1.0, 1.0, 1, "TopLeft1");
+ createTextAnnotationWithLayouter(
+ Annotation, mitk::LayoutAnnotationRenderer::TopLeft, renderer, 15, 1.0, 1.0, 1.0, 3, "TopLeft3");
+ createTextAnnotationWithLayouter(
+ Annotation, mitk::LayoutAnnotationRenderer::TopLeft, renderer, 25, 1.0, 0.0, 1.0, 2, "TopLeft2");
+
+ createTextAnnotationWithLayouter(Annotation, mitk::LayoutAnnotationRenderer::Top, renderer, 15, 1.0, 1.0, 1.0, 3, "Top3");
+ createTextAnnotationWithLayouter(Annotation, mitk::LayoutAnnotationRenderer::Top, renderer, 20, 1.0, 1.0, 1.0, 1, "Top1");
+ createTextAnnotationWithLayouter(Annotation, mitk::LayoutAnnotationRenderer::Top, renderer, 25, 1.0, 0.0, 1.0, 2, "Top2");
+
+ createTextAnnotationWithLayouter(
+ Annotation, mitk::LayoutAnnotationRenderer::TopRight, renderer, 20, 1.0, 1.0, 1.0, 1, "TopRight1");
+ createTextAnnotationWithLayouter(
+ Annotation, mitk::LayoutAnnotationRenderer::TopRight, renderer, 15, 1.0, 1.0, 1.0, 3, "TopRight3");
+ createTextAnnotationWithLayouter(
+ Annotation, mitk::LayoutAnnotationRenderer::TopRight, renderer, 25, 1.0, 0.0, 1.0, 2, "TopRight2");
+
+ createTextAnnotationWithLayouter(Annotation, mitk::LayoutAnnotationRenderer::Left, renderer, 20, 1.0, 1.0, 1.0, 1, "Left1");
+ createTextAnnotationWithLayouter(Annotation, mitk::LayoutAnnotationRenderer::Left, renderer, 15, 1.0, 1.0, 1.0, 3, "Left3");
+ createTextAnnotationWithLayouter(Annotation, mitk::LayoutAnnotationRenderer::Left, renderer, 25, 1.0, 0.0, 1.0, 2, "Left2");
+
+ createTextAnnotationWithLayouter(Annotation, mitk::LayoutAnnotationRenderer::Right, renderer, 25, 1.0, 0.0, 1.0, 2, "Right2");
+ createTextAnnotationWithLayouter(Annotation, mitk::LayoutAnnotationRenderer::Right, renderer, 20, 1.0, 1.0, 1.0, 1, "Right1");
+ createTextAnnotationWithLayouter(Annotation, mitk::LayoutAnnotationRenderer::Right, renderer, 15, 1.0, 1.0, 1.0, 3, "Right3");
+
+ createTextAnnotationWithLayouter(
+ Annotation, mitk::LayoutAnnotationRenderer::BottomLeft, renderer, 25, 1.0, 0.0, 1.0, 2, "BottomLeft2");
+ createTextAnnotationWithLayouter(
+ Annotation, mitk::LayoutAnnotationRenderer::BottomLeft, renderer, 20, 1.0, 1.0, 1.0, 1, "BottomLeft1");
+ createTextAnnotationWithLayouter(
+ Annotation, mitk::LayoutAnnotationRenderer::BottomLeft, renderer, 15, 1.0, 1.0, 1.0, 3, "BottomLeft3");
+
+ createTextAnnotationWithLayouter(Annotation, mitk::LayoutAnnotationRenderer::Bottom, renderer, 15, 1.0, 1.0, 1.0, 3, "Bottom3");
+ createTextAnnotationWithLayouter(Annotation, mitk::LayoutAnnotationRenderer::Bottom, renderer, 20, 1.0, 1.0, 1.0, 1, "Bottom1");
+ createTextAnnotationWithLayouter(Annotation, mitk::LayoutAnnotationRenderer::Bottom, renderer, 25, 1.0, 0.0, 1.0, 2, "Bottom2");
+
+ createTextAnnotationWithLayouter(
+ Annotation, mitk::LayoutAnnotationRenderer::BottomRight, renderer, 25, 1.0, 0.0, 1.0, 2, "BottomRight2");
+ createTextAnnotationWithLayouter(
+ Annotation, mitk::LayoutAnnotationRenderer::BottomRight, renderer, 20, 1.0, 1.0, 1.0, 1, "BottomRight1");
+ createTextAnnotationWithLayouter(
+ Annotation, mitk::LayoutAnnotationRenderer::BottomRight, renderer, 15, 1.0, 1.0, 1.0, 3, "BottomRight3");
+
+ m_RenderingTestHelper.Render();
+ m_RenderingTestHelper.SaveReferenceScreenShot(refImagePath);
+ m_RenderingTestHelper.SetAutomaticallyCloseRenderWindow(true);
+ CPPUNIT_ASSERT(m_RenderingTestHelper.CompareRenderWindowAgainstReference(arg.GetArgc(), arg.GetArgv()) == true);
+ }
+};
+MITK_TEST_SUITE_REGISTRATION(mitkLayoutAnnotationRenderer)
diff --git a/Modules/Annotation/test/mitkLogoAnnotationTest.cpp b/Modules/Annotation/test/mitkLogoAnnotationTest.cpp
new file mode 100644
index 0000000000..c5c9c56581
--- /dev/null
+++ b/Modules/Annotation/test/mitkLogoAnnotationTest.cpp
@@ -0,0 +1,136 @@
+/*===================================================================
+
+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.
+
+===================================================================*/
+
+// MITK
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+class mitkLogoAnnotationTestSuite : public mitk::TestFixture
+{
+ CPPUNIT_TEST_SUITE(mitkLogoAnnotationTestSuite);
+ MITK_TEST(RenderMbiLogo);
+ MITK_TEST(RenderLogo);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ /** Members used inside the different test methods. All members are initialized via setUp().*/
+ mitk::RenderingTestHelper m_RenderingTestHelper;
+ std::vector m_CommandlineArgs;
+ std::string m_PathToBall;
+ std::string m_PathToImage;
+ std::string m_PathToLogo;
+ std::string m_ReferenceImagePath;
+
+public:
+ /**
+ * @brief mitkManualPlacementAnnotationRendererTestSuite Because the RenderingTestHelper does not have an
+ * empty default constructor, we need this constructor to initialize the helper with a
+ * resolution.
+ */
+ mitkLogoAnnotationTestSuite() : m_RenderingTestHelper(300, 300) {}
+ /**
+ * @brief Setup Initialize a fresh rendering test helper and a vector of strings
+ * to simulate commandline arguments for vtkTesting::Test.
+ */
+ void setUp()
+ {
+ m_RenderingTestHelper = mitk::RenderingTestHelper(300, 300);
+
+ m_PathToBall = GetTestDataFilePath("ball.stl");
+ m_PathToImage = GetTestDataFilePath("Pic3D.nrrd");
+ m_PathToLogo = GetTestDataFilePath("RenderingTestData/rgbaImage.png");
+ m_ReferenceImagePath = "RenderingTestData/ReferenceScreenshots/Annotation/";
+
+ // Build a command line for the vtkTesting::Test method.
+ // See VTK documentation and RenderingTestHelper for more information.
+ // Use the following command line option to save the difference image
+ // and the test image in some tmp folder
+ // m_CommandlineArgs.push_back("-T");
+ // m_CommandlineArgs.push_back("/path/to/save/tmp/difference/images/");
+ m_CommandlineArgs.push_back("-V");
+ }
+
+ void tearDown() {}
+ void RenderMbiLogo()
+ {
+ mitk::DataNode::Pointer ballnode = mitk::DataNode::New();
+ ballnode->SetData(mitk::IOUtil::Load(m_PathToBall)[0]);
+ m_RenderingTestHelper.AddNodeToStorage(ballnode);
+
+ mitk::DataNode::Pointer imagenode = mitk::DataNode::New();
+ imagenode->SetData(mitk::IOUtil::Load(m_PathToImage)[0]);
+ m_RenderingTestHelper.AddNodeToStorage(imagenode);
+
+ std::string refImagePath = GetTestDataFilePath(m_ReferenceImagePath + "LogoAnnotation_mbiLogo.png");
+
+ // reference screenshot for this test
+ m_CommandlineArgs.push_back(refImagePath);
+ // Convert vector of strings to argc/argv
+ mitk::RenderingTestHelper::ArgcHelperClass arg(m_CommandlineArgs);
+ m_RenderingTestHelper.SetViewDirection(mitk::SliceNavigationController::Sagittal);
+
+ mitk::LogoAnnotation::Pointer logoAnnotation = mitk::LogoAnnotation::New();
+
+ logoAnnotation->SetLogoImagePath("mbilogo");
+
+ mitk::BaseRenderer *renderer = mitk::BaseRenderer::GetInstance(m_RenderingTestHelper.GetVtkRenderWindow());
+ mitk::ManualPlacementAnnotationRenderer::AddAnnotation(logoAnnotation.GetPointer(), renderer);
+
+ m_RenderingTestHelper.Render();
+ m_RenderingTestHelper.SaveReferenceScreenShot(refImagePath);
+ m_RenderingTestHelper.SetAutomaticallyCloseRenderWindow(true);
+ CPPUNIT_ASSERT(m_RenderingTestHelper.CompareRenderWindowAgainstReference(arg.GetArgc(), arg.GetArgv()) == true);
+ }
+
+ void RenderLogo()
+ {
+ mitk::DataNode::Pointer ballnode = mitk::DataNode::New();
+ ballnode->SetData(mitk::IOUtil::Load(m_PathToBall)[0]);
+ m_RenderingTestHelper.AddNodeToStorage(ballnode);
+
+ mitk::DataNode::Pointer imagenode = mitk::DataNode::New();
+ imagenode->SetData(mitk::IOUtil::Load(m_PathToImage)[0]);
+ m_RenderingTestHelper.AddNodeToStorage(imagenode);
+
+ std::string refImagePath = GetTestDataFilePath(m_ReferenceImagePath + "LogoAnnotation.png");
+
+ // reference screenshot for this test
+ m_CommandlineArgs.push_back(refImagePath);
+ // Convert vector of strings to argc/argv
+ mitk::RenderingTestHelper::ArgcHelperClass arg(m_CommandlineArgs);
+ m_RenderingTestHelper.SetViewDirection(mitk::SliceNavigationController::Sagittal);
+
+ mitk::LogoAnnotation::Pointer logoAnnotation = mitk::LogoAnnotation::New();
+
+ logoAnnotation->SetLogoImagePath(m_PathToLogo);
+
+ mitk::BaseRenderer *renderer = mitk::BaseRenderer::GetInstance(m_RenderingTestHelper.GetVtkRenderWindow());
+ mitk::ManualPlacementAnnotationRenderer::AddAnnotation(logoAnnotation.GetPointer(), renderer);
+
+ m_RenderingTestHelper.Render();
+ m_RenderingTestHelper.SaveReferenceScreenShot(refImagePath);
+ m_RenderingTestHelper.SetAutomaticallyCloseRenderWindow(true);
+ CPPUNIT_ASSERT(m_RenderingTestHelper.CompareRenderWindowAgainstReference(arg.GetArgc(), arg.GetArgv()) == true);
+ }
+};
+
+MITK_TEST_SUITE_REGISTRATION(mitkLogoAnnotation)
diff --git a/Modules/Annotation/test/mitkManualPlacementAnnotationRendererTest.cpp b/Modules/Annotation/test/mitkManualPlacementAnnotationRendererTest.cpp
new file mode 100644
index 0000000000..5bb1bfe995
--- /dev/null
+++ b/Modules/Annotation/test/mitkManualPlacementAnnotationRendererTest.cpp
@@ -0,0 +1,142 @@
+/*===================================================================
+
+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.
+
+===================================================================*/
+
+// MITK
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+class mitkManualPlacementAnnotationRendererTestSuite : public mitk::TestFixture
+{
+ CPPUNIT_TEST_SUITE(mitkManualPlacementAnnotationRendererTestSuite);
+ MITK_TEST(Render2DAnnotation);
+ MITK_TEST(Render3DAnnotation);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ /** Members used inside the different test methods. All members are initialized via setUp().*/
+ mitk::RenderingTestHelper m_RenderingTestHelper;
+ std::vector m_CommandlineArgs;
+ std::string m_PathToBall;
+ std::string m_PathToImage;
+ std::string m_ReferenceImagePath;
+
+public:
+ /**
+ * @brief mitkManualPlacementAnnotationRendererTestSuite Because the RenderingTestHelper does not have an
+ * empty default constructor, we need this constructor to initialize the helper with a
+ * resolution.
+ */
+ mitkManualPlacementAnnotationRendererTestSuite() : m_RenderingTestHelper(300, 300) {}
+ /**
+ * @brief Setup Initialize a fresh rendering test helper and a vector of strings
+ * to simulate commandline arguments for vtkTesting::Test.
+ */
+ void setUp()
+ {
+ m_RenderingTestHelper = mitk::RenderingTestHelper(300, 300);
+
+ m_PathToBall = GetTestDataFilePath("ball.stl");
+ m_PathToImage = GetTestDataFilePath("Pic3D.nrrd");
+ m_ReferenceImagePath = "RenderingTestData/ReferenceScreenshots/Annotation/";
+
+ // Build a command line for the vtkTesting::Test method.
+ // See VTK documentation and RenderingTestHelper for more information.
+ // Use the following command line option to save the difference image
+ // and the test image in some tmp folder
+ // m_CommandlineArgs.push_back("-T");
+ // m_CommandlineArgs.push_back("/path/to/save/tmp/difference/images/");
+ m_CommandlineArgs.push_back("-V");
+ }
+
+ void tearDown() {}
+ void Render2DAnnotation()
+ {
+ mitk::DataNode::Pointer ballnode = mitk::DataNode::New();
+ ballnode->SetData(mitk::IOUtil::Load(m_PathToBall)[0]);
+ m_RenderingTestHelper.AddNodeToStorage(ballnode);
+
+ mitk::DataNode::Pointer imagenode = mitk::DataNode::New();
+ imagenode->SetData(mitk::IOUtil::Load(m_PathToImage)[0]);
+ m_RenderingTestHelper.AddNodeToStorage(imagenode);
+
+ std::string refImagePath = GetTestDataFilePath(m_ReferenceImagePath + "ManualPlacementAnnotationRenderer2DAnnotation.png");
+
+ // reference screenshot for this test
+ m_CommandlineArgs.push_back(refImagePath);
+ // Convert vector of strings to argc/argv
+ mitk::RenderingTestHelper::ArgcHelperClass arg(m_CommandlineArgs);
+ m_RenderingTestHelper.SetViewDirection(mitk::SliceNavigationController::Sagittal);
+
+ mitk::TextAnnotation2D::Pointer textAnnotation2D = mitk::TextAnnotation2D::New();
+
+ textAnnotation2D->SetText("TEST ManualPlacementAnnotationRenderer2DAnnotation");
+ mitk::Point2D pos;
+ pos[0] = 0;
+ pos[1] = 0;
+ textAnnotation2D->SetPosition2D(pos);
+
+ mitk::BaseRenderer *renderer = mitk::BaseRenderer::GetInstance(m_RenderingTestHelper.GetVtkRenderWindow());
+ mitk::ManualPlacementAnnotationRenderer::AddAnnotation(textAnnotation2D.GetPointer(), renderer);
+
+ m_RenderingTestHelper.Render();
+ m_RenderingTestHelper.SaveReferenceScreenShot(refImagePath);
+ m_RenderingTestHelper.SetAutomaticallyCloseRenderWindow(true);
+ CPPUNIT_ASSERT(m_RenderingTestHelper.CompareRenderWindowAgainstReference(arg.GetArgc(), arg.GetArgv()) == true);
+ }
+
+ void Render3DAnnotation()
+ {
+ mitk::DataNode::Pointer ballnode = mitk::DataNode::New();
+ ballnode->SetData(mitk::IOUtil::Load(m_PathToBall)[0]);
+ m_RenderingTestHelper.AddNodeToStorage(ballnode);
+
+ mitk::DataNode::Pointer imagenode = mitk::DataNode::New();
+ imagenode->SetData(mitk::IOUtil::Load(m_PathToImage)[0]);
+ m_RenderingTestHelper.AddNodeToStorage(imagenode);
+
+ std::string refImagePath = GetTestDataFilePath(m_ReferenceImagePath + "ManualPlacementAnnotationRenderer3DAnnotation.png");
+ // reference screenshot for this test
+ m_CommandlineArgs.push_back(refImagePath);
+ // Convert vector of strings to argc/argv
+ mitk::RenderingTestHelper::ArgcHelperClass arg(m_CommandlineArgs);
+ m_RenderingTestHelper.SetMapperIDToRender3D();
+
+ mitk::TextAnnotation3D::Pointer textAnnotation3D = mitk::TextAnnotation3D::New();
+
+ textAnnotation3D->SetText("TEST ManualPlacementAnnotationRenderer3DAnnotation");
+ mitk::Point3D pos;
+ pos[0] = 10;
+ pos[1] = 10;
+ pos[2] = 10;
+ textAnnotation3D->SetPosition3D(pos);
+
+ mitk::BaseRenderer *renderer = mitk::BaseRenderer::GetInstance(m_RenderingTestHelper.GetVtkRenderWindow());
+ mitk::ManualPlacementAnnotationRenderer::AddAnnotation(textAnnotation3D.GetPointer(), renderer);
+
+ m_RenderingTestHelper.Render();
+ m_RenderingTestHelper.SaveReferenceScreenShot(refImagePath);
+ m_RenderingTestHelper.SetAutomaticallyCloseRenderWindow(true);
+ CPPUNIT_ASSERT(m_RenderingTestHelper.CompareRenderWindowAgainstReference(arg.GetArgc(), arg.GetArgv()) == true);
+ }
+};
+MITK_TEST_SUITE_REGISTRATION(mitkManualPlacementAnnotationRenderer)
diff --git a/Modules/Annotation/test/mitkScaleLegendAnnotationTest.cpp b/Modules/Annotation/test/mitkScaleLegendAnnotationTest.cpp
new file mode 100644
index 0000000000..87df330b17
--- /dev/null
+++ b/Modules/Annotation/test/mitkScaleLegendAnnotationTest.cpp
@@ -0,0 +1,99 @@
+/*===================================================================
+
+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.
+
+===================================================================*/
+
+// MITK
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+class mitkScaleLegendAnnotationTestSuite : public mitk::TestFixture
+{
+ CPPUNIT_TEST_SUITE(mitkScaleLegendAnnotationTestSuite);
+ MITK_TEST(RenderScaleLegendAnnotation);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ /** Members used inside the different test methods. All members are initialized via setUp().*/
+ mitk::RenderingTestHelper m_RenderingTestHelper;
+ std::vector m_CommandlineArgs;
+ std::string m_PathToBall;
+ std::string m_PathToImage;
+ std::string m_ReferenceImagePath;
+
+public:
+ /**
+ * @brief mitkManualPlacementAnnotationRendererTestSuite Because the RenderingTestHelper does not have an
+ * empty default constructor, we need this constructor to initialize the helper with a
+ * resolution.
+ */
+ mitkScaleLegendAnnotationTestSuite() : m_RenderingTestHelper(300, 300) {}
+ /**
+ * @brief Setup Initialize a fresh rendering test helper and a vector of strings
+ * to simulate commandline arguments for vtkTesting::Test.
+ */
+ void setUp()
+ {
+ m_RenderingTestHelper = mitk::RenderingTestHelper(300, 300);
+
+ m_PathToBall = GetTestDataFilePath("ball.stl");
+ m_PathToImage = GetTestDataFilePath("Pic3D.nrrd");
+ m_ReferenceImagePath = "RenderingTestData/ReferenceScreenshots/Annotation/";
+
+ // Build a command line for the vtkTesting::Test method.
+ // See VTK documentation and RenderingTestHelper for more information.
+ // Use the following command line option to save the difference image
+ // and the test image in some tmp folder
+ // m_CommandlineArgs.push_back("-T");
+ // m_CommandlineArgs.push_back("/path/to/save/tmp/difference/images/");
+ m_CommandlineArgs.push_back("-V");
+ }
+
+ void tearDown() {}
+ void RenderScaleLegendAnnotation()
+ {
+ mitk::DataNode::Pointer ballnode = mitk::DataNode::New();
+ ballnode->SetData(mitk::IOUtil::Load(m_PathToBall)[0]);
+ m_RenderingTestHelper.AddNodeToStorage(ballnode);
+
+ mitk::DataNode::Pointer imagenode = mitk::DataNode::New();
+ imagenode->SetData(mitk::IOUtil::Load(m_PathToImage)[0]);
+ m_RenderingTestHelper.AddNodeToStorage(imagenode);
+
+ std::string refImagePath = GetTestDataFilePath(m_ReferenceImagePath + "mitkScaleLegendAnnotation.png");
+
+ // reference screenshot for this test
+ m_CommandlineArgs.push_back(refImagePath);
+ // Convert vector of strings to argc/argv
+ mitk::RenderingTestHelper::ArgcHelperClass arg(m_CommandlineArgs);
+ m_RenderingTestHelper.SetViewDirection(mitk::SliceNavigationController::Sagittal);
+
+ mitk::ScaleLegendAnnotation::Pointer colorbar = mitk::ScaleLegendAnnotation::New();
+
+ mitk::BaseRenderer *renderer = mitk::BaseRenderer::GetInstance(m_RenderingTestHelper.GetVtkRenderWindow());
+ mitk::ManualPlacementAnnotationRenderer::AddAnnotation(colorbar.GetPointer(), renderer);
+
+ m_RenderingTestHelper.Render();
+ m_RenderingTestHelper.SaveReferenceScreenShot(refImagePath);
+ m_RenderingTestHelper.SetAutomaticallyCloseRenderWindow(true);
+ CPPUNIT_ASSERT(m_RenderingTestHelper.CompareRenderWindowAgainstReference(arg.GetArgc(), arg.GetArgv()) == true);
+ }
+};
+MITK_TEST_SUITE_REGISTRATION(mitkScaleLegendAnnotation)
diff --git a/Modules/Annotation/test/mitkTextAnnotation2DTest.cpp b/Modules/Annotation/test/mitkTextAnnotation2DTest.cpp
new file mode 100644
index 0000000000..9ec55990c2
--- /dev/null
+++ b/Modules/Annotation/test/mitkTextAnnotation2DTest.cpp
@@ -0,0 +1,105 @@
+/*===================================================================
+
+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.
+
+===================================================================*/
+
+// MITK
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+class mitkTextAnnotation2DTestSuite : public mitk::TestFixture
+{
+ CPPUNIT_TEST_SUITE(mitkTextAnnotation2DTestSuite);
+ MITK_TEST(Render2DAnnotation);
+
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ /** Members used inside the different test methods. All members are initialized via setUp().*/
+ mitk::RenderingTestHelper m_RenderingTestHelper;
+ std::vector