comparison OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp @ 4695:651f069c7f77

fix error if overriding existing tag in the DICOM dictionary
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 17 Jun 2021 14:00:34 +0200
parents 13efc0967cea
children dd6274412ff4
comparison
equal deleted inserted replaced
4694:da1edb7d6332 4695:651f069c7f77
450 entry->setElementRangeRestriction(DcmDictRange_Unspecified); 450 entry->setElementRangeRestriction(DcmDictRange_Unspecified);
451 451
452 { 452 {
453 DictionaryLocker locker; 453 DictionaryLocker locker;
454 454
455 if (locker->findEntry(name.c_str())) 455 if (locker->findEntry(DcmTagKey(tag.GetGroup(), tag.GetElement()),
456 privateCreator.empty() ? NULL : privateCreator.c_str()))
456 { 457 {
457 throw OrthancException(ErrorCode_AlreadyExistingTag, 458 throw OrthancException(ErrorCode_AlreadyExistingTag,
458 "Cannot register two tags with the same symbolic name \"" + name + "\""); 459 "Cannot register twice the tag (" + tag.Format() +
459 } 460 "), whose symbolic name is \"" + name + "\"");
460 461 }
461 locker->addEntry(entry.release()); 462 else
463 {
464 locker->addEntry(entry.release());
465 }
462 } 466 }
463 } 467 }
464 468
465 469
466 Encoding FromDcmtkBridge::DetectEncoding(bool& hasCodeExtensions, 470 Encoding FromDcmtkBridge::DetectEncoding(bool& hasCodeExtensions,