GDCM  2.2.0
gdcmPrinter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program: GDCM (Grassroots DICOM). A DICOM library
00004 
00005   Copyright (c) 2006-2011 Mathieu Malaterre
00006   All rights reserved.
00007   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE.  See the above copyright notice for more information.
00012 
00013 =========================================================================*/
00014 #ifndef GDCMPRINTER_H
00015 #define GDCMPRINTER_H
00016 
00017 // TODO Class to implement printing
00018 // Since DICOM does printing ?
00019 // Also I would like to encapsulate the IsCharacterPrintable thing
00020 // (to avoid printing \0 and other weird characters)
00021 // \todo I still need to implement skiping of group (shadow)
00022 // need to implement longer field to read
00023 
00024 /*
00025  * Output:
00026  * For ASCII:
00027  * Typically will look like:
00028  * [ORIGINAL\PRIMARY\OTHER]
00029  * If a non printable character is found: RED and INVERSE is used:
00030  * [                .]
00031  *
00032  * when the VR is not found (file or dict), we check if we can print the output:
00033  * on success ASCII mode is used, on failure the output is printed a series of bytes
00034  *
00035  * Special case when the data element is empty:
00036  * INVERSE << (no value)
00037  *
00038  * retired public element are printed in red and underline
00039  * unknown private element are printed in RED followed by 'UNKNOWN'
00040  *
00041  * Correct VR is printed in green just after the found VR
00042  *
00043  * length of data element is printed in bytes, followed by the VM, a green VM is appended
00044  * if this is not compatible
00045  */
00046 #include "gdcmFile.h"
00047 #include "gdcmDataElement.h"
00048 
00049 namespace gdcm
00050 {
00051 
00052 class DataSet;
00053 class DictEntry;
00054 class Dicts;
00058 // It's a sink there is no output
00059 class GDCM_EXPORT Printer
00060 {
00061 public:
00062   Printer();
00063   ~Printer();
00064 
00066   void SetFile(File const &f) { F = &f; }
00067 
00069   void SetColor(bool c);
00070 
00071   typedef enum {
00072     VERBOSE_STYLE = 0, // GDCM Legacy VERBOSE one
00073     CONDENSED_STYLE, //
00074     // Ok I am missing voc here ...better naming would be nice
00075     XML // sure why not
00076   } PrintStyles;
00077 
00079   void SetStyle(PrintStyles ps) {
00080     PrintStyle = ps;
00081   }
00083   PrintStyles GetPrintStyle() const {
00084     return PrintStyle;
00085     }
00086 
00088   void Print(std::ostream& os);
00089 
00091   void PrintDataSet(const DataSet &ds, std::ostream& os, const std::string &s = "");
00092 
00093 protected:
00094   VR PrintDataElement(std::ostringstream & os, const Dicts &dicts, const DataSet & ds, const DataElement &de, std::ostream &out, std::string const & indent );
00095 void PrintSQ(const SequenceOfItems *sqi, std::ostream & os, std::string const & indent);
00096 
00097   PrintStyles PrintStyle;
00098   const File *F;
00099   VL MaxPrintLength;
00100 };
00101 
00102 } // end namespace gdcm
00103 
00104 #endif //GDCMPRINTER_H

Generated on Fri Mar 30 2012 12:44:05 for GDCM by doxygen 1.8.0
SourceForge.net Logo