# HG changeset patch # User Sebastien Jodogne # Date 1417174762 -3600 # Node ID 703fcd797186e96f028d0b31fb145bf977138809 # Parent 4f1ac0f2c39c949f484d59502fdfb1ecac33f31d Support of Tudor DICOM in Query/Retrieve diff -r 4f1ac0f2c39c -r 703fcd797186 NEWS --- a/NEWS Thu Nov 27 19:57:49 2014 +0000 +++ b/NEWS Fri Nov 28 12:39:22 2014 +0100 @@ -2,6 +2,7 @@ =============================== * Instances without PatientID are now allowed +* Support of Tudor DICOM in Query/Retrieve Version 0.8.5 (2014/11/04) diff -r 4f1ac0f2c39c -r 703fcd797186 OrthancServer/OrthancMoveRequestHandler.cpp --- a/OrthancServer/OrthancMoveRequestHandler.cpp Thu Nov 27 19:57:49 2014 +0000 +++ b/OrthancServer/OrthancMoveRequestHandler.cpp Fri Nov 28 12:39:22 2014 +0100 @@ -102,8 +102,8 @@ bool OrthancMoveRequestHandler::LookupIdentifier(std::string& publicId, - DicomTag tag, - const DicomMap& input) + DicomTag tag, + const DicomMap& input) { if (!input.HasTag(tag)) { @@ -132,18 +132,42 @@ { LOG(WARNING) << "Move-SCU request received for AET \"" << aet << "\""; - /** * Retrieve the query level. **/ + ResourceType level; const DicomValue* levelTmp = input.TestAndGetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL); - if (levelTmp == NULL) + + if (levelTmp != NULL) + { + level = StringToResourceType(levelTmp->AsString().c_str()); + } + else { - throw OrthancException(ErrorCode_BadRequest); + // The query level is not present in the C-Move request, which + // does not follow the DICOM standard. This is for instance the + // behavior of Tudor DICOM. Try and automatically deduce the + // query level: Start from the instance level, going up to the + // patient level until a valid DICOM identifier is found. + + std::string publicId; + + if (LookupIdentifier(publicId, DICOM_TAG_SOP_INSTANCE_UID, input) || + LookupIdentifier(publicId, DICOM_TAG_SERIES_INSTANCE_UID, input) || + LookupIdentifier(publicId, DICOM_TAG_STUDY_INSTANCE_UID, input) || + LookupIdentifier(publicId, DICOM_TAG_PATIENT_ID, input)) + { + return new OrthancMoveRequestIterator(context_, aet, publicId); + } + else + { + // No identifier is present in the request. + throw OrthancException(ErrorCode_BadRequest); + } } - ResourceType level = StringToResourceType(levelTmp->AsString().c_str()); + /** * Lookup for the resource to be sent.