fw4spl
reader/tid/MeasurementReport.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/tid/MeasurementReport.hpp"
8 
9 #include "fwGdcmIO/reader/tid/Fiducial.hpp"
10 #include "fwGdcmIO/reader/tid/Measurement.hpp"
11 
12 namespace fwGdcmIO
13 {
14 namespace reader
15 {
16 namespace tid
17 {
18 
19 //------------------------------------------------------------------------------
20 
21 MeasurementReport::MeasurementReport(const ::fwMedData::DicomSeries::csptr& dicomSeries,
22  const SPTR(::gdcm::Reader)& reader,
23  const ::fwGdcmIO::container::DicomInstance::sptr& instance,
24  const ::fwData::Image::sptr& image,
25  const ::fwLog::Logger::sptr& logger) :
26  ::fwGdcmIO::reader::tid::TemplateID< ::fwData::Image >(dicomSeries, reader, instance, image, logger)
27 {
28 }
29 
30 //------------------------------------------------------------------------------
31 
33 {
34 }
35 
36 //------------------------------------------------------------------------------
37 
38 void MeasurementReport::readSR(const SPTR(::fwGdcmIO::container::sr::DicomSRNode)& root)
39 {
40  if(root->getCodedAttribute() ==
41  ::fwGdcmIO::container::DicomCodedAttribute("dd1dd1", "DCM", "Imaging Measurement Report"))
42  {
44  {
45  // Try to identify a fiducial node
46  if(node->getCodedAttribute() == ::fwGdcmIO::container::DicomCodedAttribute("dd1d93", "DCM", "Fiducials"))
47  {
48  for(const SPTR(::fwGdcmIO::container::sr::DicomSRNode)& subNode : node->getSubNodeContainer())
49  {
50  ::fwGdcmIO::reader::tid::Fiducial fiducial(m_dicomSeries, m_reader, m_instance, m_object, m_logger);
51  fiducial.readNode(subNode);
52  }
53  }
54  // Try to identify a measurement node
55  else if(node->getCodedAttribute() ==
56  ::fwGdcmIO::container::DicomCodedAttribute("dd1d91", "DCM", "Imaging Measurements"))
57  {
58  for(const SPTR(::fwGdcmIO::container::sr::DicomSRNode)& subNode : node->getSubNodeContainer())
59  {
60  ::fwGdcmIO::reader::tid::Measurement measurement(m_dicomSeries, m_reader, m_instance, m_object,
61  m_logger);
62  measurement.readNode(subNode);
63  }
64  }
65  }
66  }
67 }
68 
69 //------------------------------------------------------------------------------
70 
71 } // namespace tid
72 } // namespace reader
73 } // namespace fwGdcmIO
#define SPTR(_cls_)
const SubNodeContainer & getSubNodeContainer() const
Get Sub node container.
Definition: DicomSRNode.hpp:53
std::shared_ptr< const ::fwData::Image > m_object
FW4SPL Object.
FWGDCMIO_API MeasurementReport(const std::shared_ptr< const ::fwMedData::DicomSeries > &dicomSeries, const std::shared_ptr< ::gdcm::Reader > &reader, const std::shared_ptr< ::fwGdcmIO::container::DicomInstance > &instance, const ::fwData::Image::sptr &image, const ::fwLog::Logger::sptr &logger)
Constructor.
virtual FWGDCMIO_API void readNode(const std::shared_ptr< ::fwGdcmIO::container::sr::DicomSRNode > &node)
Read a measurement node.
The namespace fwGdcmIO contains reader, writer and helper for dicom data.
This class defines a node in a SR document.
Definition: DicomSRNode.hpp:27
This class represents a DICOM basic coded entry. It stores the four mains attributes : Code Value...
std::shared_ptr< ::fwGdcmIO::container::DicomInstance > m_instance
DICOM Instance.
virtual FWGDCMIO_API void readNode(const std::shared_ptr< ::fwGdcmIO::container::sr::DicomSRNode > &node)
Read a fiducial node.
Contains the representation of the data objects used in the framework.
virtual FWGDCMIO_API ~MeasurementReport()
Destructor.
const DicomCodedAttribute & getCodedAttribute() const
Get Coded attribute.
Definition: DicomSRNode.hpp:65