Medical Imaging Interaction Toolkit  2018.4.99-dfa0c14e
Medical Imaging Interaction Toolkit
mitkDICOMQIIOActivator.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 
13 #include <usGetModuleContext.h>
14 #include <usModule.h>
15 #include <usModuleActivator.h>
16 #include <usModuleContext.h>
17 #include <usServiceEvent.h>
18 
21 
23 
24 namespace mitk
25 {
29  class DICOMQIIOActivator : public us::ModuleActivator
30  {
31  std::vector<AbstractFileIO *> m_FileIOs;
32  DICOMTagsOfInterestAddHelper m_TagHelper;
33 
34  public:
35  void Load(us::ModuleContext * context) override
36  {
39 
40  std::vector<mitk::CustomMimeType *> mimeTypes = mitk::MitkDICOMSEGIOMimeTypes::Get();
41  for (std::vector<mitk::CustomMimeType *>::const_iterator mimeTypeIter = mimeTypes.begin(),
42  iterEnd = mimeTypes.end();
43  mimeTypeIter != iterEnd;
44  ++mimeTypeIter)
45  {
46  context->RegisterService(*mimeTypeIter, props);
47  }
48 
49  m_FileIOs.push_back(new DICOMSegmentationIO());
50 
52  m_TagHelper.Activate(context, tags);
53  }
54 
55  void Unload(us::ModuleContext *) override
56  {
57  for (auto &elem : m_FileIOs)
58  {
59  delete elem;
60  }
61  m_TagHelper.Deactivate();
62  }
63  };
64 }
65 
66 US_EXPORT_MODULE_ACTIVATOR(mitk::DICOMQIIOActivator)
US_Core_EXPORT const std::string & SERVICE_RANKING()
DataCollection - Class to facilitate loading/accessing structured data.
std::vector< mitk::DICOMTagPath > TagsOfInterestVector
virtual void Unload(ModuleContext *context)=0
static std::vector< mitk::DICOMTagPath > GetDICOMTagsOfInterest()
US_UNORDERED_MAP_TYPE< std::string, Any > ServiceProperties
#define US_EXPORT_MODULE_ACTIVATOR(_activator_type)
Export a module activator class.
static std::vector< CustomMimeType * > Get()
virtual void Load(ModuleContext *context)=0