Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkDICOMProperty.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkDICOMProperty_h
14 #define mitkDICOMProperty_h
15 
18 #include <mitkDICOMTagPath.h>
19 
20 #include <MitkDICOMExports.h>
21 
22 namespace mitk
23 {
24 
31 
43  MITKDICOM_EXPORT mitk::BaseProperty::Pointer GetDICOMPropertyForDICOMValuesFunctor(const DICOMCachedValueLookupTable& cacheLookupTable);
44 
45 
46  class IPropertyProvider;
47 
63  MITKDICOM_EXPORT std::map<std::string, BaseProperty::ConstPointer>
65 
84  MITKDICOM_EXPORT std::string
86 
101  template<typename TNumericReturnType>
102  TNumericReturnType ConvertDICOMStrToValue(const std::string& dcmValueString)
103  {
104  std::istringstream iss(dcmValueString);
105  iss.imbue(std::locale("C"));
106  TNumericReturnType d;
107  if (!(iss >> d) || !(iss.eof()))
108  {
109  mitkThrow() << "Cannot convert string to value type. Type: " << typeid(TNumericReturnType).name() << "; String: " << dcmValueString;
110  }
111 
112  return d;
113  };
114 
127  template<typename TNumericType>
128  std::string ConvertValueToDICOMStr(const TNumericType value)
129  {
130  std::ostringstream oss;
131  oss.imbue(std::locale("C"));
132  if (!(oss << value))
133  {
134  mitkThrow() << "Cannot convert value type to dicom string. Type: " << typeid(TNumericType).name() << "; value: " << value;
135  }
136 
137  return oss.str();
138  };
139 
140 
141 }
142 
143 #endif
#define MITKDICOM_EXPORT
Lookup table mapping slice indices to cached DICOM tag value information.
Class used to identify (nested) attributes in a DICOM dataset.
Interface implemented by classes that provide access to property information.
Property for storing string values resolved by time step and slice index.
TemporoSpatialStringProperty DICOMProperty
Type alias for DICOM property values, stored as TemporoSpatialStringProperty.
#define mitkThrow()
Throw a generic mitk::Exception with source location information.
Find image slices visible on a given plane.
TNumericReturnType ConvertDICOMStrToValue(const std::string &dcmValueString)
Convert a DICOM property string to a numeric value.
std::string ConvertValueToDICOMStr(const TNumericType value)
Convert a numeric value to a DICOM property string.
MITKDICOM_EXPORT std::map< std::string, BaseProperty::ConstPointer > GetPropertyByDICOMTagPath(const IPropertyProvider *provider, const DICOMTagPath &path)
Search a property provider for properties matching a DICOM tag path.
MITKDICOM_EXPORT mitk::BaseProperty::Pointer GetDICOMPropertyForDICOMValuesFunctor(const DICOMCachedValueLookupTable &cacheLookupTable)
Functor to convert collected DICOM tag values into DICOMProperty instances.
MITKDICOM_EXPORT std::string GetFirstDICOMValueAsString(const IPropertyProvider *provider, const DICOMTagPath &path)
Read the first matching DICOM property's string value.