comparison OrthancServer/ParsedDicomFile.cpp @ 2310:b7fba68747f6 issue-46-anonymization

DicomModification::Clear()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 Jul 2017 14:00:00 +0200
parents e002430baa41
children 96b3ec054b69
comparison
equal deleted inserted replaced
2309:4dc313b9a20a 2310:b7fba68747f6
506 delete element; 506 delete element;
507 } 507 }
508 } 508 }
509 509
510 510
511 void ParsedDicomFile::Clear(const DicomTag& tag,
512 bool onlyIfExists)
513 {
514 InvalidateCache();
515
516 DcmItem* dicom = pimpl_->file_->getDataset();
517 DcmTagKey key(tag.GetGroup(), tag.GetElement());
518
519 if (onlyIfExists &&
520 !dicom->tagExists(key))
521 {
522 // The tag is non-existing, do not clear it
523 }
524 else
525 {
526 if (!dicom->insertEmptyElement(key, OFTrue /* replace old value */).good())
527 {
528 throw OrthancException(ErrorCode_InternalError);
529 }
530 }
531 }
532
511 533
512 void ParsedDicomFile::RemovePrivateTagsInternal(const std::set<DicomTag>* toKeep) 534 void ParsedDicomFile::RemovePrivateTagsInternal(const std::set<DicomTag>* toKeep)
513 { 535 {
514 InvalidateCache(); 536 InvalidateCache();
515 537