Medical Imaging Interaction Toolkit  2018.4.99-4c24e3cb
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 
20 
22 
23 namespace mitk
24 {
28  class DICOMQIIOActivator : public us::ModuleActivator
29  {
30  std::vector<AbstractFileIO *> m_FileIOs;
31 
32  public:
33  void Load(us::ModuleContext * context) override
34  {
37 
38  std::vector<mitk::CustomMimeType *> mimeTypes = mitk::MitkDICOMSEGIOMimeTypes::Get();
39  for (std::vector<mitk::CustomMimeType *>::const_iterator mimeTypeIter = mimeTypes.begin(),
40  iterEnd = mimeTypes.end();
41  mimeTypeIter != iterEnd;
42  ++mimeTypeIter)
43  {
44  context->RegisterService(*mimeTypeIter, props);
45  }
46 
47  m_FileIOs.push_back(new DICOMSegmentationIO());
48  }
49  void Unload(us::ModuleContext *) override
50  {
51  for (auto &elem : m_FileIOs)
52  {
53  delete elem;
54  }
55  }
56  };
57 }
58 
59 US_EXPORT_MODULE_ACTIVATOR(mitk::DICOMQIIOActivator)
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
#define US_EXPORT_MODULE_ACTIVATOR(_activator_type)
Export a module activator class.
static std::vector< CustomMimeType * > Get()
virtual void Load(ModuleContext *context)=0