Mercurial > hg > orthanc
comparison Core/DicomParsing/ParsedDicomFile.cpp @ 2797:9a0c6a046cc2
Fix handling of incoming C-FIND queries containing Generic Group Length (*, 0x0000)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 16 Aug 2018 10:39:30 +0200 |
parents | 6db878376018 |
children | d386abc18133 |
comparison
equal
deleted
inserted
replaced
2796:4df3c64402ba | 2797:9a0c6a046cc2 |
---|---|
523 | 523 |
524 | 524 |
525 void ParsedDicomFile::Clear(const DicomTag& tag, | 525 void ParsedDicomFile::Clear(const DicomTag& tag, |
526 bool onlyIfExists) | 526 bool onlyIfExists) |
527 { | 527 { |
528 if (tag.GetElement() == 0x0000) | |
529 { | |
530 // Prevent manually modifying generic group length tags: This is | |
531 // handled by DCMTK serialization | |
532 return; | |
533 } | |
534 | |
528 InvalidateCache(); | 535 InvalidateCache(); |
529 | 536 |
530 DcmItem* dicom = pimpl_->file_->getDataset(); | 537 DcmItem* dicom = pimpl_->file_->getDataset(); |
531 DcmTagKey key(tag.GetGroup(), tag.GetElement()); | 538 DcmTagKey key(tag.GetGroup(), tag.GetElement()); |
532 | 539 |
610 | 617 |
611 void ParsedDicomFile::Insert(const DicomTag& tag, | 618 void ParsedDicomFile::Insert(const DicomTag& tag, |
612 const Json::Value& value, | 619 const Json::Value& value, |
613 bool decodeDataUriScheme) | 620 bool decodeDataUriScheme) |
614 { | 621 { |
622 if (tag.GetElement() == 0x0000) | |
623 { | |
624 // Prevent manually modifying generic group length tags: This is | |
625 // handled by DCMTK serialization | |
626 return; | |
627 } | |
628 | |
615 if (pimpl_->file_->getDataset()->tagExists(ToDcmtkBridge::Convert(tag))) | 629 if (pimpl_->file_->getDataset()->tagExists(ToDcmtkBridge::Convert(tag))) |
616 { | 630 { |
617 throw OrthancException(ErrorCode_AlreadyExistingTag); | 631 throw OrthancException(ErrorCode_AlreadyExistingTag); |
618 } | 632 } |
619 | 633 |
722 void ParsedDicomFile::Replace(const DicomTag& tag, | 736 void ParsedDicomFile::Replace(const DicomTag& tag, |
723 const std::string& utf8Value, | 737 const std::string& utf8Value, |
724 bool decodeDataUriScheme, | 738 bool decodeDataUriScheme, |
725 DicomReplaceMode mode) | 739 DicomReplaceMode mode) |
726 { | 740 { |
741 if (tag.GetElement() == 0x0000) | |
742 { | |
743 // Prevent manually modifying generic group length tags: This is | |
744 // handled by DCMTK serialization | |
745 return; | |
746 } | |
747 | |
727 InvalidateCache(); | 748 InvalidateCache(); |
728 | 749 |
729 DcmDataset& dicom = *pimpl_->file_->getDataset(); | 750 DcmDataset& dicom = *pimpl_->file_->getDataset(); |
730 if (CanReplaceProceed(dicom, ToDcmtkBridge::Convert(tag), mode)) | 751 if (CanReplaceProceed(dicom, ToDcmtkBridge::Convert(tag), mode)) |
731 { | 752 { |
754 void ParsedDicomFile::Replace(const DicomTag& tag, | 775 void ParsedDicomFile::Replace(const DicomTag& tag, |
755 const Json::Value& value, | 776 const Json::Value& value, |
756 bool decodeDataUriScheme, | 777 bool decodeDataUriScheme, |
757 DicomReplaceMode mode) | 778 DicomReplaceMode mode) |
758 { | 779 { |
780 if (tag.GetElement() == 0x0000) | |
781 { | |
782 // Prevent manually modifying generic group length tags: This is | |
783 // handled by DCMTK serialization | |
784 return; | |
785 } | |
786 | |
759 InvalidateCache(); | 787 InvalidateCache(); |
760 | 788 |
761 DcmDataset& dicom = *pimpl_->file_->getDataset(); | 789 DcmDataset& dicom = *pimpl_->file_->getDataset(); |
762 if (CanReplaceProceed(dicom, ToDcmtkBridge::Convert(tag), mode)) | 790 if (CanReplaceProceed(dicom, ToDcmtkBridge::Convert(tag), mode)) |
763 { | 791 { |