| 496 | }; |
| 497 | |
| 498 | std::string DICOMTagPathToPersistenceKeyRegEx(const DICOMTagPath& tagPath) |
| 499 | { |
| 500 | std::ostringstream nameStream; |
| 501 | |
| 502 | nameStream << "DICOM"; |
| 503 | |
| 504 | for (const auto& node : tagPath.GetNodes()) |
| 505 | { |
| 506 | nameStream << "_"; |
| 507 | |
| 508 | if (node.type == DICOMTagPath::NodeInfo::NodeType::AnyElement) |
| 509 | { |
| 510 | nameStream << "([A-Fa-f\\d]{4})_([A-Fa-f\\d]{4})"; |
| 511 | } |
| 512 | else if (node.type != DICOMTagPath::NodeInfo::NodeType::Invalid) |
| 513 | { |
| 514 | nameStream << GenerateRegExForNumber(node.tag.GetGroup()) |
| 515 | << "_" |
| 516 | << GenerateRegExForNumber(node.tag.GetElement()); |
| 517 | |
| 518 | if (node.type == DICOMTagPath::NodeInfo::NodeType::SequenceSelection) |
| 519 | { |
| 520 | nameStream << "_\\[" << node.selection << "\\]"; |
| 521 | } |
| 522 | else if (node.type == DICOMTagPath::NodeInfo::NodeType::AnySelection) |
| 523 | { |
| 524 | nameStream << "_\\[(\\d*)\\]"; |
| 525 | } |
| 526 | } |
| 527 | else |
| 528 | { |
| 529 | nameStream << "INVALIDNODE"; |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | return nameStream.str(); |
| 534 | }; |
| 535 | |
| 536 | std::string DICOMTagPathToPersistenceKeyTemplate(const DICOMTagPath& tagPath) |
| 537 | { |