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
mitkTestDCMLoading.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 mitkTestDCMLoading_h
17 #define mitkTestDCMLoading_h
18 
19 #include "mitkDicomSeriesReader.h"
20 
21 #include "MitkDCMTestingExports.h"
22 
23 namespace mitk
24 {
25  class Image;
26 
27  class MITKDCMTESTING_EXPORT TestDCMLoading
28  {
29  public:
31  typedef std::list<DataNode::Pointer> NodeList;
32  typedef std::list<itk::SmartPointer<Image>> ImageList;
33 
35 
36  ImageList LoadFiles(const StringContainer &files, itk::SmartPointer<Image> preLoadedVolume = nullptr);
37 
42  std::string DumpImageInformation(const Image *image);
43 
49  bool CompareImageInformationDumps(const std::string &reference, const std::string &test);
50 
51  private:
52  typedef std::map<std::string, std::string> KeyValueMap;
53 
54  void SetDefaultLocale();
55 
56  void ResetUserLocale();
57 
58  std::string ComponentTypeToString(int type);
59 
60  KeyValueMap ParseDump(const std::string &dump);
61 
62  bool CompareSpacedValueFields(const std::string &reference, const std::string &test, double eps = mitk::eps);
63 
70  std::string reduce(const std::string &pString,
71  const std::string &pFill = " ",
72  const std::string &pWhitespace = " \t");
73 
79  std::string trim(const std::string &pString, const std::string &pWhitespace = " \t");
80 
81  template <typename T>
82  bool StringToNumber(const std::string &s, T &value)
83  {
84  std::stringstream stream(s);
85  stream >> value;
86  return (!stream.fail()) && (fabs(value) < std::numeric_limits<T>::max());
87  }
88 
89  const char *m_PreviousCLocale;
90  std::locale m_PreviousCppLocale;
91  };
92 }
93 
94 #endif
Follow Up Storage - Class to facilitate loading/accessing structured follow-up data.
Definition: testcase.h:32
std::vector< std::string > StringContainer
Lists of filenames.
DataCollection - Class to facilitate loading/accessing structured data.
DicomSeriesReader::StringContainer StringContainer
class ITK_EXPORT Image
Image class for storing images.
Definition: mitkImage.h:76
static T max(T x, T y)
Definition: svm.cpp:70
MITKCORE_EXPORT const ScalarType eps
std::list< itk::SmartPointer< Image > > ImageList
std::list< DataNode::Pointer > NodeList