Mercurial > hg > orthanc
comparison Core/DicomNetworking/DicomUserConnection.cpp @ 3734:4fc24b69446a storage-commitment
triggering storage commitment scu from REST API
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 10 Mar 2020 13:22:02 +0100 |
parents | 56f2397f027a |
children | 21efa32c8a10 |
comparison
equal
deleted
inserted
replaced
3731:e7ff4f9b34bd | 3734:4fc24b69446a |
---|---|
156 return assoc_ != NULL; | 156 return assoc_ != NULL; |
157 } | 157 } |
158 | 158 |
159 void CheckIsOpen() const; | 159 void CheckIsOpen() const; |
160 | 160 |
161 void Store(DcmInputStream& is, | 161 void Store(std::string& sopClassUidOut /* out */, |
162 std::string& sopInstanceUidOut /* out */, | |
163 DcmInputStream& is, | |
162 DicomUserConnection& connection, | 164 DicomUserConnection& connection, |
163 const std::string& moveOriginatorAET, | 165 const std::string& moveOriginatorAET, |
164 uint16_t moveOriginatorID); | 166 uint16_t moveOriginatorID); |
165 }; | 167 }; |
166 | 168 |
349 syntax == UID_BigEndianExplicitTransferSyntax || | 351 syntax == UID_BigEndianExplicitTransferSyntax || |
350 syntax == UID_LittleEndianImplicitTransferSyntax); | 352 syntax == UID_LittleEndianImplicitTransferSyntax); |
351 } | 353 } |
352 | 354 |
353 | 355 |
354 void DicomUserConnection::PImpl::Store(DcmInputStream& is, | 356 void DicomUserConnection::PImpl::Store(std::string& sopClassUidOut, |
357 std::string& sopInstanceUidOut, | |
358 DcmInputStream& is, | |
355 DicomUserConnection& connection, | 359 DicomUserConnection& connection, |
356 const std::string& moveOriginatorAET, | 360 const std::string& moveOriginatorAET, |
357 uint16_t moveOriginatorID) | 361 uint16_t moveOriginatorID) |
358 { | 362 { |
359 DcmFileFormat dcmff; | 363 DcmFileFormat dcmff; |
431 { | 435 { |
432 throw OrthancException(ErrorCode_NoSopClassOrInstance, | 436 throw OrthancException(ErrorCode_NoSopClassOrInstance, |
433 "Unable to determine the SOP class/instance for C-STORE with AET " + | 437 "Unable to determine the SOP class/instance for C-STORE with AET " + |
434 connection.remoteAet_); | 438 connection.remoteAet_); |
435 } | 439 } |
440 | |
441 sopClassUidOut.assign(sopClass); | |
442 sopInstanceUidOut.assign(sopInstance); | |
436 | 443 |
437 // Figure out which of the accepted presentation contexts should be used | 444 // Figure out which of the accepted presentation contexts should be used |
438 int presID = ASC_findAcceptedPresentationContextID(assoc_, sopClass); | 445 int presID = ASC_findAcceptedPresentationContextID(assoc_, sopClass); |
439 if (presID == 0) | 446 if (presID == 0) |
440 { | 447 { |
1173 bool DicomUserConnection::IsOpen() const | 1180 bool DicomUserConnection::IsOpen() const |
1174 { | 1181 { |
1175 return pimpl_->IsOpen(); | 1182 return pimpl_->IsOpen(); |
1176 } | 1183 } |
1177 | 1184 |
1178 void DicomUserConnection::Store(const char* buffer, | 1185 void DicomUserConnection::Store(std::string& sopClassUid /* out */, |
1186 std::string& sopInstanceUid /* out */, | |
1187 const char* buffer, | |
1179 size_t size, | 1188 size_t size, |
1180 const std::string& moveOriginatorAET, | 1189 const std::string& moveOriginatorAET, |
1181 uint16_t moveOriginatorID) | 1190 uint16_t moveOriginatorID) |
1182 { | 1191 { |
1183 // Prepare an input stream for the memory buffer | 1192 // Prepare an input stream for the memory buffer |
1184 DcmInputBufferStream is; | 1193 DcmInputBufferStream is; |
1185 if (size > 0) | 1194 if (size > 0) |
1186 is.setBuffer(buffer, size); | 1195 is.setBuffer(buffer, size); |
1187 is.setEos(); | 1196 is.setEos(); |
1188 | 1197 |
1189 pimpl_->Store(is, *this, moveOriginatorAET, moveOriginatorID); | 1198 pimpl_->Store(sopClassUid, sopInstanceUid, is, *this, moveOriginatorAET, moveOriginatorID); |
1190 } | 1199 } |
1191 | 1200 |
1192 void DicomUserConnection::Store(const std::string& buffer, | 1201 void DicomUserConnection::Store(std::string& sopClassUid /* out */, |
1202 std::string& sopInstanceUid /* out */, | |
1203 const std::string& buffer, | |
1193 const std::string& moveOriginatorAET, | 1204 const std::string& moveOriginatorAET, |
1194 uint16_t moveOriginatorID) | 1205 uint16_t moveOriginatorID) |
1195 { | 1206 { |
1196 if (buffer.size() > 0) | 1207 if (buffer.size() > 0) |
1197 Store(&buffer[0], buffer.size(), moveOriginatorAET, moveOriginatorID); | 1208 Store(sopClassUid, sopInstanceUid, &buffer[0], buffer.size(), |
1209 moveOriginatorAET, moveOriginatorID); | |
1198 else | 1210 else |
1199 Store(NULL, 0, moveOriginatorAET, moveOriginatorID); | 1211 Store(sopClassUid, sopInstanceUid, NULL, 0, moveOriginatorAET, moveOriginatorID); |
1200 } | 1212 } |
1201 | 1213 |
1202 void DicomUserConnection::StoreFile(const std::string& path, | 1214 void DicomUserConnection::StoreFile(std::string& sopClassUid /* out */, |
1215 std::string& sopInstanceUid /* out */, | |
1216 const std::string& path, | |
1203 const std::string& moveOriginatorAET, | 1217 const std::string& moveOriginatorAET, |
1204 uint16_t moveOriginatorID) | 1218 uint16_t moveOriginatorID) |
1205 { | 1219 { |
1206 // Prepare an input stream for the file | 1220 // Prepare an input stream for the file |
1207 DcmInputFileStream is(path.c_str()); | 1221 DcmInputFileStream is(path.c_str()); |
1208 pimpl_->Store(is, *this, moveOriginatorAET, moveOriginatorID); | 1222 pimpl_->Store(sopClassUid, sopInstanceUid, is, *this, moveOriginatorAET, moveOriginatorID); |
1209 } | 1223 } |
1210 | 1224 |
1211 bool DicomUserConnection::Echo() | 1225 bool DicomUserConnection::Echo() |
1212 { | 1226 { |
1213 CheckIsOpen(); | 1227 CheckIsOpen(); |