0
|
1 /**
|
62
|
2 * Orthanc - A Lightweight, RESTful DICOM Store
|
399
|
3 * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
|
0
|
4 * Belgium
|
|
5 *
|
|
6 * This program is free software: you can redistribute it and/or
|
|
7 * modify it under the terms of the GNU General Public License as
|
|
8 * published by the Free Software Foundation, either version 3 of the
|
|
9 * License, or (at your option) any later version.
|
136
|
10 *
|
|
11 * In addition, as a special exception, the copyright holders of this
|
|
12 * program give permission to link the code of its release with the
|
|
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
|
|
14 * that use the same license as the "OpenSSL" library), and distribute
|
|
15 * the linked executables. You must obey the GNU General Public License
|
|
16 * in all respects for all of the code used other than "OpenSSL". If you
|
|
17 * modify file(s) with this exception, you may extend this exception to
|
|
18 * your version of the file(s), but you are not obligated to do so. If
|
|
19 * you do not wish to do so, delete this exception statement from your
|
|
20 * version. If you delete this exception statement from all source files
|
|
21 * in the program, then also delete it here.
|
0
|
22 *
|
|
23 * This program is distributed in the hope that it will be useful, but
|
|
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
26 * General Public License for more details.
|
|
27 *
|
|
28 * You should have received a copy of the GNU General Public License
|
|
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
30 **/
|
|
31
|
|
32
|
|
33 #pragma once
|
|
34
|
|
35 #include "DicomFindAnswers.h"
|
|
36
|
|
37 #include <stdint.h>
|
|
38 #include <boost/shared_ptr.hpp>
|
|
39 #include <boost/noncopyable.hpp>
|
|
40
|
62
|
41 namespace Orthanc
|
0
|
42 {
|
|
43 class DicomUserConnection : public boost::noncopyable
|
|
44 {
|
|
45 private:
|
|
46 enum FindRootModel
|
|
47 {
|
|
48 FindRootModel_Patient,
|
|
49 FindRootModel_Study,
|
|
50 FindRootModel_Series,
|
|
51 FindRootModel_Instance
|
|
52 };
|
|
53
|
|
54 struct PImpl;
|
|
55 boost::shared_ptr<PImpl> pimpl_;
|
|
56
|
|
57 // Connection parameters
|
|
58 std::string localAet_;
|
|
59 std::string distantAet_;
|
|
60 std::string distantHost_;
|
|
61 uint16_t distantPort_;
|
|
62
|
|
63 void CheckIsOpen() const;
|
|
64
|
|
65 void SetupPresentationContexts();
|
|
66
|
|
67 void Find(DicomFindAnswers& result,
|
|
68 FindRootModel model,
|
|
69 const DicomMap& fields);
|
|
70
|
|
71 void Move(const std::string& targetAet,
|
|
72 const DicomMap& fields);
|
|
73
|
|
74 public:
|
|
75 DicomUserConnection();
|
|
76
|
|
77 ~DicomUserConnection();
|
|
78
|
|
79 void CopyParameters(const DicomUserConnection& other);
|
|
80
|
|
81 void SetLocalApplicationEntityTitle(const std::string& aet);
|
|
82
|
|
83 const std::string& GetLocalApplicationEntityTitle() const
|
|
84 {
|
|
85 return localAet_;
|
|
86 }
|
|
87
|
|
88 void SetDistantApplicationEntityTitle(const std::string& aet);
|
|
89
|
|
90 const std::string& GetDistantApplicationEntityTitle() const
|
|
91 {
|
|
92 return distantAet_;
|
|
93 }
|
|
94
|
|
95 void SetDistantHost(const std::string& host);
|
|
96
|
|
97 const std::string& GetDistantHost() const
|
|
98 {
|
|
99 return distantHost_;
|
|
100 }
|
|
101
|
|
102 void SetDistantPort(uint16_t port);
|
|
103
|
|
104 uint16_t GetDistantPort() const
|
|
105 {
|
|
106 return distantPort_;
|
|
107 }
|
|
108
|
|
109 void Open();
|
|
110
|
|
111 void Close();
|
|
112
|
|
113 bool IsOpen() const;
|
|
114
|
|
115 bool Echo();
|
|
116
|
|
117 void Store(const char* buffer, size_t size);
|
|
118
|
|
119 void Store(const std::string& buffer);
|
|
120
|
|
121 void StoreFile(const std::string& path);
|
|
122
|
|
123 void FindPatient(DicomFindAnswers& result,
|
|
124 const DicomMap& fields);
|
|
125
|
|
126 void FindStudy(DicomFindAnswers& result,
|
|
127 const DicomMap& fields);
|
|
128
|
|
129 void FindSeries(DicomFindAnswers& result,
|
|
130 const DicomMap& fields);
|
|
131
|
|
132 void FindInstance(DicomFindAnswers& result,
|
|
133 const DicomMap& fields);
|
|
134
|
|
135 void MoveSeries(const std::string& targetAet,
|
|
136 const DicomMap& findResult);
|
|
137
|
|
138 void MoveSeries(const std::string& targetAet,
|
|
139 const std::string& studyUid,
|
|
140 const std::string& seriesUid);
|
|
141
|
|
142 void MoveInstance(const std::string& targetAet,
|
|
143 const DicomMap& findResult);
|
|
144
|
|
145 void MoveInstance(const std::string& targetAet,
|
|
146 const std::string& studyUid,
|
|
147 const std::string& seriesUid,
|
|
148 const std::string& instanceUid);
|
|
149
|
|
150 static void SetConnectionTimeout(uint32_t seconds);
|
|
151 };
|
|
152 }
|