Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkDiffusionModuleActivator.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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 #include <usModuleActivator.h>
17 #include <usModuleContext.h>
18 
23 
30 
31 #include <mitkCoreServices.h>
34 
36 
37 namespace mitk
38 {
42  class DiffusionModuleActivator : public us::ModuleActivator
43  {
44  public:
45 
46  void Load(us::ModuleContext* context) override
47  {
50 
51  m_MimeTypes = mitk::DiffusionIOMimeTypes::Get();
52  for (std::vector<mitk::CustomMimeType*>::const_iterator mimeTypeIter = m_MimeTypes.begin(),
53  iterEnd = m_MimeTypes.end(); mimeTypeIter != iterEnd; ++mimeTypeIter)
54  {
55  context->RegisterService(*mimeTypeIter, props);
56  }
57 
58  m_FiberBundleVtkReader = new FiberBundleVtkReader();
59  m_FiberBundleTrackVisReader = new FiberBundleTrackVisReader();
60  m_ConnectomicsNetworkReader = new ConnectomicsNetworkReader();
61  m_PlanarFigureCompositeReader = new PlanarFigureCompositeReader();
62 
63  m_FiberBundleVtkWriter = new FiberBundleVtkWriter();
64  m_FiberBundleTrackVisWriter = new FiberBundleTrackVisWriter();
65  m_ConnectomicsNetworkWriter = new ConnectomicsNetworkWriter();
66  m_ConnectomicsNetworkCSVWriter = new ConnectomicsNetworkCSVWriter();
67  m_ConnectomicsNetworkMatrixWriter = new ConnectomicsNetworkMatrixWriter();
68  m_PlanarFigureCompositeWriter = new PlanarFigureCompositeWriter();
69  }
70 
71  void Unload(us::ModuleContext*) override
72  {
73  for (unsigned int loop(0); loop < m_MimeTypes.size(); ++loop)
74  {
75  delete m_MimeTypes.at(loop);
76  }
77 
78  delete m_FiberBundleVtkReader;
79  delete m_FiberBundleTrackVisReader;
80  delete m_ConnectomicsNetworkReader;
81  delete m_PlanarFigureCompositeReader;
82 
83  delete m_FiberBundleVtkWriter;
84  delete m_FiberBundleTrackVisWriter;
85  delete m_ConnectomicsNetworkWriter;
86  delete m_ConnectomicsNetworkCSVWriter;
87  delete m_ConnectomicsNetworkMatrixWriter;
88  delete m_PlanarFigureCompositeWriter;
89  }
90 
91  private:
92 
93  FiberBundleVtkReader * m_FiberBundleVtkReader;
94  FiberBundleTrackVisReader * m_FiberBundleTrackVisReader;
95  ConnectomicsNetworkReader * m_ConnectomicsNetworkReader;
96  PlanarFigureCompositeReader* m_PlanarFigureCompositeReader;
97 
98  FiberBundleVtkWriter * m_FiberBundleVtkWriter;
99  FiberBundleTrackVisWriter * m_FiberBundleTrackVisWriter;
100  ConnectomicsNetworkWriter * m_ConnectomicsNetworkWriter;
101  ConnectomicsNetworkCSVWriter * m_ConnectomicsNetworkCSVWriter;
102  ConnectomicsNetworkMatrixWriter * m_ConnectomicsNetworkMatrixWriter;
103  PlanarFigureCompositeWriter* m_PlanarFigureCompositeWriter;
104 
105  std::vector<mitk::CustomMimeType*> m_MimeTypes;
106 
107  };
108 }
109 
110 US_EXPORT_MODULE_ACTIVATOR(mitk::DiffusionModuleActivator)
US_Core_EXPORT const std::string & SERVICE_RANKING()
DataCollection - Class to facilitate loading/accessing structured data.
virtual void Unload(ModuleContext *context)=0
static std::vector< CustomMimeType * > Get()
US_UNORDERED_MAP_TYPE< std::string, Any > ServiceProperties
virtual void Load(ModuleContext *context)=0
US_EXPORT_MODULE_ACTIVATOR(mitk::SimulationActivator)