comparison Core/DicomNetworking/DicomUserConnection.h @ 3786:3801435e34a1 SylvainRouquette/fix-issue169-95b752c

integration Orthanc-1.6.0->SylvainRouquette
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 19 Mar 2020 11:48:30 +0100
parents 763533d6dd67 4fc24b69446a
children
comparison
equal deleted inserted replaced
3785:763533d6dd67 3786:3801435e34a1
1 /** 1 /**
2 * Orthanc - A Lightweight, RESTful DICOM Store 2 * Orthanc - A Lightweight, RESTful DICOM Store
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium 4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium 5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
6 * 6 *
7 * This program is free software: you can redistribute it and/or 7 * This program is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as 8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation, either version 3 of the 9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version. 10 * License, or (at your option) any later version.
52 { 52 {
53 private: 53 private:
54 struct PImpl; 54 struct PImpl;
55 boost::shared_ptr<PImpl> pimpl_; 55 boost::shared_ptr<PImpl> pimpl_;
56 56
57 enum Mode
58 {
59 Mode_Generic,
60 Mode_ReportStorageCommitment,
61 Mode_RequestStorageCommitment
62 };
63
57 // Connection parameters 64 // Connection parameters
58 std::string preferredTransferSyntax_; 65 std::string preferredTransferSyntax_;
59 std::string modalityPreferredTransferSyntax_; 66 std::string modalityPreferredTransferSyntax_;
60 std::string localAet_; 67 std::string localAet_;
61 std::string remoteAet_; 68 std::string remoteAet_;
66 std::list<std::string> reservedStorageSOPClasses_; 73 std::list<std::string> reservedStorageSOPClasses_;
67 std::set<std::string> defaultStorageSOPClasses_; 74 std::set<std::string> defaultStorageSOPClasses_;
68 75
69 void CheckIsOpen() const; 76 void CheckIsOpen() const;
70 77
71 void SetupPresentationContexts(const std::string& preferredTransferSyntax); 78 void SetupPresentationContexts(Mode mode,
79 const std::string& preferredTransferSyntax);
72 80
73 void MoveInternal(const std::string& targetAet, 81 void MoveInternal(const std::string& targetAet,
74 ResourceType level, 82 ResourceType level,
75 const DicomMap& fields); 83 const DicomMap& fields);
76 84
77 void ResetStorageSOPClasses(); 85 void ResetStorageSOPClasses();
78 86
79 void CheckStorageSOPClassesInvariant() const; 87 void CheckStorageSOPClassesInvariant() const;
80 88
81 void DefaultSetup(); 89 void DefaultSetup();
90
91 void OpenInternal(Mode mode);
82 92
83 public: 93 public:
84 DicomUserConnection(); 94 DicomUserConnection();
85 95
86 ~DicomUserConnection(); 96 ~DicomUserConnection();
136 return preferredTransferSyntax_; 146 return preferredTransferSyntax_;
137 } 147 }
138 148
139 void AddStorageSOPClass(const char* sop); 149 void AddStorageSOPClass(const char* sop);
140 150
141 void Open(); 151 void Open()
152 {
153 OpenInternal(Mode_Generic);
154 }
142 155
143 void Close(); 156 void Close();
144 157
145 bool IsOpen() const; 158 bool IsOpen() const;
146 159
147 bool Echo(); 160 bool Echo();
148 161
149 void Store(const char* buffer, 162 void Store(std::string& sopClassUid /* out */,
163 std::string& sopInstanceUid /* out */,
164 const char* buffer,
150 size_t size, 165 size_t size,
151 const std::string& moveOriginatorAET, 166 const std::string& moveOriginatorAET,
152 uint16_t moveOriginatorID); 167 uint16_t moveOriginatorID);
153 168
154 void Store(const char* buffer, 169 void Store(std::string& sopClassUid /* out */,
170 std::string& sopInstanceUid /* out */,
171 const char* buffer,
155 size_t size) 172 size_t size)
156 { 173 {
157 Store(buffer, size, "", 0); // Not a C-Move 174 Store(sopClassUid, sopInstanceUid, buffer, size, "", 0); // Not a C-Move
158 } 175 }
159 176
160 void Store(const std::string& buffer, 177 void Store(std::string& sopClassUid /* out */,
178 std::string& sopInstanceUid /* out */,
179 const std::string& buffer,
161 const std::string& moveOriginatorAET, 180 const std::string& moveOriginatorAET,
162 uint16_t moveOriginatorID); 181 uint16_t moveOriginatorID);
163 182
164 void Store(const std::string& buffer) 183 void Store(std::string& sopClassUid /* out */,
165 { 184 std::string& sopInstanceUid /* out */,
166 Store(buffer, "", 0); // Not a C-Move 185 const std::string& buffer)
167 } 186 {
168 187 Store(sopClassUid, sopInstanceUid, buffer, "", 0); // Not a C-Move
169 void StoreFile(const std::string& path, 188 }
189
190 void StoreFile(std::string& sopClassUid /* out */,
191 std::string& sopInstanceUid /* out */,
192 const std::string& path,
170 const std::string& moveOriginatorAET, 193 const std::string& moveOriginatorAET,
171 uint16_t moveOriginatorID); 194 uint16_t moveOriginatorID);
172 195
173 void StoreFile(const std::string& path) 196 void StoreFile(std::string& sopClassUid /* out */,
174 { 197 std::string& sopInstanceUid /* out */,
175 StoreFile(path, "", 0); // Not a C-Move 198 const std::string& path)
199 {
200 StoreFile(sopClassUid, sopInstanceUid, path, "", 0); // Not a C-Move
176 } 201 }
177 202
178 void Find(DicomFindAnswers& result, 203 void Find(DicomFindAnswers& result,
179 ResourceType level, 204 ResourceType level,
180 const DicomMap& fields, 205 const DicomMap& fields,
211 236
212 static void SetDefaultTimeout(uint32_t seconds); 237 static void SetDefaultTimeout(uint32_t seconds);
213 238
214 bool IsSameAssociation(const std::string& localAet, 239 bool IsSameAssociation(const std::string& localAet,
215 const RemoteModalityParameters& remote) const; 240 const RemoteModalityParameters& remote) const;
241
242 void ReportStorageCommitment(
243 const std::string& transactionUid,
244 const std::vector<std::string>& sopClassUids,
245 const std::vector<std::string>& sopInstanceUids,
246 const std::vector<StorageCommitmentFailureReason>& failureReasons);
247
248 // transactionUid: To be generated by Toolbox::GenerateDicomPrivateUniqueIdentifier()
249 void RequestStorageCommitment(
250 const std::string& transactionUid,
251 const std::vector<std::string>& sopClassUids,
252 const std::vector<std::string>& sopInstanceUids);
216 }; 253 };
217 } 254 }