Mercurial > hg > orthanc
comparison OrthancServer/DicomModification.cpp @ 1160:80671157d051
generalization of create-dicom
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 17 Sep 2014 11:57:28 +0200 |
parents | 2f76b92addd4 |
children | 7f3a65e84d4b |
comparison
equal
deleted
inserted
replaced
1156:8c9574576f42 | 1160:80671157d051 |
---|---|
242 IsRemoved(DICOM_TAG_SERIES_INSTANCE_UID) || | 242 IsRemoved(DICOM_TAG_SERIES_INSTANCE_UID) || |
243 IsRemoved(DICOM_TAG_SOP_INSTANCE_UID)) | 243 IsRemoved(DICOM_TAG_SOP_INSTANCE_UID)) |
244 { | 244 { |
245 throw OrthancException(ErrorCode_BadRequest); | 245 throw OrthancException(ErrorCode_BadRequest); |
246 } | 246 } |
247 | 247 |
248 | |
249 // Sanity checks | |
248 if (level_ == ResourceType_Patient && !IsReplaced(DICOM_TAG_PATIENT_ID)) | 250 if (level_ == ResourceType_Patient && !IsReplaced(DICOM_TAG_PATIENT_ID)) |
249 { | 251 { |
250 LOG(ERROR) << "When modifying a patient, her PatientID is required to be modified"; | 252 LOG(ERROR) << "When modifying a patient, her PatientID is required to be modified"; |
251 throw OrthancException(ErrorCode_BadRequest); | 253 throw OrthancException(ErrorCode_BadRequest); |
252 } | 254 } |
253 | 255 |
254 if (level_ > ResourceType_Patient && IsReplaced(DICOM_TAG_PATIENT_ID)) | 256 if (level_ == ResourceType_Patient && IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID)) |
255 { | 257 { |
256 throw OrthancException(ErrorCode_BadRequest); | 258 LOG(ERROR) << "When modifying a patient, the StudyInstanceUID cannot be manually modified"; |
257 } | 259 throw OrthancException(ErrorCode_BadRequest); |
258 | 260 } |
259 if (level_ > ResourceType_Study && IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID)) | 261 |
260 { | 262 if (level_ == ResourceType_Patient && IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID)) |
261 throw OrthancException(ErrorCode_BadRequest); | 263 { |
262 } | 264 LOG(ERROR) << "When modifying a patient, the SeriesInstanceUID cannot be manually modified"; |
263 | 265 throw OrthancException(ErrorCode_BadRequest); |
264 if (level_ > ResourceType_Series && IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID)) | 266 } |
265 { | 267 |
266 throw OrthancException(ErrorCode_BadRequest); | 268 if (level_ == ResourceType_Patient && IsReplaced(DICOM_TAG_SOP_INSTANCE_UID)) |
267 } | 269 { |
270 LOG(ERROR) << "When modifying a patient, the SopInstanceUID cannot be manually modified"; | |
271 throw OrthancException(ErrorCode_BadRequest); | |
272 } | |
273 | |
274 if (level_ == ResourceType_Study && IsReplaced(DICOM_TAG_PATIENT_ID)) | |
275 { | |
276 LOG(ERROR) << "When modifying a study, the parent PatientID cannot be manually modified"; | |
277 throw OrthancException(ErrorCode_BadRequest); | |
278 } | |
279 | |
280 if (level_ == ResourceType_Study && IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID)) | |
281 { | |
282 LOG(ERROR) << "When modifying a study, the SeriesInstanceUID cannot be manually modified"; | |
283 throw OrthancException(ErrorCode_BadRequest); | |
284 } | |
285 | |
286 if (level_ == ResourceType_Study && IsReplaced(DICOM_TAG_SOP_INSTANCE_UID)) | |
287 { | |
288 LOG(ERROR) << "When modifying a study, the SopInstanceUID cannot be manually modified"; | |
289 throw OrthancException(ErrorCode_BadRequest); | |
290 } | |
291 | |
292 if (level_ == ResourceType_Series && IsReplaced(DICOM_TAG_PATIENT_ID)) | |
293 { | |
294 LOG(ERROR) << "When modifying a series, the parent PatientID cannot be manually modified"; | |
295 throw OrthancException(ErrorCode_BadRequest); | |
296 } | |
297 | |
298 if (level_ == ResourceType_Series && IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID)) | |
299 { | |
300 LOG(ERROR) << "When modifying a series, the parent StudyInstanceUID cannot be manually modified"; | |
301 throw OrthancException(ErrorCode_BadRequest); | |
302 } | |
303 | |
304 if (level_ == ResourceType_Series && IsReplaced(DICOM_TAG_SOP_INSTANCE_UID)) | |
305 { | |
306 LOG(ERROR) << "When modifying a series, the SopInstanceUID cannot be manually modified"; | |
307 throw OrthancException(ErrorCode_BadRequest); | |
308 } | |
309 | |
310 if (level_ == ResourceType_Instance && IsReplaced(DICOM_TAG_PATIENT_ID)) | |
311 { | |
312 LOG(ERROR) << "When modifying an instance, the parent PatientID cannot be manually modified"; | |
313 throw OrthancException(ErrorCode_BadRequest); | |
314 } | |
315 | |
316 if (level_ == ResourceType_Instance && IsReplaced(DICOM_TAG_STUDY_INSTANCE_UID)) | |
317 { | |
318 LOG(ERROR) << "When modifying an instance, the parent StudyInstanceUID cannot be manually modified"; | |
319 throw OrthancException(ErrorCode_BadRequest); | |
320 } | |
321 | |
322 if (level_ == ResourceType_Instance && IsReplaced(DICOM_TAG_SERIES_INSTANCE_UID)) | |
323 { | |
324 LOG(ERROR) << "When modifying an instance, the parent SeriesInstanceUID cannot be manually modified"; | |
325 throw OrthancException(ErrorCode_BadRequest); | |
326 } | |
327 | |
268 | 328 |
269 // (1) Remove the private tags, if need be | 329 // (1) Remove the private tags, if need be |
270 if (removePrivateTags_) | 330 if (removePrivateTags_) |
271 { | 331 { |
272 toModify.RemovePrivateTags(privateTagsToKeep_); | 332 toModify.RemovePrivateTags(privateTagsToKeep_); |