Pull the first matching property as a DICOMProperty so the caller can index by (timestep, slice). Returns nullptr if no match. Wraps mitk::GetPropertyByDICOMTagPath so per-slice access stays available alongside the simpler mitk::GetFirstDICOMValueAsString convenience.
| 59 | // mitk::GetPropertyByDICOMTagPath so per-slice access stays available |
| 60 | // alongside the simpler mitk::GetFirstDICOMValueAsString convenience. |
| 61 | const mitk::DICOMProperty* FindFirstDICOMProperty( |
| 62 | const mitk::IPropertyProvider* provider, |
| 63 | const mitk::DICOMTagPath& path) |
| 64 | { |
| 65 | const auto matches = mitk::GetPropertyByDICOMTagPath(provider, path); |
| 66 | if (matches.empty()) |
| 67 | { |
| 68 | return nullptr; |
| 69 | } |
| 70 | if (matches.size() > 1) |
| 71 | { |
| 72 | MITK_WARN << "Multiple properties match DICOM tag path " << path.ToStr() |
| 73 | << "; using the first match: " << matches.begin()->first; |
| 74 | } |
| 75 | return dynamic_cast<const mitk::DICOMProperty*>(matches.begin()->second.GetPointer()); |
| 76 | } |
| 77 | |
| 78 | // Splice an optional date string and a time string into an OFDateTime. |
| 79 | // Returns true on success. |
no test coverage detected