Mercurial > hg > orthanc
comparison OrthancServer/DicomProtocol/DicomUserConnection.cpp @ 1997:f9f2aa1cc594
"MoveOriginatorID" can be specified for /modalities/.../store
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 25 May 2016 11:50:35 +0200 |
parents | cda5b0ab4ce5 |
children | 9b61701c35f2 |
comparison
equal
deleted
inserted
replaced
1996:66957f5c69ab | 1997:f9f2aa1cc594 |
---|---|
149 | 149 |
150 void CheckIsOpen() const; | 150 void CheckIsOpen() const; |
151 | 151 |
152 void Store(DcmInputStream& is, | 152 void Store(DcmInputStream& is, |
153 DicomUserConnection& connection, | 153 DicomUserConnection& connection, |
154 uint16_t moveMessageID); | 154 uint16_t moveOriginatorID); |
155 }; | 155 }; |
156 | 156 |
157 | 157 |
158 static void Check(const OFCondition& cond) | 158 static void Check(const OFCondition& cond) |
159 { | 159 { |
254 } | 254 } |
255 | 255 |
256 | 256 |
257 void DicomUserConnection::PImpl::Store(DcmInputStream& is, | 257 void DicomUserConnection::PImpl::Store(DcmInputStream& is, |
258 DicomUserConnection& connection, | 258 DicomUserConnection& connection, |
259 uint16_t moveMessageID) | 259 uint16_t moveOriginatorID) |
260 { | 260 { |
261 CheckIsOpen(); | 261 CheckIsOpen(); |
262 | 262 |
263 DcmFileFormat dcmff; | 263 DcmFileFormat dcmff; |
264 Check(dcmff.read(is, EXS_Unknown, EGL_noChange, DCM_MaxReadLength)); | 264 Check(dcmff.read(is, EXS_Unknown, EGL_noChange, DCM_MaxReadLength)); |
340 | 340 |
341 strncpy(request.MoveOriginatorApplicationEntityTitle, | 341 strncpy(request.MoveOriginatorApplicationEntityTitle, |
342 connection.GetLocalApplicationEntityTitle().c_str(), DIC_AE_LEN); | 342 connection.GetLocalApplicationEntityTitle().c_str(), DIC_AE_LEN); |
343 request.opts = O_STORE_MOVEORIGINATORAETITLE; | 343 request.opts = O_STORE_MOVEORIGINATORAETITLE; |
344 | 344 |
345 if (moveMessageID != 0) | 345 if (moveOriginatorID != 0) |
346 { | 346 { |
347 request.MoveOriginatorID = moveMessageID; // The type DIC_US is an alias for uint16_t | 347 request.MoveOriginatorID = moveOriginatorID; // The type DIC_US is an alias for uint16_t |
348 request.opts |= O_STORE_MOVEORIGINATORID; | 348 request.opts |= O_STORE_MOVEORIGINATORID; |
349 } | 349 } |
350 | 350 |
351 // Finally conduct transmission of data | 351 // Finally conduct transmission of data |
352 T_DIMSE_C_StoreRSP rsp; | 352 T_DIMSE_C_StoreRSP rsp; |
937 return pimpl_->IsOpen(); | 937 return pimpl_->IsOpen(); |
938 } | 938 } |
939 | 939 |
940 void DicomUserConnection::Store(const char* buffer, | 940 void DicomUserConnection::Store(const char* buffer, |
941 size_t size, | 941 size_t size, |
942 uint16_t moveMessageID) | 942 uint16_t moveOriginatorID) |
943 { | 943 { |
944 // Prepare an input stream for the memory buffer | 944 // Prepare an input stream for the memory buffer |
945 DcmInputBufferStream is; | 945 DcmInputBufferStream is; |
946 if (size > 0) | 946 if (size > 0) |
947 is.setBuffer(buffer, size); | 947 is.setBuffer(buffer, size); |
948 is.setEos(); | 948 is.setEos(); |
949 | 949 |
950 pimpl_->Store(is, *this, moveMessageID); | 950 pimpl_->Store(is, *this, moveOriginatorID); |
951 } | 951 } |
952 | 952 |
953 void DicomUserConnection::Store(const std::string& buffer, | 953 void DicomUserConnection::Store(const std::string& buffer, |
954 uint16_t moveMessageID) | 954 uint16_t moveOriginatorID) |
955 { | 955 { |
956 if (buffer.size() > 0) | 956 if (buffer.size() > 0) |
957 Store(reinterpret_cast<const char*>(&buffer[0]), buffer.size(), moveMessageID); | 957 Store(reinterpret_cast<const char*>(&buffer[0]), buffer.size(), moveOriginatorID); |
958 else | 958 else |
959 Store(NULL, 0, moveMessageID); | 959 Store(NULL, 0, moveOriginatorID); |
960 } | 960 } |
961 | 961 |
962 void DicomUserConnection::StoreFile(const std::string& path, | 962 void DicomUserConnection::StoreFile(const std::string& path, |
963 uint16_t moveMessageID) | 963 uint16_t moveOriginatorID) |
964 { | 964 { |
965 // Prepare an input stream for the file | 965 // Prepare an input stream for the file |
966 DcmInputFileStream is(path.c_str()); | 966 DcmInputFileStream is(path.c_str()); |
967 pimpl_->Store(is, *this, moveMessageID); | 967 pimpl_->Store(is, *this, moveOriginatorID); |
968 } | 968 } |
969 | 969 |
970 bool DicomUserConnection::Echo() | 970 bool DicomUserConnection::Echo() |
971 { | 971 { |
972 CheckIsOpen(); | 972 CheckIsOpen(); |