CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxDICOMReader.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 CXDICOMREADER_H
13 #define CXDICOMREADER_H
14 
16 #include "org_custusx_core_filemanager_Export.h"
17 class QProgressDialog;
18 
19 typedef QSharedPointer<class ctkDICOMDatabase> ctkDICOMDatabasePtr;
20 
21 namespace cx {
22 
23 class org_custusx_core_filemanager_EXPORT DICOMReader : public FileReaderWriterImplService
24 {
25 public:
26  Q_INTERFACES(cx::FileReaderWriterService)
27  DICOMReader(PatientModelServicePtr patientModelService);
28  virtual ~DICOMReader() {}
29 
30  bool isNull(){return false;}
31 
42  virtual bool canRead(const QString& type, const QString& filename);
43  virtual bool readInto(DataPtr data, QString path);
44  bool readInto(ImagePtr image, QString filename);
45  virtual QString canReadDataType() const;
46  virtual DataPtr read(const QString& uid, const QString& filename);
47  std::vector<DataPtr> read(const QString &filename);
48 
49  void write(DataPtr data, const QString &filename) {}
50  QString canWriteDataType() const;
51  bool canWrite(const QString &type, const QString &filename) const;
52 
53  virtual vtkImageDataPtr loadVtkImageData(QString filename);
54 
55 protected:
56  std::vector<ImagePtr> importSeries(QString fileName, bool readBestSeries);
57  QString getBestDICOMSeries(ctkDICOMDatabasePtr database);
58  QStringList getAllDICOMSeries(ctkDICOMDatabasePtr database);
59  std::vector<ImagePtr> importBestSeries(ctkDICOMDatabasePtr database);
60  std::vector<ImagePtr> importAllSeries(ctkDICOMDatabasePtr database, QProgressDialog &progress);
61  void stopDCMTKMessages();
62  bool canReadDir(QString dirname, bool checkSubDirs);
63  bool canReadFile(QString filename);
64  void addFolderToDicomDatabase(ctkDICOMDatabasePtr database, QString folder);
65  QStringList findAllSubfoldersWithDicomFiles(QString folder, QProgressDialog &progress);
66  QStringList findAllSubDirs(QString folder);
67 };
68 
69 } //cx
70 #endif // CXDICOMREADER_H
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
void write(DataPtr data, const QString &filename)
Definition: cxDICOMReader.h:49
boost::shared_ptr< class Data > DataPtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
QSharedPointer< class ctkDICOMDatabase > ctkDICOMDatabasePtr
Definition: cxDICOMReader.h:17
virtual ~DICOMReader()
Definition: cxDICOMReader.h:28
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
Namespace for all CustusX production code.