Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
mitkDicomRTIOActivator.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 #include <usModuleActivator.h>
13 #include <usModuleContext.h>
14 
18 
19 #include <mitkCoreServices.h>
22 
23 #include "mitkDicomRTIOMimeTypes.h"
24 
25 namespace mitk
26 {
30  class DicomRTIOActivator : public us::ModuleActivator
31  {
32  public:
33 
34  void Load(us::ModuleContext* context) override
35  {
38 
39  m_MimeTypes = mitk::DicomRTIOMimeTypes::Get();
40  for (std::vector<mitk::CustomMimeType*>::const_iterator mimeTypeIter = m_MimeTypes.begin(),
41  iterEnd = m_MimeTypes.end(); mimeTypeIter != iterEnd; ++mimeTypeIter)
42  {
43  context->RegisterService(*mimeTypeIter, props);
44  }
45 
46  m_RTDoseReader = new RTDoseReaderService();
47  m_RTPlanReader = new RTPlanReaderService();
48  m_RTStructureSetReader = new RTStructureSetReaderService();
49  }
50 
51  void Unload(us::ModuleContext*) override
52  {
53  for (auto& aMimeType : m_MimeTypes)
54  {
55  delete aMimeType;
56  }
57 
58  delete m_RTDoseReader;
59  delete m_RTPlanReader;
60  delete m_RTStructureSetReader;
61  }
62 
63  private:
64 
65  RTDoseReaderService * m_RTDoseReader;
66  RTPlanReaderService * m_RTPlanReader;
67  RTStructureSetReaderService * m_RTStructureSetReader;
68 
69  std::vector<mitk::CustomMimeType*> m_MimeTypes;
70 
71  };
72 }
73 
74 US_EXPORT_MODULE_ACTIVATOR(mitk::DicomRTIOActivator)
US_Core_EXPORT const std::string & SERVICE_RANKING()
DataCollection - Class to facilitate loading/accessing structured data.
virtual void Unload(ModuleContext *context)=0
US_UNORDERED_MAP_TYPE< std::string, Any > ServiceProperties
static std::vector< CustomMimeType * > Get()
#define US_EXPORT_MODULE_ACTIVATOR(_activator_type)
Export a module activator class.
virtual void Load(ModuleContext *context)=0