0
|
1 /**
|
62
|
2 * Orthanc - A Lightweight, RESTful DICOM Store
|
0
|
3 * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
|
|
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.
|
|
10 *
|
|
11 * This program is distributed in the hope that it will be useful, but
|
|
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14 * General Public License for more details.
|
|
15 *
|
|
16 * You should have received a copy of the GNU General Public License
|
|
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
18 **/
|
|
19
|
|
20
|
|
21 #pragma once
|
|
22
|
|
23 #include "DicomFindAnswers.h"
|
|
24
|
|
25 #include <stdint.h>
|
|
26 #include <boost/shared_ptr.hpp>
|
|
27 #include <boost/noncopyable.hpp>
|
|
28
|
62
|
29 namespace Orthanc
|
0
|
30 {
|
|
31 class DicomUserConnection : public boost::noncopyable
|
|
32 {
|
|
33 private:
|
|
34 enum FindRootModel
|
|
35 {
|
|
36 FindRootModel_Patient,
|
|
37 FindRootModel_Study,
|
|
38 FindRootModel_Series,
|
|
39 FindRootModel_Instance
|
|
40 };
|
|
41
|
|
42 struct PImpl;
|
|
43 boost::shared_ptr<PImpl> pimpl_;
|
|
44
|
|
45 // Connection parameters
|
|
46 std::string localAet_;
|
|
47 std::string distantAet_;
|
|
48 std::string distantHost_;
|
|
49 uint16_t distantPort_;
|
|
50
|
|
51 void CheckIsOpen() const;
|
|
52
|
|
53 void SetupPresentationContexts();
|
|
54
|
|
55 void Find(DicomFindAnswers& result,
|
|
56 FindRootModel model,
|
|
57 const DicomMap& fields);
|
|
58
|
|
59 void Move(const std::string& targetAet,
|
|
60 const DicomMap& fields);
|
|
61
|
|
62 public:
|
|
63 DicomUserConnection();
|
|
64
|
|
65 ~DicomUserConnection();
|
|
66
|
|
67 void CopyParameters(const DicomUserConnection& other);
|
|
68
|
|
69 void SetLocalApplicationEntityTitle(const std::string& aet);
|
|
70
|
|
71 const std::string& GetLocalApplicationEntityTitle() const
|
|
72 {
|
|
73 return localAet_;
|
|
74 }
|
|
75
|
|
76 void SetDistantApplicationEntityTitle(const std::string& aet);
|
|
77
|
|
78 const std::string& GetDistantApplicationEntityTitle() const
|
|
79 {
|
|
80 return distantAet_;
|
|
81 }
|
|
82
|
|
83 void SetDistantHost(const std::string& host);
|
|
84
|
|
85 const std::string& GetDistantHost() const
|
|
86 {
|
|
87 return distantHost_;
|
|
88 }
|
|
89
|
|
90 void SetDistantPort(uint16_t port);
|
|
91
|
|
92 uint16_t GetDistantPort() const
|
|
93 {
|
|
94 return distantPort_;
|
|
95 }
|
|
96
|
|
97 void Open();
|
|
98
|
|
99 void Close();
|
|
100
|
|
101 bool IsOpen() const;
|
|
102
|
|
103 bool Echo();
|
|
104
|
|
105 void Store(const char* buffer, size_t size);
|
|
106
|
|
107 void Store(const std::string& buffer);
|
|
108
|
|
109 void StoreFile(const std::string& path);
|
|
110
|
|
111 void FindPatient(DicomFindAnswers& result,
|
|
112 const DicomMap& fields);
|
|
113
|
|
114 void FindStudy(DicomFindAnswers& result,
|
|
115 const DicomMap& fields);
|
|
116
|
|
117 void FindSeries(DicomFindAnswers& result,
|
|
118 const DicomMap& fields);
|
|
119
|
|
120 void FindInstance(DicomFindAnswers& result,
|
|
121 const DicomMap& fields);
|
|
122
|
|
123 void MoveSeries(const std::string& targetAet,
|
|
124 const DicomMap& findResult);
|
|
125
|
|
126 void MoveSeries(const std::string& targetAet,
|
|
127 const std::string& studyUid,
|
|
128 const std::string& seriesUid);
|
|
129
|
|
130 void MoveInstance(const std::string& targetAet,
|
|
131 const DicomMap& findResult);
|
|
132
|
|
133 void MoveInstance(const std::string& targetAet,
|
|
134 const std::string& studyUid,
|
|
135 const std::string& seriesUid,
|
|
136 const std::string& instanceUid);
|
|
137
|
|
138 static void SetConnectionTimeout(uint32_t seconds);
|
|
139 };
|
|
140 }
|