fw4spl
DicomSRSCoord3DNode.cpp
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 #include "fwGdcmIO/container/sr/DicomSRSCoord3DNode.hpp"
8 
9 #include "fwGdcmIO/helper/DicomDataWriter.hxx"
10 
11 #include <fwServices/macros.hpp>
12 
13 namespace fwGdcmIO
14 {
15 namespace container
16 {
17 namespace sr
18 {
19 
20 //------------------------------------------------------------------------------
21 
23  const std::string& relationship,
24  const std::string& graphicType,
25  const GraphicDataContainerType graphicDataContainer,
26  const std::string& frameOfReferenceUID) :
27  ::fwGdcmIO::container::sr::DicomSRNode(codedAttribute, "SCOORD3D", relationship),
28  m_frameOfReferenceUID(frameOfReferenceUID),
29  m_graphicType(graphicType),
30  m_graphicDataContainer(graphicDataContainer)
31 {
32  SLM_ASSERT("Only POINT and POLYLINE are supported by SCoord3D node for now.",
33  graphicType == "POINT" || graphicType == "POLYLINE");
34 
35  SLM_ASSERT("Graphic data doesn't match graphic type POINT.",
36  m_graphicType != "POINT" || m_graphicDataContainer.size() == 3);
37 
38  SLM_ASSERT("Graphic data doesn't match graphic type POLYLINE.",
39  m_graphicType != "POLYLINE" || m_graphicDataContainer.size() == 6);
40 
41 }
42 
43 //------------------------------------------------------------------------------
44 
46 {
47 }
48 
49 //------------------------------------------------------------------------------
50 
51 void DicomSRSCoord3DNode::write(::gdcm::DataSet& dataset) const
52 {
54 
55  // Referenced Frame of Reference UID - Type 1
56  ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x3006, 0x0024 >(m_frameOfReferenceUID, dataset);
57 
58  // Graphic Data - Type 1
59  ::fwGdcmIO::helper::DicomDataWriter::setTagValues< float, 0x0070, 0x0022 >(
60  &m_graphicDataContainer[0], static_cast<unsigned int>(m_graphicDataContainer.size()), dataset);
61 
62  // Graphic Type - Type 1
63  ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0070, 0x0023 >(m_graphicType, dataset);
64 }
65 
66 //------------------------------------------------------------------------------
67 
68 void DicomSRSCoord3DNode::print(std::ostream& os) const
69 {
71  os << "\\nFrame of Reference UID : [" << m_frameOfReferenceUID << "]";
72  os << "\\nGraphic Type : [" << m_graphicType << "]";
73 }
74 
75 //------------------------------------------------------------------------------
76 
77 } //namespace sr
78 } //namespace container
79 } //namespace fwGdcmIO
std::string m_frameOfReferenceUID
Referenced Frame of Reference UID.
GraphicDataContainerType m_graphicDataContainer
Graphic Data.
virtual FWGDCMIO_API void write(::gdcm::DataSet &dataset) const
Write the SR node in the dataset.
virtual FWGDCMIO_API ~DicomSRSCoord3DNode()
Destructor.
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...
virtual void print(std::ostream &os) const
Dump function.
virtual FWGDCMIO_API void write(::gdcm::DataSet &dataset) const
Write the SR node in the dataset.
Definition: DicomSRNode.cpp:44
#define SLM_ASSERT(message, cond)
work like &#39;assert&#39; from &#39;cassert&#39;, with in addition a message logged by spylog (with FATAL loglevel) ...
Definition: spyLog.hpp:308
virtual void print(std::ostream &os) const
Dump function.
FWGDCMIO_API DicomSRSCoord3DNode(const DicomCodedAttribute &codedAttribute, const std::string &relationship, const std::string &graphicType, const GraphicDataContainerType graphicDataContainer, const std::string &frameOfReferenceUID)
Constructor.