Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
mitkManualPlacementAnnotationRenderer.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
14 #include "mitkBaseRenderer.h"
15 
16 #include "mitkAnnotationUtils.h"
17 #include <mitkVtkLayerController.h>
18 
19 namespace mitk
20 {
21  const std::string ManualPlacementAnnotationRenderer::ANNOTATIONRENDERER_ID = "ManualPlacementAnnotationRenderer";
22 
23  ManualPlacementAnnotationRenderer::ManualPlacementAnnotationRenderer(const std::string &rendererId)
24  : AbstractAnnotationRenderer(rendererId, ManualPlacementAnnotationRenderer::ANNOTATIONRENDERER_ID)
25  {
26  }
29  {
30  ManualPlacementAnnotationRenderer *result = nullptr;
31  AbstractAnnotationRenderer *registeredService =
32  AnnotationUtils::GetAnnotationRenderer(ANNOTATIONRENDERER_ID, rendererID);
33  if (registeredService)
34  result = dynamic_cast<ManualPlacementAnnotationRenderer *>(registeredService);
35  if (!result)
36  {
37  result = new ManualPlacementAnnotationRenderer(rendererID);
39  }
40  return result;
41  }
42 
44  {
45  GetAnnotationRenderer(rendererID); // rename ??
47  props[Annotation::US_PROPKEY_AR_ID] = ANNOTATIONRENDERER_ID;
48  props[Annotation::US_PROPKEY_RENDERER_ID] = rendererID;
49  Annotation->RegisterAsMicroservice(props);
50  }
51 
53  {
54  AddAnnotation(Annotation, renderer->GetName());
55  }
56 }
The ManualPlacementAnnotationRenderer is used for the simple placement of mitk::Annotation Objects...
virtual void RegisterAsMicroservice(us::ServiceProperties props)
Registers this object as a Microservice, making it available to every module and/or plugin...
Organizes the rendering process.
DataCollection - Class to facilitate loading/accessing structured data.
static void RegisterAnnotationRenderer(AbstractAnnotationRenderer *annotationRenderer)
RegisterAnnotationRenderer registers an AnnotationRenderer as a microservice and saves a reference to...
static AbstractAnnotationRenderer * GetAnnotationRenderer(const std::string &arTypeID, const std::string &rendererID)
GetAnnotationRenderer returns a registered AnnotationRenderer of a specific type and for a BaseRender...
static ManualPlacementAnnotationRenderer * GetAnnotationRenderer(const std::string &rendererID)
Baseclass of Annotation layouters An AbstractAnnotationRenderer can be implemented to control a set o...
static void AddAnnotation(Annotation *Annotation, const std::string &rendererID)
US_UNORDERED_MAP_TYPE< std::string, Any > ServiceProperties
Base class for all Annotation This class is to be implemented in order to create Annotation which are...
static const std::string US_PROPKEY_RENDERER_ID
~ManualPlacementAnnotationRenderer() override
virtual destructor in order to derive from this class
static const std::string US_PROPKEY_AR_ID
const char * GetName() const
get the name of the Renderer