Medical Imaging Interaction Toolkit  2018.4.99-444716c4
Medical Imaging Interaction Toolkit
mitkTestDICOMLoading.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 #ifndef mitkTestDICOMLoading_h
13 #define mitkTestDICOMLoading_h
14 
16 #include "mitkPropertyKeyPath.h"
17 
19 
20 namespace mitk
21 {
22 
24 {
25  public:
26 
27  typedef std::list<Image::Pointer> ImageList;
28 
30 
31  ImageList
32  LoadFiles( const StringList & files );
33 
35  DecorateVerifyCachedImage( const StringList& files, mitk::Image::Pointer cachedImage );
36 
38  DecorateVerifyCachedImage( const StringList& files, DICOMTagCache*, mitk::Image::Pointer cachedImage );
39 
44  std::string
45  DumpImageInformation( const Image* image );
46 
52  bool
53  CompareImageInformationDumps( const std::string& reference,
54  const std::string& test );
55 
56  private:
57 
58  typedef std::map<std::string,std::string> KeyValueMap;
59 
60  ClassicDICOMSeriesReader::Pointer
61  BuildDICOMReader();
62 
63  void SetDefaultLocale();
64 
65  void ResetUserLocale();
66 
67  std::string ComponentTypeToString( int type );
68 
69  KeyValueMap ParseDump( const std::string& dump );
70 
71  bool CompareSpacedValueFields( const std::string& reference,
72  const std::string& test,
73  double eps = mitk::eps );
74 
81  std::string reduce(const std::string& pString,
82  const std::string& pFill = " ",
83  const std::string& pWhitespace = " \t");
84 
90  std::string trim(const std::string& pString,
91  const std::string& pWhitespace = " \t");
92 
93  template<typename T>
94  bool StringToNumber(const std::string& s, T& value)
95  {
96  std::stringstream stream(s);
97  stream >> value;
98  return (!stream.fail()) && (std::abs(value) <= std::numeric_limits<T>::max());
99  }
100 
101  static void AddPropertyToDump(const mitk::PropertyKeyPath& key, const mitk::Image* image, std::stringstream& result);
102 
103  const char* m_PreviousCLocale;
104  std::locale m_PreviousCppLocale;
105 
106 };
107 
108 }
109 
110 #endif
111 
MITKCORE_EXPORT const ScalarType eps
Follow Up Storage - Class to facilitate loading/accessing structured follow-up data.
Definition: testcase.h:28
DataCollection - Class to facilitate loading/accessing structured data.
std::list< Image::Pointer > ImageList
#define MITKDICOMTESTING_EXPORT
Image class for storing images.
Definition: mitkImage.h:72
std::vector< std::string > StringList
Class that can be used to specify nested or wild carded property keys. E.g. for the use in context of...