fw4spl
SeriesEnquirer.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 "fwPacsIO/config.hpp"
10 
11 #include <fwCom/Slot.hpp>
12 #include <fwCom/Slots.hpp>
13 
14 #include <fwCore/BaseObject.hpp>
15 
16 #include <fwMemory/BufferObject.hpp>
17 
18 #include <boost/filesystem/path.hpp>
19 
20 #include <dcmtk/config/osconfig.h>
21 #include <dcmtk/dcmnet/scu.h>
22 
23 namespace fwPacsIO
24 {
25 
29 class FWPACSIO_CLASS_API SeriesEnquirer : public ::fwCore::BaseObject,
30  protected DcmSCU
31 {
32 
33 public:
35  (()), new SeriesEnquirer);
37 
38  FWPACSIO_API static const ::fwCom::Slots::SlotKeyType s_PROGRESS_CALLBACK_SLOT;
39  typedef ::fwCom::Slot<void (const std::string&, unsigned int, const std::string&)> ProgressCallbackSlotType;
40 
41  typedef std::vector< std::string > InstanceUIDContainer;
42 
43  typedef std::vector< ::boost::filesystem::path > InstancePathContainer;
44 
45  typedef std::vector< CSPTR(DcmDataset) > DatasetContainer;
46 
48  FWPACSIO_API SeriesEnquirer();
49 
51  FWPACSIO_API ~SeriesEnquirer();
52 
63  FWPACSIO_API void initialize(const std::string& applicationTitle,
64  const std::string& peerHostName, unsigned short peerPort,
65  const std::string& peerApplicationTitle,
66  const std::string& moveApplicationTitle = "",
67  ProgressCallbackSlotType::sptr progressCallback = ProgressCallbackSlotType::sptr());
68 
70  FWPACSIO_API bool connect();
71 
73  FWPACSIO_API void disconnect();
74 
76  FWPACSIO_API bool pingPacs();
77 
79  FWPACSIO_API bool isConnectedToPacs() const;
80 
86  FWPACSIO_API OFList< QRResponse* > findSeriesByPatientName(const std::string& name);
87 
94  FWPACSIO_API OFList< QRResponse* > findSeriesByDate(const std::string& fromDate, const std::string& toDate);
95 
101  FWPACSIO_API OFList< QRResponse* > findSeriesByUID(const std::string& uid);
102 
109  FWPACSIO_API std::string findSOPInstanceUID(const std::string& seriesInstanceUID, unsigned int instanceNumber);
110 
115  FWPACSIO_API void pullSeriesUsingMoveRetrieveMethod(InstanceUIDContainer instanceUIDContainer);
116 
121  FWPACSIO_API void pullSeriesUsingGetRetrieveMethod(InstanceUIDContainer instanceUIDContainer);
122 
128  FWPACSIO_API void pullInstanceUsingMoveRetrieveMethod(const std::string& seriesInstanceUID,
129  const std::string& sopInstanceUID);
130 
136  FWPACSIO_API void pullInstanceUsingGetRetrieveMethod(const std::string& seriesInstanceUID,
137  const std::string& sopInstanceUID);
138 
143  FWPACSIO_API void pushSeries(const InstancePathContainer& pathContainer);
144 
149  FWPACSIO_API void pushSeries(const DatasetContainer& datasetContainer);
150 
151 protected:
152 
158  FWPACSIO_API OFList< QRResponse* > sendFindRequest(DcmDataset dataset);
159 
165  FWPACSIO_API OFCondition sendMoveRequest(DcmDataset dataset);
166 
172  FWPACSIO_API OFCondition sendGetRequest(DcmDataset dataset);
173 
179  FWPACSIO_API OFCondition sendStoreRequest(const ::boost::filesystem::path& path);
180 
186  FWPACSIO_API OFCondition sendStoreRequest(const CSPTR(DcmDataset)& dataset);
187 
189  FWPACSIO_API virtual OFCondition handleMOVEResponse(
190  const T_ASC_PresentationContextID presID, RetrieveResponse* response, OFBool& waitForNextResponse) override;
191 
193  FWPACSIO_API virtual OFCondition handleSTORERequest (
194  const T_ASC_PresentationContextID presID, DcmDataset* incomingObject,
195  OFBool& continueCGETSession, Uint16& cStoreReturnStatus) override;
196 
201  FWPACSIO_API Uint8 findUncompressedPC(const OFString& sopClass);
202 
205 
207  ::boost::filesystem::path m_path;
208 
210  ProgressCallbackSlotType::sptr m_progressCallback;
211 
213  unsigned int m_instanceIndex;
214 };
215 
216 } // namespace fwPacsIO
#define CSPTR(_cls_)
Base class for all FW4SPL&#39;s classes.
Definition: BaseObject.hpp:22
ProgressCallbackSlotType::sptr m_progressCallback
Progress callback slot.
fwPacsIO contains classes used to communicate with a PACS.
Reads DICOM series from pacs.
::boost::filesystem::path m_path
Path where the files must be saved.
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate common construction methods for classes with one factory.
#define fwCoreAllowSharedFromThis()
Generate getSptr and getConstSptr methods.
std::string m_moveApplicationTitle
MOVE destination AE Title.
unsigned int m_instanceIndex
Dowloaded instance index.