Medical Imaging Interaction Toolkit  2023.04.00
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 (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 
18 #include "MitkDICOMTestingExports.h"
19 
20 namespace mitk
21 {
22 
23 class MITKDICOMTESTING_EXPORT TestDICOMLoading
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( itk::IOComponentEnum 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
mitk::eps
const MITKCORE_EXPORT ScalarType eps
mitk::Image
Image class for storing images.
Definition: mitkImage.h:69
mitk::TestDICOMLoading
Definition: mitkTestDICOMLoading.h:23
itk::SmartPointer< Self >
test
Follow Up Storage - Class to facilitate loading/accessing structured follow-up data.
Definition: testcase.h:28
mitk::PropertyKeyPath
Class that can be used to specify nested or wild carded property keys. E.g. for the use in context of...
Definition: mitkPropertyKeyPath.h:51
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitkClassicDICOMSeriesReader.h
mitkPropertyKeyPath.h
mitk::TestDICOMLoading::ImageList
std::list< Image::Pointer > ImageList
Definition: mitkTestDICOMLoading.h:27
mitk::DICOMTagCache
...
Definition: mitkDICOMTagCache.h:33
mitk::StringList
std::vector< std::string > StringList
Definition: mitkDICOMEnums.h:22