| 55 | } |
| 56 | |
| 57 | std::string |
| 58 | mitk::GetFirstDICOMValueAsString(const mitk::IPropertyProvider* provider, const mitk::DICOMTagPath& path) |
| 59 | { |
| 60 | const auto matches = GetPropertyByDICOMTagPath(provider, path); |
| 61 | if (matches.empty()) |
| 62 | { |
| 63 | return {}; |
| 64 | } |
| 65 | const auto& baseProp = matches.begin()->second; |
| 66 | const auto* dicomProp = |
| 67 | dynamic_cast<const mitk::DICOMProperty*>(baseProp.GetPointer()); |
| 68 | if (nullptr != dicomProp) |
| 69 | { |
| 70 | return dicomProp->GetValue(0, 0, true, true); |
| 71 | } |
| 72 | // Not a TemporoSpatialStringProperty (e.g. a uniform-value StringProperty |
| 73 | // produced for a tag whose value is constant across all slices): fall back |
| 74 | // to the generic string accessor so the helper works for any property kind |
| 75 | // an IPropertyProvider may carry, not only the DICOM reader's output. |
| 76 | return baseProp->GetValueAsString(); |
| 77 | } |
nothing calls this directly
no test coverage detected