Mercurial > hg > orthanc
comparison OrthancServer/OrthancMoveRequestHandler.cpp @ 1231:703fcd797186
Support of Tudor DICOM in Query/Retrieve
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 28 Nov 2014 12:39:22 +0100 |
parents | 1ea4094d077c |
children | 6e7e5ed91c2d |
comparison
equal
deleted
inserted
replaced
1230:4f1ac0f2c39c | 1231:703fcd797186 |
---|---|
100 }; | 100 }; |
101 } | 101 } |
102 | 102 |
103 | 103 |
104 bool OrthancMoveRequestHandler::LookupIdentifier(std::string& publicId, | 104 bool OrthancMoveRequestHandler::LookupIdentifier(std::string& publicId, |
105 DicomTag tag, | 105 DicomTag tag, |
106 const DicomMap& input) | 106 const DicomMap& input) |
107 { | 107 { |
108 if (!input.HasTag(tag)) | 108 if (!input.HasTag(tag)) |
109 { | 109 { |
110 return false; | 110 return false; |
111 } | 111 } |
130 IMoveRequestIterator* OrthancMoveRequestHandler::Handle(const std::string& aet, | 130 IMoveRequestIterator* OrthancMoveRequestHandler::Handle(const std::string& aet, |
131 const DicomMap& input) | 131 const DicomMap& input) |
132 { | 132 { |
133 LOG(WARNING) << "Move-SCU request received for AET \"" << aet << "\""; | 133 LOG(WARNING) << "Move-SCU request received for AET \"" << aet << "\""; |
134 | 134 |
135 | |
136 /** | 135 /** |
137 * Retrieve the query level. | 136 * Retrieve the query level. |
138 **/ | 137 **/ |
139 | 138 |
139 ResourceType level; | |
140 const DicomValue* levelTmp = input.TestAndGetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL); | 140 const DicomValue* levelTmp = input.TestAndGetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL); |
141 if (levelTmp == NULL) | 141 |
142 { | 142 if (levelTmp != NULL) |
143 throw OrthancException(ErrorCode_BadRequest); | 143 { |
144 } | 144 level = StringToResourceType(levelTmp->AsString().c_str()); |
145 | 145 } |
146 ResourceType level = StringToResourceType(levelTmp->AsString().c_str()); | 146 else |
147 { | |
148 // The query level is not present in the C-Move request, which | |
149 // does not follow the DICOM standard. This is for instance the | |
150 // behavior of Tudor DICOM. Try and automatically deduce the | |
151 // query level: Start from the instance level, going up to the | |
152 // patient level until a valid DICOM identifier is found. | |
153 | |
154 std::string publicId; | |
155 | |
156 if (LookupIdentifier(publicId, DICOM_TAG_SOP_INSTANCE_UID, input) || | |
157 LookupIdentifier(publicId, DICOM_TAG_SERIES_INSTANCE_UID, input) || | |
158 LookupIdentifier(publicId, DICOM_TAG_STUDY_INSTANCE_UID, input) || | |
159 LookupIdentifier(publicId, DICOM_TAG_PATIENT_ID, input)) | |
160 { | |
161 return new OrthancMoveRequestIterator(context_, aet, publicId); | |
162 } | |
163 else | |
164 { | |
165 // No identifier is present in the request. | |
166 throw OrthancException(ErrorCode_BadRequest); | |
167 } | |
168 } | |
169 | |
170 | |
147 | 171 |
148 /** | 172 /** |
149 * Lookup for the resource to be sent. | 173 * Lookup for the resource to be sent. |
150 **/ | 174 **/ |
151 | 175 |