fw4spl
SeriesDBLazyReader.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
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 #ifndef __VTKGDCMIO_SERIESDBLAZYREADER_HPP__
8 #define __VTKGDCMIO_SERIESDBLAZYREADER_HPP__
9 
10 #include "vtkGdcmIO/config.hpp"
11 
12 #include <fwCore/macros.hpp>
13 
14 #include <fwData/Image.hpp>
15 #include <fwData/location/Folder.hpp>
16 #include <fwData/location/MultiFiles.hpp>
17 
18 #include <fwDataIO/reader/GenericObjectReader.hpp>
19 
20 #include <gdcmScanner.h>
21 
22 namespace fwMedData
23 {
24 class SeriesDB;
25 class Equipment;
26 class ImageSeries;
27 class Patient;
28 class Series;
29 class SeriesDB;
30 class Study;
31 }
32 
33 namespace fwJobs
34 {
35 class Observer;
36 }
37 
38 namespace vtkGdcmIO
39 {
40 
45 class SeriesDBLazyReader : public ::fwDataIO::reader::GenericObjectReader< ::fwMedData::SeriesDB >,
46  public ::fwData::location::enableFolder< ::fwDataIO::reader::IObjectReader >,
47  public ::fwData::location::enableMultiFiles< ::fwDataIO::reader::IObjectReader >
48 {
49 
50 public:
51 
52  typedef std::vector< std::string > SeriesFilesType;
53 
54  typedef std::map< std::string, SeriesFilesType > MapSeriesType;
55 
58  (()),
59  ::fwDataIO::reader::factory::New< SeriesDBLazyReader >
60  );
61 
63 
66 
68  VTKGDCMIO_API ~SeriesDBLazyReader();
69 
71  VTKGDCMIO_API void read() override;
72 
74  VTKGDCMIO_API SPTR(::fwJobs::IJob) getJob() const override;
75 
76 private:
77 
85  SPTR( ::fwMedData::SeriesDB ) createSeriesDB( const ::boost::filesystem::path &dicomDir );
86 
93  void addSeries( const SPTR( ::fwMedData::SeriesDB )& seriesDB, const std::vector< std::string >& filenames);
94 
96  double computeZSpacing( const SeriesFilesType& seriesFiles );
97 
99  void fillImage( gdcm::Scanner& scanner, const SeriesFilesType& seriesFiles,
100  const std::string& dcmFile, ::fwData::Image::sptr img );
101 
103  void preprocessImage( const ::fwData::Image::sptr& img, const SeriesFilesType& files );
104 
106  void fillEquipment( gdcm::Scanner & scanner, const std::string & dcmFile, SPTR( ::fwMedData::Equipment ) equipment);
107 
109  void fillStudy( gdcm::Scanner & scanner, const std::string & dcmFile, SPTR( ::fwMedData::Study ) study );
110 
112  void fillPatient( gdcm::Scanner & scanner, const std::string & dcmFile, SPTR( ::fwMedData::Patient ) patient );
113 
115  void fillSeries( gdcm::Scanner & scanner, const std::string & dcmFile, SPTR( ::fwMedData::Series ) series );
116 
118  void scanFiles( gdcm::Scanner& scanner, const std::vector< std::string >& filenames );
119 
121  SPTR(::fwJobs::Observer) m_job;
122 };
123 
124 } // namespace vtkGdcmIO
125 
126 #endif // __VTKGDCMIO_SERIESDBLAZYREADER_HPP__
#define SPTR(_cls_)
This class contains helper to generate Medical Data (SeriesDB, ImageSeries, ...). ...
This class is an interface for class managing job.
Definition: IJob.hpp:28
Namespace containing medical data.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
STL namespace.
This file defines fwCore base macros.
vtkmGdcm reader/writer lib
Definition: GdcmHelper.hpp:15
Reads DICOM data from a directory path in order to create a SeriesDB object in lazy mode...
generic class for all object readers.
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate common construction methods for classes with one factory.
#define fwCoreAllowSharedFromThis()
Generate getSptr and getConstSptr methods.
This class is derived by reader/writer.
Definition: Folder.hpp:80
Contains the representation of the data objects used in the framework.
This class is derived by reader/writer.
Definition: MultiFiles.hpp:58
This namespace fwJobs provides jobs management.