Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
Medical Imaging Interaction Toolkit
mitkDICOMImageBlockDescriptor.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 mitkDICOMImageBlockDescriptor_h
14 #define mitkDICOMImageBlockDescriptor_h
15 
16 #include "mitkDICOMEnums.h"
18 #include "mitkDICOMTag.h"
19 #include "mitkDICOMTagCache.h"
21 
22 #include "mitkImage.h"
23 #include "mitkProperties.h"
24 #include "mitkWeakPointer.h"
25 #include "mitkIPropertyProvider.h"
26 
28 
29 #include <unordered_map>
30 
31 namespace mitk
32 {
33 
35  {
36  unsigned int TimePoint;
37  unsigned int SliceInTimePoint;
38  std::string Value;
39  };
40 
41  class DICOMCachedValueLookupTable : public GenericLookupTable< DICOMCachedValueInfo >
42  {
43  public:
46  const char *GetNameOfClass() const override
47  {
48  return "DICOMCachedValueLookupTable";
49  }
50 
52  Superclass& operator=(const Superclass& other) override { return Superclass::operator=(other); }
54  };
55 
79  {
80  public:
81 
83  ~DICOMImageBlockDescriptor() override;
84 
87 
88  static DICOMTagList GetTagsOfInterest();
89 
91  void SetImageFrameList(const DICOMImageFrameList& framelist);
93  const DICOMImageFrameList& GetImageFrameList() const;
94 
96  void SetMitkImage(Image::Pointer image);
98  Image::Pointer GetMitkImage() const;
99 
101  ReaderImplementationLevel GetReaderImplementationLevel() const;
103  void SetReaderImplementationLevel(const ReaderImplementationLevel& level);
104 
106  void SetProperty(const std::string& key, BaseProperty* value);
108  BaseProperty* GetProperty(const std::string& key) const;
109 
111  std::string GetPropertyAsString(const std::string&) const;
112 
114  IOVolumeSplitReason::ConstPointer GetSplitReason() const;
116  IOVolumeSplitReason::Pointer GetSplitReason();
118  void SetSplitReason(IOVolumeSplitReason::Pointer reason);
119 
121  void SetFlag(const std::string& key, bool value);
123  bool GetFlag(const std::string& key, bool defaultValue) const;
124 
126  void SetIntProperty(const std::string& key, int value);
128  int GetIntProperty(const std::string& key, int defaultValue) const;
129 
130  BaseProperty::ConstPointer GetConstProperty(const std::string &propertyKey,
131  const std::string &contextName = "",
132  bool fallBackOnDefaultContext = true) const override;
133 
134  std::vector<std::string> GetPropertyKeys(const std::string &contextName = "",
135  bool includeDefaultContext = false) const override;
136 
137  std::vector<std::string> GetPropertyContextNames() const override;
138 
139  private:
140 
141  // For future implementation: load slice-by-slice, mark this using these methods
142  void SetSliceIsLoaded(unsigned int index, bool isLoaded);
143  // For future implementation: load slice-by-slice, mark this using these methods
144  bool IsSliceLoaded(unsigned int index) const;
145  // For future implementation: load slice-by-slice, mark this using these methods
146  bool AllSlicesAreLoaded() const;
147 
148  public:
149 
151  PixelSpacingInterpretation GetPixelSpacingInterpretation() const;
152 
154  void GetDesiredMITKImagePixelSpacing(ScalarType& spacingXinMM, ScalarType& spacingYinMM) const;
155 
157  void SetTiltInformation(const GantryTiltInformation& info);
159  const GantryTiltInformation GetTiltInformation() const;
160 
162  void SetSOPClassUID(const std::string& uid);
164  std::string GetSOPClassUID() const;
166  std::string GetSOPClassUIDAsName() const;
167 
169  int GetNumberOfTimeSteps() const;
171  int GetNumberOfFramesPerTimeStep() const;
172 
173  void SetTagCache(DICOMTagCache* privateCache);
174 
178  typedef std::map<DICOMTagPath, std::string> AdditionalTagsMapType;
190  void SetAdditionalTagsOfInterest(const AdditionalTagsMapType& tagMap);
191 
193 
204  void SetTagLookupTableToPropertyFunctor(TagLookupTableToPropertyFunctor);
205 
206 
208  void Print(std::ostream& os, bool filenameDetails) const;
209 
210  private:
211 
212  // read values from tag cache
213  std::string GetPixelSpacing() const;
214  std::string GetImagerPixelSpacing() const;
215 
216  Image::Pointer FixupSpacing(Image* mitkImage);
217  Image::Pointer DescribeImageWithProperties(Image* mitkImage);
218  void UpdateImageDescribingProperties() const;
219 
220  static mitk::BaseProperty::Pointer GetPropertyForDICOMValues(const DICOMCachedValueLookupTable& cacheLookupTable);
221 
222  double stringtodouble(const std::string& str) const;
223  DICOMImageFrameList m_ImageFrameList;
224 
225  Image::Pointer m_MitkImage;
226  BoolList m_SliceIsLoaded;
227  ReaderImplementationLevel m_ReaderImplementationLevel;
228 
229  GantryTiltInformation m_TiltInformation;
230 
231  PropertyList::Pointer m_PropertyList;
232 
233  IOVolumeSplitReason::Pointer m_SplitReason;
234 
235  WeakPointer<DICOMTagCache> m_TagCache;
236 
237  mutable bool m_PropertiesOutOfDate;
238 
239  AdditionalTagsMapType m_AdditionalTagMap;
240  std::set<std::string> m_FoundAdditionalTags;
241 
242  TagLookupTableToPropertyFunctor m_PropertyFunctor;
243  };
244 
245 }
246 
247 #endif
mitk::BaseProperty
Abstract base class for properties.
Definition: mitkBaseProperty.h:36
mitk::DICOMImageBlockDescriptor
Output descriptor for DICOMFileReader.
Definition: mitkDICOMImageBlockDescriptor.h:78
mitk::IOVolumeSplitReason::ConstPointer
std::shared_ptr< const IOVolumeSplitReason > ConstPointer
Definition: mitkIOVolumeSplitReason.h:30
mitkImage.h
mitk::GenericLookupTable< DICOMCachedValueInfo >::operator=
virtual Self & operator=(const Self &other)
Definition: mitkGenericLookupTable.h:77
mitk::DICOMCachedValueInfo::SliceInTimePoint
unsigned int SliceInTimePoint
Definition: mitkDICOMImageBlockDescriptor.h:37
mitk::DICOMImageFrameList
std::vector< DICOMImageFrameInfo::Pointer > DICOMImageFrameList
Definition: mitkDICOMImageFrameInfo.h:53
mitk::DICOMImageBlockDescriptor::TagLookupTableToPropertyFunctor
std::function< mitk::BaseProperty::Pointer(const DICOMCachedValueLookupTable &) > TagLookupTableToPropertyFunctor
Definition: mitkDICOMImageBlockDescriptor.h:192
mitk::DICOMCachedValueLookupTable::Superclass
GenericLookupTable< DICOMCachedValueInfo > Superclass
Definition: mitkDICOMImageBlockDescriptor.h:45
mitk::BaseProperty::Pointer
itk::SmartPointer< Self > Pointer
Definition: mitkBaseProperty.h:39
mitk::Image
Image class for storing images.
Definition: mitkImage.h:69
itk::SmartPointer< Self >
mitk::DICOMCachedValueInfo::TimePoint
unsigned int TimePoint
Definition: mitkDICOMImageBlockDescriptor.h:36
mitkDICOMEnums.h
mitk::GantryTiltInformation
Gantry tilt analysis result.
Definition: mitkGantryTiltInformation.h:38
mitk::PixelSpacingInterpretation
PixelSpacingInterpretation
How the mitk::Image spacing should be interpreted (see mitk::DICOMFileReader).
Definition: mitkDICOMEnums.h:31
mitk::IOVolumeSplitReason::Pointer
std::shared_ptr< IOVolumeSplitReason > Pointer
Definition: mitkIOVolumeSplitReason.h:29
mitk::BoolList
std::vector< bool > BoolList
Definition: mitkDICOMEnums.h:23
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::DICOMCachedValueLookupTable::GetNameOfClass
const char * GetNameOfClass() const override
Definition: mitkDICOMImageBlockDescriptor.h:46
mitk::DICOMTagList
std::vector< DICOMTag > DICOMTagList
Definition: mitkDICOMTag.h:59
mitk::DICOMCachedValueLookupTable::DICOMCachedValueLookupTable
DICOMCachedValueLookupTable()
Definition: mitkDICOMImageBlockDescriptor.h:51
mitk::DICOMCachedValueInfo
Definition: mitkDICOMImageBlockDescriptor.h:34
mitkGantryTiltInformation.h
mitk::ReaderImplementationLevel
ReaderImplementationLevel
Describes how well the reader is tested for a certain file type (see mitk::DICOMFileReader).
Definition: mitkDICOMEnums.h:48
mitkDICOMTagCache.h
mitk::DICOMTagCache
...
Definition: mitkDICOMTagCache.h:33
mitkDICOMTag.h
mitk::DICOMCachedValueLookupTable
Definition: mitkDICOMImageBlockDescriptor.h:41
mitkWeakPointer.h
mitk::ROIMapperHelper::GetConstProperty
const T * GetConstProperty(const std::string &propertyKey, const ROI::Element &roi, TimeStepType t)
Syntactic sugar for getting ROI properties.
Definition: mitkROIMapperHelper.h:48
mitk::DICOMCachedValueLookupTable::~DICOMCachedValueLookupTable
~DICOMCachedValueLookupTable() override
Definition: mitkDICOMImageBlockDescriptor.h:53
mitk::DICOMCachedValueLookupTable::operator=
Superclass & operator=(const Superclass &other) override
Definition: mitkDICOMImageBlockDescriptor.h:52
mitkIPropertyProvider.h
mitk::IPropertyProvider
Definition: mitkIPropertyProvider.h:24
mitkDICOMImageFrameInfo.h
MITKDICOM_EXPORT
#define MITKDICOM_EXPORT
Definition: MitkDICOMExports.h:15
mitk::DICOMImageBlockDescriptor::AdditionalTagsMapType
std::map< DICOMTagPath, std::string > AdditionalTagsMapType
Definition: mitkDICOMImageBlockDescriptor.h:178
mitk::GenericLookupTable
Template class for generating lookup-tables.
Definition: mitkGenericLookupTable.h:30
mitk::WeakPointer
Definition: mitkWeakPointer.h:22
mitkProperties.h
mitkIOVolumeSplitReason.h
mitk::DICOMCachedValueLookupTable::Self
DICOMCachedValueLookupTable Self
Definition: mitkDICOMImageBlockDescriptor.h:44
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20
mitk::DICOMCachedValueInfo::Value
std::string Value
Definition: mitkDICOMImageBlockDescriptor.h:38