fw4spl
DicomSRNode.hpp
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 #ifndef __FWGDCMIO_CONTAINER_SR_DICOMSRNODE_HPP__
8 #define __FWGDCMIO_CONTAINER_SR_DICOMSRNODE_HPP__
9 
10 #include "fwGdcmIO/config.hpp"
11 #include "fwGdcmIO/container/DicomCodedAttribute.hpp"
12 
13 #include <fwCore/macros.hpp>
14 
15 #include <gdcmDataSet.h>
16 
17 namespace fwGdcmIO
18 {
19 namespace container
20 {
21 namespace sr
22 {
23 
27 class FWGDCMIO_CLASS_API DicomSRNode
28 {
29 public:
30 
31  typedef std::vector< SPTR(DicomSRNode) > SubNodeContainer;
32 
37  FWGDCMIO_API virtual void write(::gdcm::DataSet& dataset) const;
38 
43  FWGDCMIO_API void addSubNode(const SPTR(DicomSRNode)& node);
44 
46  FWGDCMIO_API friend std::ostream& operator<< (std::ostream& os, const DicomSRNode& node)
47  {
48  node.print(os);
49  return os;
50  }
51 
53  const SubNodeContainer& getSubNodeContainer() const
54  {
55  return m_subNodeContainer;
56  }
57 
59  void setSubNodeContainer(const SubNodeContainer& subNodeContainer)
60  {
61  m_subNodeContainer = subNodeContainer;
62  }
63 
66  {
67  return m_codedAttribute;
68  }
69 
71  void setCodedAttribute(const DicomCodedAttribute& codedAttribute)
72  {
73  m_codedAttribute = codedAttribute;
74  }
75 
77  const std::string& getType() const
78  {
79  return m_type;
80  }
81 
83  void setType(const std::string& type)
84  {
85  m_type = type;
86  }
87 
89  const std::string& getRelationship() const
90  {
91  return m_relationship;
92  }
93 
95  void setRelationship(const std::string& relationship)
96  {
97  m_relationship = relationship;
98  }
99 
100 protected:
101 
103  DicomSRNode(const DicomCodedAttribute& codedAttribute, const std::string& type,
104  const std::string& relationship = "");
105 
107  virtual ~DicomSRNode();
108 
110  virtual void print(std::ostream& os) const;
111 
117  ::gdcm::SmartPointer< ::gdcm::SequenceOfItems > createConceptNameCodeSequence(
118  const DicomCodedAttribute& codedAttribute) const;
119 
125  void writeContentSequence(::gdcm::DataSet& dataset) const;
126 
128  SubNodeContainer m_subNodeContainer;
129 
132 
134  std::string m_type;
135 
137  std::string m_relationship;
138 };
139 
140 } //namespace sr
141 } //namespace container
142 } //namespace fwGdcmIO
143 
144 #endif /* __FWGDCMIO_CONTAINER_SR_DICOMSRNODE_HPP__ */
#define SPTR(_cls_)
const std::string & getType() const
Get Type.
Definition: DicomSRNode.hpp:77
const SubNodeContainer & getSubNodeContainer() const
Get Sub node container.
Definition: DicomSRNode.hpp:53
const std::string & getRelationship() const
Get Relationship.
Definition: DicomSRNode.hpp:89
void setSubNodeContainer(const SubNodeContainer &subNodeContainer)
Set Sub node container.
Definition: DicomSRNode.hpp:59
This file defines fwCore base macros.
std::string m_relationship
Node relationship (0040, a010)
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.
void setType(const std::string &type)
Set Type.
Definition: DicomSRNode.hpp:83
SubNodeContainer m_subNodeContainer
SubNode container.
std::string m_type
Node type (0040, a040)
void setCodedAttribute(const DicomCodedAttribute &codedAttribute)
Set Coded attribute.
Definition: DicomSRNode.hpp:71
void setRelationship(const std::string &relationship)
Set Relationship.
Definition: DicomSRNode.hpp:95
DicomCodedAttribute m_codedAttribute
Coded entry of the node.
const DicomCodedAttribute & getCodedAttribute() const
Get Coded attribute.
Definition: DicomSRNode.hpp:65