File: gdcmTesting.h

package info (click to toggle)
gdcm 2.4.4-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 32,868 kB
  • sloc: cpp: 188,481; ansic: 124,526; xml: 41,799; sh: 7,162; python: 3,667; cs: 2,128; java: 1,344; lex: 1,290; tcl: 677; php: 128; makefile: 116
file content (119 lines) | stat: -rw-r--r-- 4,495 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*=========================================================================

  Program: GDCM (Grassroots DICOM). A DICOM library

  Copyright (c) 2006-2011 Mathieu Malaterre
  All rights reserved.
  See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
#ifndef GDCMTESTING_H
#define GDCMTESTING_H

#include "gdcmTypes.h"

#include <iostream>

namespace gdcm
{
/**
 * \brief class for testing
 * \details this class is used for the nightly regression system for GDCM
 * It makes heavily use of md5 computation
 *
 * \see gdcm::MD5 class for md5 computation
 */
//-----------------------------------------------------------------------------
class GDCM_EXPORT Testing
{
public :
  Testing() {};
  ~Testing() {};

  /// MD5 stuff
  /// digest_str needs to be at least : strlen = [2*16+1];
  /// string will be \0 padded. (md5 are 32 bytes long)
  /// Testing is not meant to be shipped with an installed GDCM release, always
  /// prefer the gdcm::MD5 API when doing md5 computation.
  static bool ComputeMD5(const char *buffer, unsigned long buf_len,
    char digest_str[33]);
  static bool ComputeFileMD5(const char *filename, char digest_str[33]);

  /// Print
  void Print(std::ostream &os = std::cout);

  /// return the table of fullpath to gdcmData DICOM files:
  static const char * const * GetFileNames();
  static unsigned int GetNumberOfFileNames();
  static const char * GetFileName(unsigned int file);

  /// return the table that map the media storage (as string) of a filename (gdcmData)
  typedef const char* const (*MediaStorageDataFilesType)[2];
  static MediaStorageDataFilesType GetMediaStorageDataFiles();
  static unsigned int GetNumberOfMediaStorageDataFiles();
  static const char * const * GetMediaStorageDataFile(unsigned int file);
  static const char * GetMediaStorageFromFile(const char *filepath);

  /// return the table that map the md5 (as in md5sum) of the Pixel Data associated
  /// to a filename
  typedef const char* const (*MD5DataImagesType)[2];
  static MD5DataImagesType GetMD5DataImages();
  static unsigned int GetNumberOfMD5DataImages();
  static const char * const * GetMD5DataImage(unsigned int file);
  static const char * GetMD5FromFile(const char *filepath);

  /// Return what should have been the md5 of file 'filepath'
  /// This is based on current GDCM implementation to decipher a broken DICOM file.
  static const char * GetMD5FromBrokenFile(const char *filepath);

  /// Return the offset of the very first pixel cell in the PixelData
  /// -1 if not found
  static std::streamoff GetStreamOffsetFromFile(const char *filepath);

  /// Return the offset just after Pixel Data Length (7fe0,0000) if found.
  /// Otherwise the offset of the very first pixel cell in Pixel Data
  /// -1 if not found
  static std::streamoff GetSelectedTagsOffsetFromFile(const char *filepath);

  /// Return the offset just after private attribute (0009,0010,"GEMS_IDEN_01") if found.
  /// Otherwise the offset of the next attribute
  /// -1 if not found
  static std::streamoff GetSelectedPrivateGroupOffsetFromFile(const char *filepath);

  /// Return the lossy flag of the given filename
  /// -1 -> Error
  ///  0 -> Lossless
  ///  1 -> Lossy
  static int GetLossyFlagFromFile(const char *filepath);

  /// Return the GDCM DATA ROOT
  static const char * GetDataRoot();

  /// Return the GDCM DATA EXTRA ROOT
  static const char * GetDataExtraRoot();

  /// Return the GDCM PIXEL SPACING DATA ROOT (See David Clunie website for dataset)
  static const char * GetPixelSpacingDataRoot();

  /// NOT THREAD SAFE
  /// Returns the temp directory as used in testing needing to output data:
  static const char * GetTempDirectory(const char * subdir = 0);

  /// NOT THREAD SAFE
  static const wchar_t *GetTempDirectoryW(const wchar_t * subdir = 0);

  /// NOT THREAD SAFE
  static const char * GetTempFilename(const char *filename, const char * subdir = 0);

  /// NOT THREAD SAFE
  static const wchar_t* GetTempFilenameW(const wchar_t *filename, const wchar_t* subdir = 0);

  static const char *GetSourceDirectory();
};
} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif //GDCMTESTING_H