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

Function DICOMTagPathToPersistenceKeyTemplate

Modules/DICOM/src/mitkDICOMTagPath.cpp:536–574  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

534 };
535
536 std::string DICOMTagPathToPersistenceKeyTemplate(const DICOMTagPath& tagPath)
537 {
538 std::ostringstream nameStream;
539
540 nameStream << "DICOM";
541
542 int captureGroup = 1;
543
544 for (const auto& node : tagPath.GetNodes())
545 {
546 nameStream << "_";
547
548 if (node.type == DICOMTagPath::NodeInfo::NodeType::AnyElement)
549 {
550 nameStream << "$" << captureGroup++;
551 nameStream << "_$" << captureGroup++;
552 }
553 else if (node.type != DICOMTagPath::NodeInfo::NodeType::Invalid)
554 {
555 nameStream << std::setw(4) << std::setfill('0') << std::hex << std::uppercase << node.tag.GetGroup() << std::nouppercase << "_"
556 << std::setw(4) << std::setfill('0') << std::hex << std::uppercase << node.tag.GetElement();
557
558 if (node.type == DICOMTagPath::NodeInfo::NodeType::SequenceSelection)
559 {
560 nameStream << "_[" << node.selection << "]";
561 }
562 else if (node.type == DICOMTagPath::NodeInfo::NodeType::AnySelection)
563 {
564 nameStream << "_[$" << captureGroup++ << "]";
565 }
566 }
567 else
568 {
569 nameStream << "INVALID_NODE";
570 }
571 }
572
573 return nameStream.str();
574 };
575
576 std::string DICOMTagPathToPersistenceNameTemplate(const DICOMTagPath& tagPath)
577 {

Callers 2

AddTagOfInterestMethod · 0.85

Calls 3

GetNodesMethod · 0.45
GetGroupMethod · 0.45
GetElementMethod · 0.45

Tested by 1