Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef mitkDICOMImageBlockDescriptor_h
18 #define mitkDICOMImageBlockDescriptor_h
19 
20 #include "mitkDICOMEnums.h"
22 #include "mitkDICOMTag.h"
23 #include "mitkDICOMTagCache.h"
24 
25 #include "mitkImage.h"
26 #include "mitkProperties.h"
27 #include "mitkWeakPointer.h"
28 
30 
31 #include <unordered_map>
32 
33 namespace mitk
34 {
35 
37  {
38  unsigned int TimePoint;
39  unsigned int SliceInTimePoint;
40  std::string Value;
41  };
42 
43  class DICOMCachedValueLookupTable : public GenericLookupTable< DICOMCachedValueInfo >
44  {
45  public:
48  virtual const char *GetNameOfClass() const
49  {
50  return "DICOMCachedValueLookupTable";
51  }
52 
54  virtual Superclass& operator=(const Superclass& other) { return Superclass::operator=(other); }
56  };
57 
81  {
82  public:
83 
86 
89 
90  static DICOMTagList GetTagsOfInterest();
91 
93  void SetImageFrameList(const DICOMImageFrameList& framelist);
95  const DICOMImageFrameList& GetImageFrameList() const;
96 
98  void SetMitkImage(Image::Pointer image);
100  Image::Pointer GetMitkImage() const;
101 
103  ReaderImplementationLevel GetReaderImplementationLevel() const;
105  void SetReaderImplementationLevel(const ReaderImplementationLevel& level);
106 
108  void SetProperty(const std::string& key, BaseProperty* value);
110  BaseProperty* GetProperty(const std::string& key) const;
111 
113  std::string GetPropertyAsString(const std::string&) const;
114 
116  void SetFlag(const std::string& key, bool value);
118  bool GetFlag(const std::string& key, bool defaultValue) const;
119 
121  void SetIntProperty(const std::string& key, int value);
123  int GetIntProperty(const std::string& key, int defaultValue) const;
124 
125  private:
126 
127  // For future implementation: load slice-by-slice, mark this using these methods
128  void SetSliceIsLoaded(unsigned int index, bool isLoaded);
129  // For future implementation: load slice-by-slice, mark this using these methods
130  bool IsSliceLoaded(unsigned int index) const;
131  // For future implementation: load slice-by-slice, mark this using these methods
132  bool AllSlicesAreLoaded() const;
133 
134  public:
135 
137  PixelSpacingInterpretation GetPixelSpacingInterpretation() const;
138 
140  void GetDesiredMITKImagePixelSpacing(ScalarType& spacingXinMM, ScalarType& spacingYinMM) const;
141 
143  void SetTiltInformation(const GantryTiltInformation& info);
145  const GantryTiltInformation GetTiltInformation() const;
146 
148  void SetSOPClassUID(const std::string& uid);
150  std::string GetSOPClassUID() const;
152  std::string GetSOPClassUIDAsName() const;
153 
155  int GetNumberOfTimeSteps() const;
157  int GetNumberOfFramesPerTimeStep() const;
158 
159  void SetTagCache(DICOMTagCache* privateCache);
160 
164  typedef std::map<DICOMTagPath, std::string> AdditionalTagsMapType;
176  void SetAdditionalTagsOfInterest(const AdditionalTagsMapType& tagMap);
177 
178  typedef std::function<mitk::BaseProperty::Pointer(const DICOMCachedValueLookupTable&) > TagLookupTableToPropertyFunctor;
179 
190  void SetTagLookupTableToPropertyFunctor(TagLookupTableToPropertyFunctor);
191 
192 
194  void Print(std::ostream& os, bool filenameDetails) const;
195 
196  private:
197 
198  // read values from tag cache
199  std::string GetPixelSpacing() const;
200  std::string GetImagerPixelSpacing() const;
201 
202  Image::Pointer FixupSpacing(Image* mitkImage);
203  Image::Pointer DescribeImageWithProperties(Image* mitkImage);
204  void UpdateImageDescribingProperties() const;
205 
206  static mitk::BaseProperty::Pointer GetPropertyForDICOMValues(const DICOMCachedValueLookupTable& cacheLookupTable);
207 
208  double stringtodouble(const std::string& str) const;
209  DICOMImageFrameList m_ImageFrameList;
210 
211  Image::Pointer m_MitkImage;
212  BoolList m_SliceIsLoaded;
213  ReaderImplementationLevel m_ReaderImplementationLevel;
214 
215  GantryTiltInformation m_TiltInformation;
216 
217  PropertyList::Pointer m_PropertyList;
218 
220 
221  mutable bool m_PropertiesOutOfDate;
222 
223  AdditionalTagsMapType m_AdditionalTagMap;
224  std::set<std::string> m_FoundAdditionalTags;
225 
226  TagLookupTableToPropertyFunctor m_PropertyFunctor;
227  };
228 
229 }
230 
231 #endif
virtual Superclass & operator=(const Superclass &other)
double ScalarType
std::vector< DICOMTag > DICOMTagList
Definition: mitkDICOMTag.h:64
#define MITKDICOMREADER_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
GenericLookupTable< DICOMCachedValueInfo > Superclass
virtual const char * GetNameOfClass() const
std::map< DICOMTagPath, std::string > AdditionalTagsMapType
Template class for generating lookup-tables.
static void info(const char *fmt,...)
Definition: svm.cpp:100
std::function< mitk::BaseProperty::Pointer(const DICOMCachedValueLookupTable &) > TagLookupTableToPropertyFunctor
ReaderImplementationLevel
Describes how well the reader is tested for a certain file type (see mitk::DICOMFileReader).
PixelSpacingInterpretation
How the mitk::Image spacing should be interpreted (see mitk::DICOMFileReader).
Abstract base class for properties.
std::vector< DICOMImageFrameInfo::Pointer > DICOMImageFrameList
Image class for storing images.
Definition: mitkImage.h:76
Output descriptor for DICOMFileReader.
Implements a weak reference to an object.
Gantry tilt analysis result.
std::vector< bool > BoolList