Fraxinus  22.04-rc5
An IGT application
cxFileManagerServicePluginActivator.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
13 
14 #include <QtPlugin>
15 
18 #include "cxMetaImageReader.h"
19 #include "cxPNGImageReader.h"
20 #include "cxPolyDataMeshReader.h"
22 #include "cxStlMeshReader.h"
23 #include "cxNIfTIReader.h"
24 #include "cxMNIReaderWriter.h"
25 #include "cxDICOMReader.h"
26 #include "cxLogger.h"
28 #include "cxViewServiceProxy.h"
29 
30 namespace cx
31 {
32 
34 {
35 }
36 
38 {
39  if(!mRegisteredFileReaderWriterServices.empty())
40  CX_LOG_ERROR() << "FileReaderWriterServices is not empty.";
41 }
42 
43 void FileManagerServicePluginActivator::start(ctkPluginContext* context)
44 {
45  FileManagerImpService *filemanager = new FileManagerImpService(context);
46  mRegisteredFileManagerService = RegisteredService::create<FileManagerImpService>(context, filemanager, FileManagerService_iid);
47 
48  PatientModelServicePtr patientModelService = PatientModelServiceProxy::create(context);
49  ViewServicePtr viewService = ViewServiceProxy::create(context);
50 
51  mRegisteredFileReaderWriterServices.push_back(RegisteredService::create<MetaImageReader>(context, new MetaImageReader(patientModelService), FileReaderWriterService_iid));
52  mRegisteredFileReaderWriterServices.push_back(RegisteredService::create<PNGImageReader>(context, new PNGImageReader(patientModelService), FileReaderWriterService_iid));
53  mRegisteredFileReaderWriterServices.push_back(RegisteredService::create<PolyDataMeshReader>(context, new PolyDataMeshReader(patientModelService), FileReaderWriterService_iid));
54  mRegisteredFileReaderWriterServices.push_back(RegisteredService::create<XMLPolyDataMeshReader>(context, new XMLPolyDataMeshReader(patientModelService), FileReaderWriterService_iid));
55  mRegisteredFileReaderWriterServices.push_back(RegisteredService::create<StlMeshReader>(context, new StlMeshReader(patientModelService), FileReaderWriterService_iid));
56  mRegisteredFileReaderWriterServices.push_back(RegisteredService::create<NIfTIReader>(context, new NIfTIReader(patientModelService), FileReaderWriterService_iid));
57  mRegisteredFileReaderWriterServices.push_back(RegisteredService::create<MNIReaderWriter>(context, new MNIReaderWriter(patientModelService, viewService), FileReaderWriterService_iid));
58  mRegisteredFileReaderWriterServices.push_back(RegisteredService::create<DICOMReader>(context, new DICOMReader(patientModelService), FileReaderWriterService_iid));
59 
60  mRegisteredGuiExtenderService = RegisteredService::create<ImportExportGuiExtenderService>(context, new ImportExportGuiExtenderService(context), GUIExtenderService_iid);
61 }
62 
63 void FileManagerServicePluginActivator::stop(ctkPluginContext* context)
64 {
65 
66  for(std::vector<RegisteredServicePtr>::iterator it = mRegisteredFileReaderWriterServices.begin(); it != mRegisteredFileReaderWriterServices.end(); )
67  {
68  (*it).reset();
69  it = mRegisteredFileReaderWriterServices.erase(it);
70  }
71 
72  mRegisteredGuiExtenderService.reset();
73  mRegisteredFileManagerService.reset();
74 
75  Q_UNUSED(context);
76 }
77 
78 } // cx
boost::shared_ptr< class ViewService > ViewServicePtr
Reader for NIfTI files.
Definition: cxNIfTIReader.h:24
#define FileManagerService_iid
static PatientModelServicePtr create(ctkPluginContext *pluginContext)
#define CX_LOG_ERROR
Definition: cxLogger.h:99
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Reader for portable network graphics .png files.
#define GUIExtenderService_iid
Reader for .vtk files.
static ViewServicePtr create(ctkPluginContext *pluginContext)
Reader for STL files.
#define FileReaderWriterService_iid
Namespace for all CustusX production code.