fw4spl
DicomSRSCoordNode.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/DicomSRSCoordNode.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  GraphicDataContainerType graphicDataContainer) :
26  ::fwGdcmIO::container::sr::DicomSRNode(codedAttribute, "SCOORD", relationship),
27  m_graphicType(graphicType),
28  m_graphicDataContainer(graphicDataContainer)
29 {
30  SLM_ASSERT("Only POINT and POLYLINE are supported by SCoord node for now.",
31  graphicType == "POINT" || graphicType == "POLYLINE");
32 
33  SLM_ASSERT("Graphic data doesn't match graphic type POINT.",
34  m_graphicType != "POINT" || m_graphicDataContainer.size() == 2);
35 
36  SLM_ASSERT("Graphic data doesn't match graphic type POLYLINE.",
37  m_graphicType != "POLYLINE" || m_graphicDataContainer.size() == 4);
38 
39 }
40 
41 //------------------------------------------------------------------------------
42 
44 {
45 }
46 
47 //------------------------------------------------------------------------------
48 
49 void DicomSRSCoordNode::write(::gdcm::DataSet& dataset) const
50 {
52 
53  // Graphic Data - Type 1
54  ::fwGdcmIO::helper::DicomDataWriter::setTagValues< float, 0x0070, 0x0022 >(
55  &m_graphicDataContainer[0], m_graphicDataContainer.size(), dataset);
56 
57  // Graphic Type - Type 1
58  ::fwGdcmIO::helper::DicomDataWriter::setTagValue< 0x0070, 0x0023 >(m_graphicType, dataset);
59 }
60 
61 //------------------------------------------------------------------------------
62 
63 void DicomSRSCoordNode::print(std::ostream& os) const
64 {
66  os << "\\nGraphic Type : [" << m_graphicType << "]";
67 }
68 
69 //------------------------------------------------------------------------------
70 
71 } //namespace sr
72 } //namespace container
73 } //namespace fwGdcmIO
FWGDCMIO_API DicomSRSCoordNode(const DicomCodedAttribute &codedAttribute, const std::string &relationship, const std::string &graphicType, GraphicDataContainerType graphicDataContainer)
Constructor.
virtual FWGDCMIO_API void write(::gdcm::DataSet &dataset) const
Write the SR node in the dataset.
The namespace fwGdcmIO contains reader, writer and helper for dicom data.
This class defines a node in a SR document.
Definition: DicomSRNode.hpp:27
virtual FWGDCMIO_API ~DicomSRSCoordNode()
Destructor.
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
GraphicDataContainerType m_graphicDataContainer
Graphic Data.
virtual void print(std::ostream &os) const
Dump function.