Medical Imaging Interaction Toolkit  2023.12.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 
26 
29 
30 
31  class PropertyList;
32  class BaseData;
33 
36  MITKDICOM_EXPORT std::map< std::string, BaseProperty::Pointer> GetPropertyByDICOMTagPath(const PropertyList* list, const DICOMTagPath& path);
39  MITKDICOM_EXPORT std::map< std::string, BaseProperty::Pointer> GetPropertyByDICOMTagPath(const BaseData* data, const DICOMTagPath& path);
40 
48  template<typename TNumericReturnType>
49  TNumericReturnType ConvertDICOMStrToValue(const std::string& dcmValueString)
50  {
51  std::istringstream iss(dcmValueString);
52  iss.imbue(std::locale("C"));
53  TNumericReturnType d;
54  if (!(iss >> d) || !(iss.eof()))
55  {
56  mitkThrow() << "Cannot convert string to value type. Type: " << typeid(TNumericReturnType).name() << "; String: " << dcmValueString;
57  }
58 
59  return d;
60  };
61 
66  template<typename TNumericType>
67  std::string ConvertValueToDICOMStr(const TNumericType value)
68  {
69  std::ostringstream oss;
70  oss.imbue(std::locale("C"));
71  if (!(oss << value))
72  {
73  mitkThrow() << "Cannot convert value type to dicom string. Type: " << typeid(TNumericType).name() << "; value: " << value;
74  }
75 
76  return oss.str();
77  };
78 
79 
80 }
81 
82 #endif
mitkTemporoSpatialStringProperty.h
mitk::ConvertDICOMStrToValue
TNumericReturnType ConvertDICOMStrToValue(const std::string &dcmValueString)
Definition: mitkDICOMProperty.h:49
mitk::GetPropertyByDICOMTagPath
MITKDICOM_EXPORT std::map< std::string, BaseProperty::Pointer > GetPropertyByDICOMTagPath(const PropertyList *list, const DICOMTagPath &path)
MitkDICOMExports.h
mitk::ConvertValueToDICOMStr
std::string ConvertValueToDICOMStr(const TNumericType value)
Definition: mitkDICOMProperty.h:67
itk::SmartPointer< Self >
mitk::TemporoSpatialStringProperty
Property for time and space resolved string values.
Definition: mitkTemporoSpatialStringProperty.h:36
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::GetDICOMPropertyForDICOMValuesFunctor
MITKDICOM_EXPORT mitk::BaseProperty::Pointer GetDICOMPropertyForDICOMValuesFunctor(const DICOMCachedValueLookupTable &cacheLookupTable)
mitkThrow
#define mitkThrow()
Definition: mitkExceptionMacro.h:27
mitkDICOMImageBlockDescriptor.h
mitk::DICOMProperty
TemporoSpatialStringProperty DICOMProperty
Definition: mitkDICOMProperty.h:25
mitk::PropertyList
Key-value list holding instances of BaseProperty.
Definition: mitkPropertyList.h:56
mitk::BaseData
Base of all data objects.
Definition: mitkBaseData.h:42
mitk::DICOMCachedValueLookupTable
Definition: mitkDICOMImageBlockDescriptor.h:40
mitkDICOMTagPath.h
MITKDICOM_EXPORT
#define MITKDICOM_EXPORT
Definition: MitkDICOMExports.h:15
mitk::DICOMTagPath
Class is used to identify (nested) attributes in a DICOM dataset. In contrast to the class DICOMTag,...
Definition: mitkDICOMTagPath.h:34