Medical Imaging Interaction Toolkit  2023.12.00
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 
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 
75  bool CompareJSON( const std::string& reference,
76  const std::string& test );
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  static void AddPropertyToDump(const mitk::PropertyKeyPath& key, const mitk::Image* image, std::stringstream& result);
105 
106  const char* m_PreviousCLocale;
107  std::locale m_PreviousCppLocale;
108 
109 };
110 
111 }
112 
113 #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 >
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
Find image slices visible on a given plane.
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