fw4spl
ioPacs/include/ioPacs/SSeriesPusher.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 "ioPacs/config.hpp"
10 
11 #include <fwCom/Slot.hpp>
12 
13 #include <fwMemory/BufferObject.hpp>
14 
15 #include <fwPacsIO/data/PacsConfiguration.hpp>
16 #include <fwPacsIO/SeriesEnquirer.hpp>
17 
18 #include <fwServices/IController.hpp>
19 
20 #include <fwThread/Worker.hpp>
21 
22 #include <vector>
23 
24 namespace fwMedData
25 {
26 class Series;
27 }
28 
29 namespace ioPacs
30 {
31 
52 class IOPACS_CLASS_API SSeriesPusher : public ::fwServices::IController
53 {
54 public:
55 
57 
58  typedef std::vector< CSPTR(::fwMedData::Series) > DicomSeriesContainerType;
59 
60  IOPACS_API static const ::fwCom::Slots::SlotKeyType s_DISPLAY_SLOT;
61  typedef ::fwCom::Slot<void (const std::string&, bool)> DisplayMessageSlotType;
62 
64  typedef ::fwCom::Signal< void ( std::string ) > StartedProgressSignalType;
66  typedef ::fwCom::Signal< void ( std::string, float, std::string ) > ProgressedSignalType;
68  typedef ::fwCom::Signal< void ( std::string ) > StoppedProgressSignalType;
69 
71  static const ::fwCom::Signals::SignalKeyType s_PROGRESSED_SIG;
72  static const ::fwCom::Signals::SignalKeyType s_STARTED_PROGRESS_SIG;
73  static const ::fwCom::Signals::SignalKeyType s_STOPPED_PROGRESS_SIG;
74 
78  IOPACS_API SSeriesPusher() noexcept;
79 
83  IOPACS_API virtual ~SSeriesPusher() noexcept;
84 
85 protected:
86 
88  IOPACS_API virtual void configuring() override;
89 
91  IOPACS_API virtual void starting() override;
92 
94  IOPACS_API virtual void stopping() override;
95 
97  IOPACS_API void updating() override;
98 
100  IOPACS_API void info(std::ostream& _sstream) override;
101 
102 protected:
103 
108  IOPACS_API bool checkSeriesOnPACS();
109 
111  IOPACS_API void pushSeries();
112 
118  IOPACS_API void displayMessage(const std::string& message, bool error) const;
119 
126  IOPACS_API void progressCallback(const std::string& seriesInstanceUID, unsigned int instanceNumber,
127  const std::string& filePath);
128 
130  DisplayMessageSlotType::sptr m_slotDisplayMessage;
131 
133  ::fwPacsIO::SeriesEnquirer::ProgressCallbackSlotType::sptr m_slotProgressCallback;
134 
136  ProgressedSignalType::sptr m_sigProgressed;
137 
139  StartedProgressSignalType::sptr m_sigStartedProgress;
140 
142  StoppedProgressSignalType::sptr m_sigStoppedProgress;
143 
145  std::string m_progressbarId;
146 
148  ::fwPacsIO::SeriesEnquirer::sptr m_seriesEnquirer;
149 
151  ::fwPacsIO::data::PacsConfiguration::csptr m_pacsConfiguration;
152 
154  ::fwThread::Worker::sptr m_pushSeriesWorker;
155 
157  bool m_isPushing;
158 
160  long unsigned int m_instanceCount;
161 
162 };
163 
164 } // namespace ioPacs
This service is used to push a DICOM series to a PACS.
ioPacs contains services use to deal with PACS using DCMTK library.
Namespace containing medical data.
fwPacsIO contains classes used to communicate with a PACS.
STL namespace.
::fwCom::Signal< void(std::string, float, std::string) > ProgressedSignalType
Signal to update the progress (bar id, percentage, message)
::fwCom::Signal< void(std::string) > StoppedProgressSignalType
Signal to stop the progress (bar id)
This interface defines control service API. Does nothing particularly, can be considered as a default...
Definition: IController.hpp:23
::fwCom::Signal< void(std::string) > StartedProgressSignalType
Signal to start the progress (bar id)
static const ::fwCom::Signals::SignalKeyType s_PROGRESSED_SIG
Key in m_signals map of signal m_sigProgressed.
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
This namespace fwThread provides few tools to execute asynchronous tasks on different threads...