fw4spl
DicomInstance.hpp
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 #pragma once
8 
9 #include "fwGdcmIO/config.hpp"
10 
11 #include <fwCore/macros.hpp>
12 
13 #include <fwLog/Logger.hpp>
14 
15 #include <gdcmMediaStorage.h>
16 
17 #include <memory>
18 
19 namespace fwMedData
20 {
21 class DicomSeries;
22 }
23 
24 namespace fwMedData
25 {
26 class Series;
27 }
28 
29 namespace fwGdcmIO
30 {
31 namespace container
32 {
33 
38 class FWGDCMIO_CLASS_API DicomInstance
39 {
40 public:
41 
42  typedef std::shared_ptr<DicomInstance> sptr;
43 
45  typedef std::vector< std::string > SOPInstanceUIDContainerType;
46 
48  FWGDCMIO_API DicomInstance();
49 
56  FWGDCMIO_API DicomInstance(const CSPTR(::fwMedData::Series)& series,
57  const SPTR(::fwLog::Logger)& logger = nullptr,
58  bool isMultiFiles = true);
59 
65  FWGDCMIO_API DicomInstance(const CSPTR(::fwMedData::DicomSeries)& dicomSeries,
66  const SPTR(::fwLog::Logger)& logger = nullptr);
67 
69  FWGDCMIO_API DicomInstance(const DicomInstance& dicomInstance);
70 
72  FWGDCMIO_API virtual ~DicomInstance();
73 
75  bool getIsMultiFiles() const
76  {
77  return m_isMultiFiles;
78  }
79 
81  void setIsMultiFiles(bool isMultiFiles)
82  {
83  m_isMultiFiles = isMultiFiles;
84  }
85 
87  const std::string& getSOPClassUID() const
88  {
89  return m_SOPClassUID;
90  }
91 
93  void setSOPClassUID(const std::string& SOPClassUID)
94  {
95  m_SOPClassUID = SOPClassUID;
96  }
97 
99  const std::string& getSeriesInstanceUID() const
100  {
101  return m_seriesInstanceUID;
102  }
103 
105  void setSeriesInstanceUID(const std::string& seriesInstanceUID)
106  {
107  m_seriesInstanceUID = seriesInstanceUID;
108  }
109 
111  const std::string& getStudyInstanceUID() const
112  {
113  return m_studyInstanceUID;
114  }
115 
117  void setStudyInstanceUID(const std::string& studyInstanceUID)
118  {
119  m_studyInstanceUID = studyInstanceUID;
120  }
121 
123  const std::string& getFrameOfReferenceUID() const
124  {
125  return m_frameOfReferenceUID;
126  }
127 
129  void setFrameOfReferenceUID(const std::string& frameOfReferenceUID)
130  {
131  m_frameOfReferenceUID = frameOfReferenceUID;
132  }
133 
135  const SOPInstanceUIDContainerType& getSOPInstanceUIDContainer() const
136  {
137  return m_SOPInstanceUIDContainer;
138  }
139 
141  SOPInstanceUIDContainerType& getSOPInstanceUIDContainer()
142  {
143  return m_SOPInstanceUIDContainer;
144  }
145 
147  void setSOPInstanceUIDContainer(const SOPInstanceUIDContainerType& SOPInstanceUIDContainer)
148  {
149  m_SOPInstanceUIDContainer = SOPInstanceUIDContainer;
150  }
151 
152 protected:
157  void computeSOPClassUID(const CSPTR(::fwMedData::Series)& series);
158 
163  void generateSOPInstanceUIDs(const CSPTR(::fwMedData::Series)& series);
164 
169  void readUIDFromDicomSeries(const CSPTR(::fwMedData::DicomSeries)& dicomSeries);
170 
171 private:
172 
174  bool m_isMultiFiles;
175 
177  std::string m_SOPClassUID;
178 
180  std::string m_studyInstanceUID;
181 
183  std::string m_seriesInstanceUID;
184 
186  std::string m_frameOfReferenceUID;
187 
189  SOPInstanceUIDContainerType m_SOPInstanceUIDContainer;
190 
192  SPTR(::fwLog::Logger) m_logger;
193 };
194 
195 } //namespace container
196 } //namespace fwGdcmIO
void setSOPClassUID(const std::string &SOPClassUID)
Set SOP Class UID.
#define SPTR(_cls_)
#define CSPTR(_cls_)
Namespace containing medical data.
const SOPInstanceUIDContainerType & getSOPInstanceUIDContainer() const
Get SOP Instance UID container.
void setSOPInstanceUIDContainer(const SOPInstanceUIDContainerType &SOPInstanceUIDContainer)
Set SOP Instance UID Container.
const std::string & getSeriesInstanceUID() const
Get Series Instance UID.
This class defines a DICOM SOP instance. It is useful during the whole writing process. This class allows to share data between module writers.
This file defines fwCore base macros.
void setFrameOfReferenceUID(const std::string &frameOfReferenceUID)
Set Study Instance UID.
void setStudyInstanceUID(const std::string &studyInstanceUID)
Set Study Instance UID.
The namespace fwGdcmIO contains reader, writer and helper for dicom data.
const std::string & getFrameOfReferenceUID() const
Get Study Instance UID.
const std::string & getStudyInstanceUID() const
Get Study Instance UID.
bool getIsMultiFiles() const
Get the flag on multi-files state of an image series.
void setSeriesInstanceUID(const std::string &seriesInstanceUID)
Set Series Instance UID.
Logger class used to store logs.
std::vector< std::string > SOPInstanceUIDContainerType
SOP Instance Container Type.
const std::string & getSOPClassUID() const
Get SOP Class UID.
SOPInstanceUIDContainerType & getSOPInstanceUIDContainer()
Get SOP Instance UID container.
void setIsMultiFiles(bool isMultiFiles)
Set the flag on multi-files state of an image series.