Medical Imaging Interaction Toolkit  2023.12.99-77685e7b
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"
20 
21 #include "mitkImage.h"
22 #include "mitkProperties.h"
23 #include "mitkWeakPointer.h"
24 #include "mitkIPropertyProvider.h"
25 
27 
28 #include <unordered_map>
29 
30 namespace mitk
31 {
32 
34  {
35  unsigned int TimePoint;
36  unsigned int SliceInTimePoint;
37  std::string Value;
38  };
39 
40  class DICOMCachedValueLookupTable : public GenericLookupTable< DICOMCachedValueInfo >
41  {
42  public:
45  const char *GetNameOfClass() const override
46  {
47  return "DICOMCachedValueLookupTable";
48  }
49 
51  Superclass& operator=(const Superclass& other) override { return Superclass::operator=(other); }
53  };
54 
78  {
79  public:
80 
82  ~DICOMImageBlockDescriptor() override;
83 
86 
87  static DICOMTagList GetTagsOfInterest();
88 
90  void SetImageFrameList(const DICOMImageFrameList& framelist);
92  const DICOMImageFrameList& GetImageFrameList() const;
93 
95  void SetMitkImage(Image::Pointer image);
97  Image::Pointer GetMitkImage() const;
98 
100  ReaderImplementationLevel GetReaderImplementationLevel() const;
102  void SetReaderImplementationLevel(const ReaderImplementationLevel& level);
103 
105  void SetProperty(const std::string& key, BaseProperty* value);
107  BaseProperty* GetProperty(const std::string& key) const;
108 
110  std::string GetPropertyAsString(const std::string&) const;
111 
113  void SetFlag(const std::string& key, bool value);
115  bool GetFlag(const std::string& key, bool defaultValue) const;
116 
118  void SetIntProperty(const std::string& key, int value);
120  int GetIntProperty(const std::string& key, int defaultValue) const;
121 
122  BaseProperty::ConstPointer GetConstProperty(const std::string &propertyKey,
123  const std::string &contextName = "",
124  bool fallBackOnDefaultContext = true) const override;
125 
126  std::vector<std::string> GetPropertyKeys(const std::string &contextName = "",
127  bool includeDefaultContext = false) const override;
128 
129  std::vector<std::string> GetPropertyContextNames() const override;
130 
131  private:
132 
133  // For future implementation: load slice-by-slice, mark this using these methods
134  void SetSliceIsLoaded(unsigned int index, bool isLoaded);
135  // For future implementation: load slice-by-slice, mark this using these methods
136  bool IsSliceLoaded(unsigned int index) const;
137  // For future implementation: load slice-by-slice, mark this using these methods
138  bool AllSlicesAreLoaded() const;
139 
140  public:
141 
143  PixelSpacingInterpretation GetPixelSpacingInterpretation() const;
144 
146  void GetDesiredMITKImagePixelSpacing(ScalarType& spacingXinMM, ScalarType& spacingYinMM) const;
147 
149  void SetTiltInformation(const GantryTiltInformation& info);
151  const GantryTiltInformation GetTiltInformation() const;
152 
154  void SetSOPClassUID(const std::string& uid);
156  std::string GetSOPClassUID() const;
158  std::string GetSOPClassUIDAsName() const;
159 
161  int GetNumberOfTimeSteps() const;
163  int GetNumberOfFramesPerTimeStep() const;
164 
165  void SetTagCache(DICOMTagCache* privateCache);
166 
170  typedef std::map<DICOMTagPath, std::string> AdditionalTagsMapType;
182  void SetAdditionalTagsOfInterest(const AdditionalTagsMapType& tagMap);
183 
185 
196  void SetTagLookupTableToPropertyFunctor(TagLookupTableToPropertyFunctor);
197 
198 
200  void Print(std::ostream& os, bool filenameDetails) const;
201 
202  private:
203 
204  // read values from tag cache
205  std::string GetPixelSpacing() const;
206  std::string GetImagerPixelSpacing() const;
207 
208  Image::Pointer FixupSpacing(Image* mitkImage);
209  Image::Pointer DescribeImageWithProperties(Image* mitkImage);
210  void UpdateImageDescribingProperties() const;
211 
212  static mitk::BaseProperty::Pointer GetPropertyForDICOMValues(const DICOMCachedValueLookupTable& cacheLookupTable);
213 
214  double stringtodouble(const std::string& str) const;
215  DICOMImageFrameList m_ImageFrameList;
216 
217  Image::Pointer m_MitkImage;
218  BoolList m_SliceIsLoaded;
219  ReaderImplementationLevel m_ReaderImplementationLevel;
220 
221  GantryTiltInformation m_TiltInformation;
222 
223  PropertyList::Pointer m_PropertyList;
224 
226 
227  mutable bool m_PropertiesOutOfDate;
228 
229  AdditionalTagsMapType m_AdditionalTagMap;
230  std::set<std::string> m_FoundAdditionalTags;
231 
232  TagLookupTableToPropertyFunctor m_PropertyFunctor;
233  };
234 
235 }
236 
237 #endif
mitk::BaseProperty
Abstract base class for properties.
Definition: mitkBaseProperty.h:36
mitk::DICOMImageBlockDescriptor
Output descriptor for DICOMFileReader.
Definition: mitkDICOMImageBlockDescriptor.h:77
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:36
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:184
mitk::DICOMCachedValueLookupTable::Superclass
GenericLookupTable< DICOMCachedValueInfo > Superclass
Definition: mitkDICOMImageBlockDescriptor.h:44
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:35
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::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:45
mitk::DICOMTagList
std::vector< DICOMTag > DICOMTagList
Definition: mitkDICOMTag.h:59
mitk::DICOMCachedValueLookupTable::DICOMCachedValueLookupTable
DICOMCachedValueLookupTable()
Definition: mitkDICOMImageBlockDescriptor.h:50
mitk::DICOMCachedValueInfo
Definition: mitkDICOMImageBlockDescriptor.h:33
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:40
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:52
mitk::DICOMCachedValueLookupTable::operator=
Superclass & operator=(const Superclass &other) override
Definition: mitkDICOMImageBlockDescriptor.h:51
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:170
mitk::GenericLookupTable
Template class for generating lookup-tables.
Definition: mitkGenericLookupTable.h:30
mitk::WeakPointer
Definition: mitkWeakPointer.h:22
mitkProperties.h
mitk::DICOMCachedValueLookupTable::Self
DICOMCachedValueLookupTable Self
Definition: mitkDICOMImageBlockDescriptor.h:43
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20
mitk::DICOMCachedValueInfo::Value
std::string Value
Definition: mitkDICOMImageBlockDescriptor.h:37