📄 dcobject.h
字号:
/* * * Copyright (C) 1994-2005, OFFIS * * This software and supporting documentation were developed by * * Kuratorium OFFIS e.V. * Healthcare Information and Communication Systems * Escherweg 2 * D-26121 Oldenburg, Germany * * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. * * Module: dcmdata * * Author: Gerd Ehlers * * Purpose: * This file contains the interface to routines which provide * DICOM object encoding/decoding, search and lookup facilities. * * Last Update: $Author: meichel $ * Update Date: $Date: 2005/12/08 16:28:22 $ * CVS/RCS Revision: $Revision: 1.41 $ * Status: $State: Exp $ * * CVS/RCS Log at end of file * */#ifndef DCOBJECT_H#define DCOBJECT_H#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */#include "dcmtk/ofstd/ofconsol.h"#include "dcmtk/ofstd/ofglobal.h"#include "dcmtk/dcmdata/dcerror.h"#include "dcmtk/dcmdata/dctypes.h"#include "dcmtk/dcmdata/dcxfer.h"#include "dcmtk/dcmdata/dctag.h"#include "dcmtk/dcmdata/dclist.h"#include "dcmtk/dcmdata/dcstack.h"// forward declarationsclass DcmOutputStream;class DcmInputStream;// Undefined Length Identifier now defined in dctypes.h// Maxinum number of read bytes for a Value Elementconst Uint32 DCM_MaxReadLength = 4096;// Maximum length of tag and length in a DICOM elementconst Uint32 DCM_TagInfoLength = 12;// Optimum line length if not all data printedconst Uint32 DCM_OptPrintLineLength = 70;// Optimum value length if not all data printedconst Uint32 DCM_OptPrintValueLength = 40;/** This flags defines whether automatic correction should be applied to input * data (e.g. stripping of padding blanks, removal of blanks in UIDs, etc). * Default is enabled. */extern OFGlobal<OFBool> dcmEnableAutomaticInputDataCorrection; /* default OFTrue *//** This flag defines the handling of illegal odd-length attributes: If flag is * true, odd lengths are respected (i.e. an odd number of bytes is read from * the input stream.) After successful reading, padding to even number of bytes * is enforced by adding a zero pad byte if dcmEnableAutomaticInputDataCorrection * is true. Otherwise the odd number of bytes remains as read. * * If flag is false, old (pre DCMTK 3.5.2) behaviour applies: The length field * implicitly incremented and an even number of bytes is read from the stream. */extern OFGlobal<OFBool> dcmAcceptOddAttributeLength; /* default OFTrue *//** This flag defines how UN attributes with undefined length are treated * by the parser when reading. The default is to expect the content of the * UN element (up to and including the sequence delimitation item) * to be encoded in Implicit VR Little Endian, as described in CP 246. * DCMTK expects the attribute to be encoded like a DICOM sequence, i.e. * the content of each item is parsed as a DICOM dataset. * If the flag is disabled old (pre DCMTK 3.5.4) behaviour applies: The * attribute is treated as if it was an Explicit VR SQ element. * * Note that the flag only affects the read behaviour but not the write * behaviour - DCMTK will never write UN elements with undefined length. */extern OFGlobal<OFBool> dcmEnableCP246Support; /* default OFTrue *//** DCMTK releases up to 3.5.3 created a non-conforming byte stream * as input to the MAC algorithm when creating or verifying digital signatures * including compressed pixel data (i.e. signatures including attribute * (7FE0,0010) in an encapsulated transfer syntax). This has been fixed * in DCMTK 3.5.4, but this flag allows to revert to the old behavior * in order to create or verify signatures that are compatible with older * releases. Default is "off" (OFFalse). */extern OFGlobal<OFBool> dcmEnableOldSignatureFormat; /* default OFFalse *//** This flag defines whether the transfer syntax for uncompressed datasets * is detected automatically. The automatic detection has been introduced * since there are (incorrectly encoded) DICOM dataset stored with a * different transfer syntax than specified in the meta header. */extern OFGlobal<OFBool> dcmAutoDetectDatasetXfer; /* default OFFalse *//** base class for all DICOM objects defined in 'dcmdata' */class DcmObject{ public: /** constructor. * Create new object from given tag and length. * @param tag DICOM tag for the new element * @param len value length for the new element */ DcmObject(const DcmTag &tag, const Uint32 len = 0); /** copy constructor * @param obj item to be copied */ DcmObject(const DcmObject &obj); /** destructor */ virtual ~DcmObject(); /** clone method * @return deep copy of this object */ virtual DcmObject *clone() const = 0; /** assignment operator * @param obj object to be assigned/copied * @return reference to this object */ DcmObject &operator=(const DcmObject &obj); /** get type identifier (abstract) * @return type identifier of this class */ virtual DcmEVR ident() const = 0; // current value representation. If object was read from a stream // getVR returns the read value representation. It is possible that // this vr is not the same as mentioned in the data dictionary // (e.g. private tags, encapsulated data ...) inline DcmEVR getVR() const { return Tag.getEVR(); } inline OFBool isaString() const { return Tag.getVR().isaString(); } virtual OFBool isLeaf() const = 0; /** print object to a stream * @param out output stream * @param flags optional flag used to customize the output (see DCMTypes::PF_xxx) * @param level current level of nested items. Used for indentation. * @param pixelFileName not used * @param pixelCounter not used */ virtual void print(ostream &out, const size_t flags = 0, const int level = 0, const char *pixelFileName = NULL, size_t *pixelCounter = NULL) = 0; inline OFCondition error() const { return errorFlag; } inline E_TransferState transferState() const { return fTransferState; } virtual void transferInit(void); virtual void transferEnd(void); inline Uint16 getGTag() const { return Tag.getGTag(); } inline Uint16 getETag() const { return Tag.getETag(); } inline const DcmTag &getTag() const { return Tag; } inline void setGTag(Uint16 gtag) { Tag.setGroup(gtag); } virtual OFCondition setVR(DcmEVR /*vr*/) { return EC_IllegalCall; } virtual unsigned long getVM() = 0; // calculate length of Dicom element virtual Uint32 calcElementLength(const E_TransferSyntax xfer, const E_EncodingType enctype) = 0; // returns value length virtual Uint32 getLength(const E_TransferSyntax xfer = EXS_LittleEndianImplicit, const E_EncodingType enctype = EET_UndefinedLength) = 0; virtual OFBool canWriteXfer(const E_TransferSyntax newXfer, const E_TransferSyntax oldXfer) = 0; virtual OFCondition read(DcmInputStream &inStream, const E_TransferSyntax ixfer, const E_GrpLenEncoding glenc = EGL_noChange, const Uint32 maxReadLength = DCM_MaxReadLength) = 0; /** write object to a stream (abstract) * @param outStream DICOM output stream * @param oxfer output transfer syntax * @param enctype encoding types (undefined or explicit length) * @return status, EC_Normal if successful, an error code otherwise */ virtual OFCondition write(DcmOutputStream &outStream, const E_TransferSyntax oxfer, const E_EncodingType enctype = EET_UndefinedLength) = 0; /** write object in XML format to a stream * @param out output stream to which the XML document is written * @param flags optional flag used to customize the output (see DCMTypes::XF_xxx) * @return status, always returns EC_Illegal Call */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -