Mercurial > hg > orthanc
comparison OrthancFramework/Sources/DicomFormat/DicomMap.cpp @ 4940:304514ce84ee more-tags
tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
author | Alain Mazy <am@osimis.io> |
---|---|
date | Tue, 15 Mar 2022 15:57:21 +0100 |
parents | 8422e4f99a18 |
children | f377d5643538 |
comparison
equal
deleted
inserted
replaced
4939:e8a2e145c80e | 4940:304514ce84ee |
---|---|
631 return (IsMainDicomTag(tag, ResourceType_Patient) || | 631 return (IsMainDicomTag(tag, ResourceType_Patient) || |
632 IsMainDicomTag(tag, ResourceType_Study) || | 632 IsMainDicomTag(tag, ResourceType_Study) || |
633 IsMainDicomTag(tag, ResourceType_Series) || | 633 IsMainDicomTag(tag, ResourceType_Series) || |
634 IsMainDicomTag(tag, ResourceType_Instance)); | 634 IsMainDicomTag(tag, ResourceType_Instance)); |
635 } | 635 } |
636 | |
637 bool DicomMap::IsComputedTag(const DicomTag& tag) | |
638 { | |
639 return (IsComputedTag(tag, ResourceType_Patient) || | |
640 IsComputedTag(tag, ResourceType_Study) || | |
641 IsComputedTag(tag, ResourceType_Series) || | |
642 IsComputedTag(tag, ResourceType_Instance)); | |
643 } | |
644 | |
645 bool DicomMap::IsComputedTag(const DicomTag& tag, ResourceType level) | |
646 { | |
647 switch (level) | |
648 { | |
649 case ResourceType_Patient: | |
650 return ( | |
651 tag == DICOM_TAG_NUMBER_OF_PATIENT_RELATED_STUDIES || | |
652 tag == DICOM_TAG_NUMBER_OF_PATIENT_RELATED_SERIES || | |
653 tag == DICOM_TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES | |
654 ); | |
655 case ResourceType_Study: | |
656 return ( | |
657 tag == DICOM_TAG_MODALITIES_IN_STUDY || | |
658 tag == DICOM_TAG_SOP_CLASSES_IN_STUDY || | |
659 tag == DICOM_TAG_NUMBER_OF_STUDY_RELATED_INSTANCES || | |
660 tag == DICOM_TAG_NUMBER_OF_STUDY_RELATED_SERIES | |
661 ); | |
662 case ResourceType_Series: | |
663 return ( | |
664 tag == DICOM_TAG_NUMBER_OF_SERIES_RELATED_INSTANCES | |
665 ); | |
666 case ResourceType_Instance: | |
667 return false; | |
668 default: | |
669 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
670 } | |
671 } | |
672 | |
673 bool DicomMap::HasOnlyComputedTags(const std::set<DicomTag>& tags) | |
674 { | |
675 if (tags.size() == 0) | |
676 { | |
677 return false; | |
678 } | |
679 | |
680 for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); ++it) | |
681 { | |
682 if (!IsComputedTag(*it)) | |
683 { | |
684 return false; | |
685 } | |
686 } | |
687 return true; | |
688 } | |
689 | |
690 bool DicomMap::HasComputedTags(const std::set<DicomTag>& tags) | |
691 { | |
692 for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); ++it) | |
693 { | |
694 if (IsComputedTag(*it)) | |
695 { | |
696 return true; | |
697 } | |
698 } | |
699 | |
700 return false; | |
701 } | |
702 | |
703 bool DicomMap::HasComputedTags(const std::set<DicomTag>& tags, ResourceType level) | |
704 { | |
705 for (std::set<DicomTag>::const_iterator it = tags.begin(); it != tags.end(); ++it) | |
706 { | |
707 if (IsComputedTag(*it, level)) | |
708 { | |
709 return true; | |
710 } | |
711 } | |
712 return false; | |
713 } | |
714 | |
636 | 715 |
637 const std::set<DicomTag>& DicomMap::GetMainDicomTags(ResourceType level) | 716 const std::set<DicomTag>& DicomMap::GetMainDicomTags(ResourceType level) |
638 { | 717 { |
639 return DicomMap::MainDicomTagsConfiguration::GetInstance().GetMainDicomTagsByLevel(level); | 718 return DicomMap::MainDicomTagsConfiguration::GetInstance().GetMainDicomTagsByLevel(level); |
640 } | 719 } |