Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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,
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 #ifndef mitkTestDICOMLoading_h
17 #define mitkTestDICOMLoading_h
18 
20 
21 #include "MitkDICOMTestingExports.h"
22 
23 namespace mitk
24 {
25 
26 class MITKDICOMTESTING_EXPORT TestDICOMLoading
27 {
28  public:
29 
30  typedef std::list<Image::Pointer> ImageList;
31 
33 
34  ImageList
35  LoadFiles( const StringList & files );
36 
38  DecorateVerifyCachedImage( const StringList& files, mitk::Image::Pointer cachedImage );
39 
41  DecorateVerifyCachedImage( const StringList& files, DICOMTagCache*, mitk::Image::Pointer cachedImage );
42 
47  std::string
48  DumpImageInformation( const Image* image );
49 
55  bool
56  CompareImageInformationDumps( const std::string& reference,
57  const std::string& test );
58 
59  private:
60 
61  typedef std::map<std::string,std::string> KeyValueMap;
62 
64  BuildDICOMReader();
65 
66  void SetDefaultLocale();
67 
68  void ResetUserLocale();
69 
70  std::string ComponentTypeToString( int type );
71 
72  KeyValueMap ParseDump( const std::string& dump );
73 
74  bool CompareSpacedValueFields( const std::string& reference,
75  const std::string& test,
76  double eps = mitk::eps );
77 
84  std::string reduce(const std::string& pString,
85  const std::string& pFill = " ",
86  const std::string& pWhitespace = " \t");
87 
93  std::string trim(const std::string& pString,
94  const std::string& pWhitespace = " \t");
95 
96  template<typename T>
97  bool StringToNumber(const std::string& s, T& value)
98  {
99  std::stringstream stream(s);
100  stream >> value;
101  return (!stream.fail()) && (std::abs(value) <= std::numeric_limits<T>::max());
102  }
103 
104  const char* m_PreviousCLocale;
105  std::locale m_PreviousCppLocale;
106 
107 };
108 
109 }
110 
111 #endif
112 
itk::SmartPointer< Self > Pointer
Follow Up Storage - Class to facilitate loading/accessing structured follow-up data.
Definition: testcase.h:32
DataCollection - Class to facilitate loading/accessing structured data.
std::list< Image::Pointer > ImageList
Image class for storing images.
Definition: mitkImage.h:76
static T max(T x, T y)
Definition: svm.cpp:70
std::vector< std::string > StringList
MITKCORE_EXPORT const ScalarType eps