GDCM  2.0.18
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 
00065   void SetFile(File const &f) { F = &f; }
00066 
00067   void SetColor(bool c);
00068 
00069   typedef enum {
00070     VERBOSE_STYLE = 0, // GDCM Legacy VERBOSE one
00071     CONDENSED_STYLE, //
00072     // Ok I am missing voc here ...better naming would be nice
00073     XML // sure why not
00074   } PrintStyles;
00075 
00076   void SetStyle(PrintStyles ps) {
00077     PrintStyle = ps;
00078   }
00079   PrintStyles GetPrintStyle() const {
00080     return PrintStyle;
00081     }
00082 
00083   void Print(std::ostream& os);
00084 
00085   //now no longer protected so that individual datasets can be printed directly
00086   //as per bug #131 in trac.
00087   //12 jan 2011 mmr
00088   void PrintDataSet(const DataSet &ds, std::ostream& os, const std::string &s = "");
00089 
00090 protected:
00091   void PrintDataSetOld(std::ostream &os, const DataSet &ds);
00092   void PrintElement(std::ostream& os, const DataElement &xde, const DictEntry &entry);
00093   VR PrintDataElement(std::ostringstream & os, const Dicts &dicts, const DataSet & ds, const DataElement &de, std::ostream &out, std::string const & indent );
00094 void PrintSQ(const SequenceOfItems *sqi, std::ostream & os, std::string const & indent);
00095 
00096   PrintStyles PrintStyle;
00097   const File *F;
00098   VL MaxPrintLength;
00099 };
00100 
00101 } // end namespace gdcm
00102 
00103 #endif //GDCMPRINTER_H

Generated on Tue Dec 6 2011 20:36:27 for GDCM by doxygen 1.7.5.1
SourceForge.net Logo