| 574 | }; |
| 575 | |
| 576 | std::string DICOMTagPathToPersistenceNameTemplate(const DICOMTagPath& tagPath) |
| 577 | { |
| 578 | std::ostringstream nameStream; |
| 579 | |
| 580 | nameStream << "DICOM"; |
| 581 | |
| 582 | int captureGroup = 1; |
| 583 | |
| 584 | for (const auto& node : tagPath.GetNodes()) |
| 585 | { |
| 586 | nameStream << "."; |
| 587 | |
| 588 | if (node.type == DICOMTagPath::NodeInfo::NodeType::AnyElement) |
| 589 | { |
| 590 | nameStream << "$" << captureGroup++; |
| 591 | nameStream << ".$" << captureGroup++; |
| 592 | } |
| 593 | else if (node.type != DICOMTagPath::NodeInfo::NodeType::Invalid) |
| 594 | { |
| 595 | nameStream << std::setw(4) << std::setfill('0') << std::hex << std::uppercase << node.tag.GetGroup() << std::nouppercase << "." |
| 596 | << std::setw(4) << std::setfill('0') << std::hex << std::uppercase << node.tag.GetElement(); |
| 597 | |
| 598 | if (node.type == DICOMTagPath::NodeInfo::NodeType::SequenceSelection) |
| 599 | { |
| 600 | nameStream << ".[" << node.selection << "]"; |
| 601 | } |
| 602 | else if (node.type == DICOMTagPath::NodeInfo::NodeType::AnySelection) |
| 603 | { |
| 604 | nameStream << ".[$"<<captureGroup++<<"]"; |
| 605 | } |
| 606 | } |
| 607 | else |
| 608 | { |
| 609 | nameStream << "INVALID_NODE"; |
| 610 | } |
| 611 | } |
| 612 | |
| 613 | return nameStream.str(); |
| 614 | }; |
| 615 | |
| 616 | |
| 617 | std::string DICOMTagPathToDCMTKSearchPath(const DICOMTagPath& tagPath) |