fw4spl
ioPacs/include/ioPacs/SSeriesPuller.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 <fwIO/IReader.hpp>
14 
15 #include <fwMedData/SeriesDB.hpp>
16 
17 #include <fwPacsIO/data/PacsConfiguration.hpp>
18 #include <fwPacsIO/SeriesEnquirer.hpp>
19 #include <fwPacsIO/SeriesRetriever.hpp>
20 
21 #include <fwServices/IController.hpp>
22 
23 #include <fwThread/Worker.hpp>
24 
25 #include <boost/filesystem/path.hpp>
26 
27 #include <vector>
28 
29 namespace fwMedData
30 {
31 class DicomSeries;
32 }
33 
34 namespace ioPacs
35 {
36 
65 class IOPACS_CLASS_API SSeriesPuller : public ::fwServices::IController
66 {
67 public:
68 
70 
71  typedef ::fwMedData::SeriesDB::ContainerType DicomSeriesContainerType;
72  typedef std::vector< std::string > InstanceUIDContainerType;
73  typedef std::map < std::string, unsigned int > InstanceCountMapType;
74  typedef std::map < std::string, WPTR(::fwMedData::DicomSeries) > DicomSeriesMapType;
75 
76  IOPACS_API static const ::fwCom::Slots::SlotKeyType s_READ_SLOT;
77  typedef ::fwCom::Slot<void (DicomSeriesContainerType)> ReadDicomSlotType;
78 
79  IOPACS_API static const ::fwCom::Slots::SlotKeyType s_DISPLAY_SLOT;
80  typedef ::fwCom::Slot<void (const std::string&)> DisplayMessageSlotType;
81 
83  typedef ::fwCom::Signal< void ( std::string ) > StartedProgressSignalType;
85  typedef ::fwCom::Signal< void ( std::string, float, std::string ) > ProgressedSignalType;
87  typedef ::fwCom::Signal< void ( std::string ) > StoppedProgressSignalType;
88 
90  static const ::fwCom::Signals::SignalKeyType s_PROGRESSED_SIG;
91  static const ::fwCom::Signals::SignalKeyType s_STARTED_PROGRESS_SIG;
92  static const ::fwCom::Signals::SignalKeyType s_STOPPED_PROGRESS_SIG;
93 
97  IOPACS_API SSeriesPuller() noexcept;
98 
102  IOPACS_API virtual ~SSeriesPuller() noexcept;
103 
104 protected:
105 
107  IOPACS_API virtual void configuring() override;
108 
110  IOPACS_API virtual void starting() override;
111 
113  IOPACS_API virtual void stopping() override;
114 
116  IOPACS_API void updating() override;
117 
119  IOPACS_API void info(std::ostream& _sstream ) override;
120 
121 protected:
122 
124  IOPACS_API void pullSeries();
125 
130  IOPACS_API void readLocalSeries(DicomSeriesContainerType selectedSeries);
131 
136  IOPACS_API void displayErrorMessage(const std::string& message) const;
137 
144  IOPACS_API void storeInstanceCallback(const std::string& seriesInstanceUID, unsigned int instanceNumber,
145  const std::string& filePath);
146 
148  ReadDicomSlotType::sptr m_slotReadLocalSeries;
149 
151  DisplayMessageSlotType::sptr m_slotDisplayMessage;
152 
154  ::fwPacsIO::SeriesRetriever::ProgressCallbackSlotType::sptr m_slotStoreInstanceCallbackUsingMoveRequests;
155 
157  ::fwPacsIO::SeriesEnquirer::ProgressCallbackSlotType::sptr m_slotStoreInstanceCallbackUsingGetRequests;
158 
160  ProgressedSignalType::sptr m_sigProgressed;
161 
163  StartedProgressSignalType::sptr m_sigStartedProgress;
164 
166  StoppedProgressSignalType::sptr m_sigStoppedProgress;
167 
169  ::fwPacsIO::SeriesEnquirer::sptr m_seriesEnquirer;
170 
172  ::fwPacsIO::data::PacsConfiguration::csptr m_pacsConfiguration;
173 
175  ::fwIO::IReader::sptr m_dicomReader;
176 
178  std::string m_dicomReaderSrvConfig;
179 
181  std::string m_dicomReaderType;
182 
184  ::fwMedData::SeriesDB::sptr m_tempSeriesDB;
185 
187  ::fwMedData::SeriesDB::sptr m_destinationSeriesDB;
188 
190  ::fwThread::Worker::sptr m_pullSeriesWorker;
191 
193  InstanceUIDContainerType m_localSeries;
194 
196  bool m_isPulling;
197 
199  std::string m_progressbarId;
200 
202  long unsigned int m_seriesCount;
203 
205  unsigned int m_seriesIndex;
206 
208  std::size_t m_instanceCount;
209 
211  DicomSeriesMapType m_pullingDicomSeriesMap;
212 };
213 
214 } // namespace ioPacs
This service is used to pull series from 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) > StartedProgressSignalType
Signal to start the progress (bar id)
This interface defines control service API. Does nothing particularly, can be considered as a default...
Definition: IController.hpp:23
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
static const ::fwCom::Signals::SignalKeyType s_PROGRESSED_SIG
Key in m_signals map of signal m_sigProgressed.
The namespace fwIO contains the base interface for reader and writer services.
Definition: ioTypes.hpp:16
::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 namespace fwThread provides few tools to execute asynchronous tasks on different threads...