MCPcopy Create free account
hub / github.com/MITK/MITK / DICOMTagPathToReadableName

Function DICOMTagPathToReadableName

Modules/DICOM/src/mitkDICOMTagPath.cpp:767–811  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

765 }
766
767 std::string DICOMTagPathToReadableName(const DICOMTagPath& tagPath, bool includeTagNumbers)
768 {
769 if (tagPath.IsEmpty())
770 {
771 return "<empty path>";
772 }
773
774 std::ostringstream result;
775
776 for (const auto& node : tagPath.GetNodes())
777 {
778
779 if (node.type == DICOMTagPath::NodeInfo::NodeType::AnyElement)
780 {
781 result << "<any element>";
782 }
783 else if (node.type == DICOMTagPath::NodeInfo::NodeType::Invalid)
784 {
785 result << "<invalid node>";
786 }
787 else
788 {
789 result << node.tag.GetName();
790
791 if (includeTagNumbers)
792 {
793 result << " ("
794 << std::setw(4) << std::setfill('0') << std::hex << std::uppercase
795 << node.tag.GetGroup() << ","
796 << std::setw(4) << std::setfill('0') << std::hex << std::uppercase
797 << node.tag.GetElement() << std::dec << ")";
798 }
799
800 if (node.type == DICOMTagPath::NodeInfo::NodeType::SequenceSelection)
801 {
802 result << "[" << node.selection << "]";
803 }
804 else if (node.type == DICOMTagPath::NodeInfo::NodeType::AnySelection)
805 {
806 result << "[*]";
807 }
808 }
809 }
810 return result.str();
811 }
812}

Callers 1

InitDICOMTagPathFunction · 0.85

Calls 5

IsEmptyMethod · 0.45
GetNodesMethod · 0.45
GetNameMethod · 0.45
GetGroupMethod · 0.45
GetElementMethod · 0.45

Tested by

no test coverage detected