fw4spl
fwDcmtkIO/include/fwDcmtkIO/SeriesDBReader.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #pragma once
8 
9 #include "fwDcmtkIO/config.hpp"
10 #include "fwDcmtkIO/reader/IObjectReader.hpp"
11 
12 #include <fwData/location/Folder.hpp>
13 #include <fwData/location/MultiFiles.hpp>
14 
15 #include <fwDataIO/reader/GenericObjectReader.hpp>
16 
17 #include <fwServices/IService.hpp>
18 
19 #include <fwTools/ProgressAdviser.hpp>
20 
21 namespace fwMedData
22 {
23 class SeriesDB;
24 class Patient;
25 class Study;
26 class Equipment;
27 class Series;
28 }
29 
30 class DcmDataset;
31 
32 namespace fwDcmtkIO
33 {
34 
39 class FWDCMTKIO_CLASS_API SeriesDBReader : public ::fwDataIO::reader::GenericObjectReader< ::fwMedData::SeriesDB >,
40  public ::fwData::location::enableFolder< ::fwDataIO::reader::IObjectReader >,
41  public ::fwData::location::enableMultiFiles< ::fwDataIO::reader::
42  IObjectReader >,
44 {
45 
46 public:
47 
50  (()),
51  ::fwDataIO::reader::factory::New< SeriesDBReader >
52  );
54 
55  typedef std::map< std::string, SPTR(::fwMedData::Patient) > PatientMapType;
56  typedef std::map< std::string, SPTR(::fwMedData::Study) > StudyMapType;
57  typedef std::map< std::string, SPTR(::fwMedData::Equipment) > EquipmentMapType;
58  typedef std::vector< SPTR(::fwMedData::DicomSeries) > DicomSeriesContainerType;
59  typedef std::vector< std::string > FilenameContainerType;
60  typedef std::vector< std::string > SupportedSOPClassContainerType;
61 
63 
64  FWDCMTKIO_API ~SeriesDBReader();
65 
67  FWDCMTKIO_API void read() override;
68 
74  FWDCMTKIO_API void readFromDicomSeriesDB(CSPTR(::fwMedData::SeriesDB) dicomSeriesDB,
75  ::fwServices::IService::sptr notifier = ::fwServices::IService::sptr());
76 
78  FWDCMTKIO_API void readDicomSeries();
79 
81  FWDCMTKIO_API bool isDicomDirAvailable();
82 
84  FWDCMTKIO_API DicomSeriesContainerType& getDicomSeries();
85 
87  const bool& getDicomdirActivated() const
88  {
89  return m_isDicomdirActivated;
90  }
91 
93  void setDicomdirActivated(const bool& isDicomdirActivated)
94  {
95  m_isDicomdirActivated = isDicomdirActivated;
96  }
97 
99  const std::string& getDicomFilterType() const
100  {
101  return m_dicomFilterType;
102  }
103 
105  void setDicomFilterType(const std::string& dicomFilterType)
106  {
107  m_dicomFilterType = dicomFilterType;
108  }
109 
111  const SupportedSOPClassContainerType& getSupportedSOPClassContainer() const
112  {
113  return m_supportedSOPClassContainer;
114  }
115 
117  void setSupportedSOPClassContainer(const SupportedSOPClassContainerType& supportedSOPClassContainer)
118  {
119  m_supportedSOPClassContainer = supportedSOPClassContainer;
120  }
121 
122 private:
123 
125  FilenameContainerType getFilenames();
126 
133  void addSeries(const std::vector< std::string >& filenames);
134 
139  SPTR(::fwMedData::Patient) createPatient(DcmDataset* dataset);
140 
145  SPTR(::fwMedData::Study) createStudy(DcmDataset* dataset);
146 
151  SPTR(::fwMedData::Equipment) createEquipment(DcmDataset* dataset);
152 
158  void createSeries(DcmDataset* dataset, const std::string& filename);
159 
165  void convertDicomSeries(CSPTR(::fwMedData::DicomSeries) dicomSeries,
166  ::fwServices::IService::sptr notifier = ::fwServices::IService::sptr());
167 
169  PatientMapType m_patientMap;
170 
172  StudyMapType m_studyMap;
173 
175  EquipmentMapType m_equipmentMap;
176 
178  DicomSeriesContainerType m_dicomSeriesContainer;
179 
181  bool m_isDicomdirActivated;
182 
184  std::string m_dicomFilterType;
185 
187  SupportedSOPClassContainerType m_supportedSOPClassContainer;
188 
189 };
190 
191 } // namespace fwDcmtkIO
#define SPTR(_cls_)
#define CSPTR(_cls_)
This class contains helper to generate Medical Data (SeriesDB, ImageSeries, ...). ...
void setDicomdirActivated(const bool &isDicomdirActivated)
Set Set whether the reader must use the dicomdir file or not.
Namespace containing medical data.
void setSupportedSOPClassContainer(const SupportedSOPClassContainerType &supportedSOPClassContainer)
Set Supported SOP Class.
Subclasses Inherited from ProgressAdviser can notify progression This class is used as base class to ...
Reads DICOM data from a directory path in order to create a SeriesDB object.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
generic class for all object readers.
const SupportedSOPClassContainerType & getSupportedSOPClassContainer() const
Get Supported SOP Class.
void setDicomFilterType(const std::string &dicomFilterType)
Set Dicom filter type that must be applied prior the reading process.
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate common construction methods for classes with one factory.
fwDcmtkIO contains classes used to pull Dicom images from a pacs using dcmtk library.
Definition: Codec.hpp:12
const std::string & getDicomFilterType() const
Get Dicom filter type that must be applied prior the reading process.
#define fwCoreAllowSharedFromThis()
Generate getSptr and getConstSptr methods.
This class is derived by reader/writer.
Definition: Folder.hpp:80
This class is derived by reader/writer.
Definition: MultiFiles.hpp:58
const bool & getDicomdirActivated() const
Get Set whether the reader must use the dicomdir file or not.