fw4spl
io/fwGdcmIO/src/fwGdcmIO/reader/ie/Patient.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/Patient.hpp"
8 
9 #include "fwGdcmIO/helper/DicomDataReader.hxx"
10 
11 #include <fwMedData/DicomSeries.hpp>
12 #include <fwMedData/Patient.hpp>
13 
14 namespace fwGdcmIO
15 {
16 namespace reader
17 {
18 namespace ie
19 {
20 
21 //------------------------------------------------------------------------------
22 
23 Patient::Patient(const ::fwMedData::DicomSeries::csptr& dicomSeries,
24  const SPTR(::gdcm::Reader)& reader,
25  const ::fwGdcmIO::container::DicomInstance::sptr& instance,
26  const ::fwMedData::Patient::sptr& patient,
27  const ::fwLog::Logger::sptr& logger,
28  ProgressCallback progress,
29  CancelRequestedCallback cancel) :
30  ::fwGdcmIO::reader::ie::InformationEntity< ::fwMedData::Patient >(dicomSeries, reader, instance, patient, logger,
31  progress, cancel)
32 {
33 }
34 
35 //------------------------------------------------------------------------------
36 
38 {
39 }
40 
41 //------------------------------------------------------------------------------
42 
43 void Patient::readPatientModule()
44 {
45  // Retrieve dataset
46  const ::gdcm::DataSet& dataset = m_reader->GetFile().GetDataSet();
47 
48  // Patient's name - Type 2
49  const std::string& patientName =
50  ::fwGdcmIO::helper::DicomDataReader::getTagValue< 0x0010, 0x0010 >(dataset);
51  m_object->setName(patientName);
52 
53  // Patient's ID - Type 2
54  const std::string& patientId =
55  ::fwGdcmIO::helper::DicomDataReader::getTagValue< 0x0010, 0x0020 >(dataset);
56  m_object->setPatientId(patientId);
57 
58  // Patient's birth date - Type 2
59  const std::string& birthDate =
60  ::fwGdcmIO::helper::DicomDataReader::getTagValue< 0x0010, 0x0030 >(dataset);
61  m_object->setBirthdate(birthDate);
62 
63  // Patient's sex - Type 2
64  const std::string& sex =
65  ::fwGdcmIO::helper::DicomDataReader::getTagValue< 0x0010, 0x0040 >(dataset);
66  m_object->setSex(sex);
67 }
68 
69 } // namespace ie
70 } // namespace reader
71 } // namespace fwGdcmIO
#define SPTR(_cls_)
This class contains helper to generate Medical Data (SeriesDB, ImageSeries, ...). ...
Namespace containing medical data.
virtual FWMEDDATA_API ~Patient()
Destructor.
The namespace fwGdcmIO contains reader, writer and helper for dicom data.
FWGDCMIO_API Patient(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::Patient::sptr &patient, const ::fwLog::Logger::sptr &logger=nullptr, ProgressCallback progress=nullptr, CancelRequestedCallback cancel=nullptr)
Constructor.