CustusX  22.04-rc5
An IGT application
cxFileManagerServiceBase.h
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 
12 #ifndef CXFILEMANAGERLSERVICEBASE_H
13 #define CXFILEMANAGERLSERVICEBASE_H
14 
15 #include "cxFileManagerService.h"
17 #include "cxResourceExport.h"
19 class ctkPluginContext;
20 
21 namespace cx
22 {
23 
29 class cxResource_EXPORT FileManagerServiceBase : public FileManagerService
30 {
31 public:
32  Q_INTERFACES(cx::FileManagerService)
33 
35  virtual ~FileManagerServiceBase();
36  virtual bool isNull();
37 
38  //read
39  QString canLoadDataType() const;
40  bool canLoad(const QString& type, const QString& filename);
41  DataPtr load(const QString& uid, const QString& filename);
42  bool readInto(DataPtr data, QString path);
43  std::vector<DataPtr> read(const QString &filename);
44 
45  //write
46  void save(DataPtr data, const QString& filename);
47 
48  //utility
49  vtkImageDataPtr loadVtkImageData(QString filename);
50  vtkPolyDataPtr loadVtkPolyData(QString filename);
51 
52  QString findDataTypeFromFile(QString filename);
53  std::vector<FileReaderWriterServicePtr> getExportersForDataType(QString dataType);
54  std::vector<FileReaderWriterServicePtr> getImportersForDataType(QString dataType);
55 
56  void addFileReaderWriter(FileReaderWriterService *service);
57  void removeFileReaderWriter(FileReaderWriterService *service);
58 
59  QString getFileReaderName(const QString &filename);
60 private:
61  FileReaderWriterServicePtr findReader(const QString& path, const QString& type="unknown");
62  FileReaderWriterServicePtr findWriter(const QString& path, const QString& type="unknown");
63  std::set<FileReaderWriterServicePtr> mDataReaders;
64 };
65 
66 } //cx
67 
68 #endif // CXFILEMANAGERLSERVICEBASE_H
boost::shared_ptr< class Data > DataPtr
boost::shared_ptr< class FileReaderWriterService > FileReaderWriterServicePtr
vtkSmartPointer< vtkPolyData > vtkPolyDataPtr
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
Namespace for all CustusX production code.