gdcmPrinter.h
Go to the documentation of this file.
/*=========================================================================
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 GDCMPRINTER_H
#define GDCMPRINTER_H
// TODO Class to implement printing
// Since DICOM does printing ?
// Also I would like to encapsulate the IsCharacterPrintable thing
// (to avoid printing \0 and other weird characters)
// \todo I still need to implement skipping of group (shadow)
// need to implement longer field to read
/*
* Output:
* For ASCII:
* Typically will look like:
* [ORIGINAL\PRIMARY\OTHER]
* If a non printable character is found: RED and INVERSE is used:
* [ .]
*
* when the VR is not found (file or dict), we check if we can print the output:
* on success ASCII mode is used, on failure the output is printed a series of bytes
*
* Special case when the data element is empty:
* INVERSE << (no value)
*
* retired public element are printed in red and underline
* unknown private element are printed in RED followed by 'UNKNOWN'
*
* Correct VR is printed in green just after the found VR
*
* length of data element is printed in bytes, followed by the VM, a green VM is appended
* if this is not compatible
*/
#include "gdcmFile.h"
#include "gdcmDataElement.h"
namespace gdcm
{
class DataSet;
class DictEntry;
class Dicts;
// It's a sink there is no output
class GDCM_EXPORT Printer
{
public:
Printer();
~Printer() = default;
void SetFile(File const &f) { F = &f; }
void SetColor(bool c);
typedef enum {
VERBOSE_STYLE = 0, // GDCM Legacy VERBOSE one
CONDENSED_STYLE, //
// Ok I am missing voc here ...better naming would be nice
XML, //
CXX
} PrintStyles;
void SetStyle(PrintStyles ps) {
PrintStyle = ps;
}
PrintStyles GetPrintStyle() const {
return PrintStyle;
}
void Print(std::ostream& os);
void PrintDataSet(const DataSet &ds, std::ostream& os, const std::string &s = "");
protected:
VR PrintDataElement(std::ostringstream & os, const Dicts &dicts, const DataSet & ds, const DataElement &de, std::ostream &out, std::string const & indent );
void PrintSQ(const SequenceOfItems *sqi, std::ostream & os, std::string const & indent);
PrintStyles PrintStyle;
const File *F;
VL MaxPrintLength;
};
} // end namespace gdcm
#endif //GDCMPRINTER_H
gdcm::DataElement
Class to represent a Data Element either Implicit or Explicit.
Definition gdcmDataElement.h:59
gdcm::DataSet
Class to represent a Data Set (which contains Data Elements).
Definition gdcmDataSet.h:56
gdcm::DictEntry
Class to represent an Entry in the Dict.
Definition gdcmDictEntry.h:37
gdcm::Dicts
Class to manipulate the sum of knowledge (all the dict user load).
Definition gdcmDicts.h:29
gdcm::File
a DICOM File
Definition gdcmFile.h:34
gdcm::Printer::SetStyle
void SetStyle(PrintStyles ps)
Set PrintStyle value.
Definition gdcmPrinter.h:80
gdcm::Printer::F
const File * F
Definition gdcmPrinter.h:99
gdcm::Printer::PrintStyles
PrintStyles
Definition gdcmPrinter.h:71
gdcm::Printer::CONDENSED_STYLE
@ CONDENSED_STYLE
Definition gdcmPrinter.h:73
gdcm::Printer::VERBOSE_STYLE
@ VERBOSE_STYLE
Definition gdcmPrinter.h:72
gdcm::Printer::XML
@ XML
Definition gdcmPrinter.h:75
gdcm::Printer::CXX
@ CXX
Definition gdcmPrinter.h:76
gdcm::Printer::MaxPrintLength
VL MaxPrintLength
Definition gdcmPrinter.h:100
gdcm::Printer::Print
void Print(std::ostream &os)
Print.
gdcm::Printer::SetFile
void SetFile(File const &f)
Set file.
Definition gdcmPrinter.h:66
gdcm::Printer::PrintDataElement
VR PrintDataElement(std::ostringstream &os, const Dicts &dicts, const DataSet &ds, const DataElement &de, std::ostream &out, std::string const &indent)
gdcm::Printer::PrintSQ
void PrintSQ(const SequenceOfItems *sqi, std::ostream &os, std::string const &indent)
gdcm::Printer::~Printer
~Printer()=default
gdcm::Printer::GetPrintStyle
PrintStyles GetPrintStyle() const
Get PrintStyle value.
Definition gdcmPrinter.h:84
gdcm::Printer::SetColor
void SetColor(bool c)
Set color mode or not.
gdcm::Printer::PrintStyle
PrintStyles PrintStyle
Definition gdcmPrinter.h:98
gdcm::Printer::Printer
Printer()
gdcm::Printer::PrintDataSet
void PrintDataSet(const DataSet &ds, std::ostream &os, const std::string &s="")
Print an individual dataset.
gdcm::SequenceOfItems
Class to represent a Sequence Of Items.
Definition gdcmSequenceOfItems.h:40
gdcm::VL
Value Length.
Definition gdcmVL.h:30
gdcm::VR
VR class.
Definition gdcmVR.h:55
gdcmDataElement.h
gdcmFile.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21