fw4spl
io/fwGdcmIO/src/fwGdcmIO/reader/ie/Series.cpp
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 #include "fwGdcmIO/reader/ie/Series.hpp"
8 
9 #include "fwGdcmIO/helper/DicomDataReader.hxx"
10 
11 #include <fwMedData/DicomSeries.hpp>
12 #include <fwMedData/Series.hpp>
13 #include <fwMedData/types.hpp>
14 
15 #include <boost/algorithm/string/classification.hpp>
16 #include <boost/algorithm/string/split.hpp>
17 
18 #include <sstream>
19 
20 namespace fwGdcmIO
21 {
22 namespace reader
23 {
24 namespace ie
25 {
26 
27 //------------------------------------------------------------------------------
28 
29 Series::Series(const ::fwMedData::DicomSeries::csptr& dicomSeries,
30  const SPTR(::gdcm::Reader)& reader,
31  const ::fwGdcmIO::container::DicomInstance::sptr& instance,
32  const ::fwMedData::Series::sptr& series,
33  const ::fwLog::Logger::sptr& logger,
34  ProgressCallback progress,
35  CancelRequestedCallback cancel) :
36  ::fwGdcmIO::reader::ie::InformationEntity< ::fwMedData::Series >(dicomSeries, reader, instance, series,
37  logger, progress, cancel)
38 {
39 }
40 
41 //------------------------------------------------------------------------------
42 
44 {
45 }
46 
47 //------------------------------------------------------------------------------
48 
49 void Series::readGeneralSeriesModule()
50 {
51  // Retrieve dataset
52  ::gdcm::DataSet& dataset = m_reader->GetFile().GetDataSet();
53 
54  // Serie's instance UID - Type 1
55  const std::string& instanceUID = ::fwGdcmIO::helper::DicomDataReader::getTagValue< 0x0020, 0x000e >(dataset);
56  m_object->setInstanceUID(instanceUID);
57 
58  // Series's modality - Type 1
59  const std::string& modality = ::fwGdcmIO::helper::DicomDataReader::getTagValue< 0x0008, 0x0060 >(dataset);
60  m_object->setModality(modality);
61 
62  // Serie's date - Type 3
63  const std::string& date = ::fwGdcmIO::helper::DicomDataReader::getTagValue< 0x0008, 0x0021 >(dataset);
64  m_object->setDate(date);
65 
66  // Serie's time - Type 3
67  const std::string& time = ::fwGdcmIO::helper::DicomDataReader::getTagValue< 0x0008, 0x0031 >(dataset);
68  m_object->setTime(time);
69 
70  // Serie's description
71  const std::string& description = ::fwGdcmIO::helper::DicomDataReader::getTagValue< 0x0008, 0x103e >(dataset);
72  m_object->setDescription(description);
73 
74  // Serie's number - Type 2
75  // NOTE: Not used in FW4SPL
76 
77  // Performing physicians name - Type 3
78  const std::string& performingPhysicianNamesStr =
79  ::fwGdcmIO::helper::DicomDataReader::getTagValue< 0x0008, 0x1050 >(dataset);
80 
81  if(!performingPhysicianNamesStr.empty())
82  {
83  ::fwMedData::DicomValuesType performingPhysicianNames;
84  ::boost::split( performingPhysicianNames, performingPhysicianNamesStr, ::boost::is_any_of("\\"));
85  m_object->setPerformingPhysiciansName(performingPhysicianNames);
86  }
87 
88  // Laterality - Type 2C
89  // NOTE: Not used in FW4SPL
90 
91  // Patient Position - Type 2C
92  // NOTE: Not used in FW4SPL
93 }
94 
95 } // namespace ie
96 } // namespace reader
97 } // namespace fwGdcmIO
#define SPTR(_cls_)
Namespace containing medical data.
The namespace fwGdcmIO contains reader, writer and helper for dicom data.
FWGDCMIO_API Series(const std::shared_ptr< const ::fwMedData::DicomSeries > &dicomSeries, const std::shared_ptr< ::gdcm::Reader > &reader, const std::shared_ptr< ::fwGdcmIO::container::DicomInstance > &instance, const ::fwMedData::Series::sptr &series, const ::fwLog::Logger::sptr &logger=nullptr, ProgressCallback progress=nullptr, CancelRequestedCallback cancel=nullptr)
Constructor.
virtual FWMEDDATA_API ~Series()
Destructor.