fw4spl
reader/ie/InformationEntity.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 #include "fwGdcmIO/container/DicomInstance.hpp"
11 
12 #include <fwData/Object.hpp>
13 
14 #include <fwLog/Logger.hpp>
15 
16 #include <gdcmReader.h>
17 
18 #include <cstdint>
19 
20 namespace fwMedData
21 {
22 class DicomSeries;
23 }
24 
25 namespace fwGdcmIO
26 {
27 namespace reader
28 {
29 namespace ie
30 {
31 
35 template< class DATATYPE >
36 class FWGDCMIO_CLASS_API InformationEntity
37 {
38 
39 public:
40 
41  typedef std::function< void (std::uint64_t) > ProgressCallback;
42  typedef std::function< bool () > CancelRequestedCallback;
43 
54  FWGDCMIO_API InformationEntity(const CSPTR(::fwMedData::DicomSeries)& dicomSeries,
55  const SPTR(::gdcm::Reader)& reader,
56  const SPTR(::fwGdcmIO::container::DicomInstance)& instance,
57  const SPTR(DATATYPE)& object,
58  const ::fwLog::Logger::sptr& logger = nullptr,
59  const ProgressCallback progress = nullptr,
60  CancelRequestedCallback cancel = nullptr);
61 
63  FWGDCMIO_API virtual ~InformationEntity();
64 
65 protected:
66 
68  CSPTR(::fwMedData::DicomSeries) m_dicomSeries;
69 
71  SPTR(::gdcm::Reader) m_reader;
72 
74  SPTR(::fwGdcmIO::container::DicomInstance) m_instance;
75 
77  SPTR(DATATYPE) m_object;
78 
80  ::fwLog::Logger::sptr m_logger;
81 
83  ProgressCallback m_progressCallback;
84 
86  CancelRequestedCallback m_cancelRequestedCallback;
87 };
88 
89 //------------------------------------------------------------------------------
90 
91 template< class DATATYPE >
92 InformationEntity<DATATYPE>::InformationEntity(const CSPTR(::fwMedData::DicomSeries)& dicomSeries,
93  const SPTR(::gdcm::Reader)& reader,
94  const SPTR(::fwGdcmIO::container::DicomInstance)& instance,
95  const SPTR(DATATYPE)& object,
96  const ::fwLog::Logger::sptr& logger,
97  ProgressCallback progress,
98  CancelRequestedCallback cancel) :
99  m_dicomSeries(dicomSeries),
100  m_reader(reader),
101  m_instance(instance),
102  m_object(object),
103  m_logger(logger),
104  m_progressCallback(progress),
105  m_cancelRequestedCallback(cancel)
106 {
107  SLM_ASSERT("DicomSeries should not be null.", dicomSeries);
108  SLM_ASSERT("Reader should not be null.", reader);
109  SLM_ASSERT("Instance should not be null.", instance);
110  SLM_ASSERT("Object should not be null.", object);
111  SLM_ASSERT("Logger should not be null.", logger);
112 }
113 
114 //------------------------------------------------------------------------------
115 
116 template< class DATATYPE >
118 {
119 }
120 
121 } // namespace ie
122 } // namespace reader
123 } // namespace fwGdcmIO
#define SPTR(_cls_)
#define CSPTR(_cls_)
InformationEntity base class used to read modules.
Namespace containing medical data.
This class defines a DICOM SOP instance. It is useful during the whole writing process. This class allows to share data between module writers.
The namespace fwGdcmIO contains reader, writer and helper for dicom data.
fwLog contains classes used to manage logs.
Definition: Log.hpp:16
#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