GDCM  2.4.5
gdcmPrinter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: GDCM (Grassroots DICOM). A DICOM library
4 
5  Copyright (c) 2006-2011 Mathieu Malaterre
6  All rights reserved.
7  See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 #ifndef GDCMPRINTER_H
15 #define GDCMPRINTER_H
16 
17 // TODO Class to implement printing
18 // Since DICOM does printing ?
19 // Also I would like to encapsulate the IsCharacterPrintable thing
20 // (to avoid printing \0 and other weird characters)
21 // \todo I still need to implement skiping of group (shadow)
22 // need to implement longer field to read
23 
24 /*
25  * Output:
26  * For ASCII:
27  * Typically will look like:
28  * [ORIGINAL\PRIMARY\OTHER]
29  * If a non printable character is found: RED and INVERSE is used:
30  * [ .]
31  *
32  * when the VR is not found (file or dict), we check if we can print the output:
33  * on success ASCII mode is used, on failure the output is printed a series of bytes
34  *
35  * Special case when the data element is empty:
36  * INVERSE << (no value)
37  *
38  * retired public element are printed in red and underline
39  * unknown private element are printed in RED followed by 'UNKNOWN'
40  *
41  * Correct VR is printed in green just after the found VR
42  *
43  * length of data element is printed in bytes, followed by the VM, a green VM is appended
44  * if this is not compatible
45  */
46 #include "gdcmFile.h"
47 #include "gdcmDataElement.h"
48 
49 namespace gdcm
50 {
51 
52 class DataSet;
53 class DictEntry;
54 class Dicts;
58 // It's a sink there is no output
60 {
61 public:
62  Printer();
63  ~Printer();
64 
66  void SetFile(File const &f) { F = &f; }
67 
69  void SetColor(bool c);
70 
71  typedef enum {
72  VERBOSE_STYLE = 0, // GDCM Legacy VERBOSE one
74  // Ok I am missing voc here ...better naming would be nice
75  XML // sure why not
76  } PrintStyles;
77 
79  void SetStyle(PrintStyles ps) {
80  PrintStyle = ps;
81  }
84  return PrintStyle;
85  }
86 
88  void Print(std::ostream& os);
89 
91  void PrintDataSet(const DataSet &ds, std::ostream& os, const std::string &s = "");
92 
93 protected:
94  VR PrintDataElement(std::ostringstream & os, const Dicts &dicts, const DataSet & ds, const DataElement &de, std::ostream &out, std::string const & indent );
95 void PrintSQ(const SequenceOfItems *sqi, std::ostream & os, std::string const & indent);
96 
98  const File *F;
100 };
101 
102 } // end namespace gdcm
103 
104 #endif //GDCMPRINTER_H
Class to represent a Data Set (which contains Data Elements) A Data Set represents an instance of a r...
Definition: gdcmDataSet.h:55
PrintStyles
Definition: gdcmPrinter.h:71
void SetFile(File const &f)
Set file.
Definition: gdcmPrinter.h:66
Class to represent a Sequence Of Items (value representation : SQ)
Definition: gdcmSequenceOfItems.h:39
VL MaxPrintLength
Definition: gdcmPrinter.h:99
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
Definition: gdcmPrinter.h:73
Value Length.
Definition: gdcmVL.h:29
PrintStyles GetPrintStyle() const
Get PrintStyle value.
Definition: gdcmPrinter.h:83
Class to represent a Data Element either Implicit or Explicit.
Definition: gdcmDataElement.h:58
const File * F
Definition: gdcmPrinter.h:98
PrintStyles PrintStyle
Definition: gdcmPrinter.h:97
a DICOM File See PS 3.10 File: A File is an ordered string of zero or more bytes, where the first byt...
Definition: gdcmFile.h:33
Printer class.
Definition: gdcmPrinter.h:59
Class to manipulate the sum of knowledge (all the dict user load)
Definition: gdcmDicts.h:28
VR class This is adapted from DICOM standard The biggest difference is the INVALID VR and the composi...
Definition: gdcmVR.h:54
Definition: gdcmASN1.h:20
void SetStyle(PrintStyles ps)
Set PrintStyle value.
Definition: gdcmPrinter.h:79

Generated on Fri Sep 25 2015 17:58:23 for GDCM by doxygen 1.8.9.1
SourceForge.net Logo