| 458 | }; |
| 459 | |
| 460 | std::string DICOMTagPathToPropertyRegEx(const DICOMTagPath& tagPath) |
| 461 | { |
| 462 | std::ostringstream nameStream; |
| 463 | |
| 464 | nameStream << "DICOM"; |
| 465 | |
| 466 | for (const auto& node : tagPath.GetNodes()) |
| 467 | { |
| 468 | nameStream << "\\."; |
| 469 | |
| 470 | if (node.type == DICOMTagPath::NodeInfo::NodeType::AnyElement) |
| 471 | { |
| 472 | nameStream << "([A-Fa-f\\d]{4})\\.([A-Fa-f\\d]{4})"; |
| 473 | } |
| 474 | else if (node.type != DICOMTagPath::NodeInfo::NodeType::Invalid) |
| 475 | { |
| 476 | nameStream << GenerateRegExForNumber(node.tag.GetGroup()) |
| 477 | << "\\." |
| 478 | << GenerateRegExForNumber(node.tag.GetElement()); |
| 479 | |
| 480 | if (node.type == DICOMTagPath::NodeInfo::NodeType::SequenceSelection) |
| 481 | { |
| 482 | nameStream << "\\.\\[" << node.selection << "\\]"; |
| 483 | } |
| 484 | else if (node.type == DICOMTagPath::NodeInfo::NodeType::AnySelection) |
| 485 | { |
| 486 | nameStream << "\\.\\[(\\d*)\\]"; |
| 487 | } |
| 488 | } |
| 489 | else |
| 490 | { |
| 491 | nameStream << "INVALIDNODE"; |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | return nameStream.str(); |
| 496 | }; |
| 497 | |
| 498 | std::string DICOMTagPathToPersistenceKeyRegEx(const DICOMTagPath& tagPath) |
| 499 | { |