fw4spl
io/fwGdcmIO/src/fwGdcmIO/reader/ie/Study.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/Study.hpp"
8 
9 #include "fwGdcmIO/helper/DicomDataReader.hxx"
10 
11 #include <fwMedData/DicomSeries.hpp>
12 #include <fwMedData/Study.hpp>
13 
14 namespace fwGdcmIO
15 {
16 namespace reader
17 {
18 namespace ie
19 {
20 
21 //------------------------------------------------------------------------------
22 
23 Study::Study(const ::fwMedData::DicomSeries::csptr& dicomSeries,
24  const SPTR(::gdcm::Reader)& reader,
25  const ::fwGdcmIO::container::DicomInstance::sptr& instance,
26  const ::fwMedData::Study::sptr& study,
27  const ::fwLog::Logger::sptr& logger,
28  ProgressCallback progress,
29  CancelRequestedCallback cancel) :
30  ::fwGdcmIO::reader::ie::InformationEntity< ::fwMedData::Study >(dicomSeries, reader, instance, study, logger,
31  progress, cancel)
32 {
33 }
34 
35 //------------------------------------------------------------------------------
36 
38 {
39 }
40 
41 //------------------------------------------------------------------------------
42 
43 void Study::readGeneralStudyModule()
44 {
45  // Retrieve dataset
46  const ::gdcm::DataSet& dataset = m_reader->GetFile().GetDataSet();
47 
48  // Study's date - Type 2
49  const std::string& studyDate = ::fwGdcmIO::helper::DicomDataReader::getTagValue< 0x0008, 0x0020 >(dataset);
50  m_object->setDate(studyDate);
51 
52  // Study's time - Type 2
53  const std::string& studyTime = ::fwGdcmIO::helper::DicomDataReader::getTagValue< 0x0008, 0x0030 >(dataset);
54  m_object->setTime(studyTime);
55 
56  // Study's accession number - Type 2
57  // NOTE: Not used in FW4SPL
58 
59  // Study's description - Type 3
60  const std::string& description =
61  ::fwGdcmIO::helper::DicomDataReader::getTagValue< 0x0008, 0x1030 >(dataset);
62  m_object->setDescription(description);
63 
64  // Study's UID - Type 1
65  const std::string& instanceUID =
66  ::fwGdcmIO::helper::DicomDataReader::getTagValue< 0x0020, 0x000d >(dataset);
67  m_object->setInstanceUID(instanceUID);
68 
69  // Study's ID - Type 2
70  // NOTE: Not used in FW4SPL
71 
72  // Study's referring physician name
73  const std::string& referringPhysicianName =
74  ::fwGdcmIO::helper::DicomDataReader::getTagValue< 0x0008, 0x0090 >(dataset);
75  m_object->setReferringPhysicianName(referringPhysicianName);
76 }
77 
78 //------------------------------------------------------------------------------
79 
80 void Study::readPatientStudyModule()
81 {
82  // Retrieve dataset
83  const ::gdcm::DataSet& dataset = m_reader->GetFile().GetDataSet();
84 
85  // PatientAge - Type 3
86  const std::string& patientAge =
87  ::fwGdcmIO::helper::DicomDataReader::getTagValue< 0x0010, 0x1010 >(dataset);
88  m_object->setPatientAge(patientAge);
89 }
90 
91 //------------------------------------------------------------------------------
92 
93 }// namespace ie
94 } // namespace reader
95 } // namespace fwGdcmIO
#define SPTR(_cls_)
Namespace containing medical data.
FWGDCMIO_API Study(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::Study::sptr &study, const ::fwLog::Logger::sptr &logger=nullptr, ProgressCallback progress=nullptr, CancelRequestedCallback cancel=nullptr)
Constructor.
virtual FWMEDDATA_API ~Study()
Destructor.
The namespace fwGdcmIO contains reader, writer and helper for dicom data.