⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dcitem.h

📁 转化为DIB位图再显示出来的dicom文件C++代码
💻 H
📖 第 1 页 / 共 4 页
字号:
/* * *  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: Interface of class DcmItem * *  Last Update:      $Author: meichel $ *  Update Date:      $Date: 2005/12/08 16:28:19 $ *  CVS/RCS Revision: $Revision: 1.53 $ *  Status:           $State: Exp $ * *  CVS/RCS Log at end of file * */#ifndef DCITEM_H#define DCITEM_H#include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */#include "dcmtk/ofstd/ofconsol.h"#include "dcmtk/dcmdata/dctypes.h"#include "dcmtk/dcmdata/dcobject.h"#include "dcmtk/dcmdata/dcvrui.h"#include "dcmtk/dcmdata/dclist.h"#include "dcmtk/dcmdata/dcstack.h"#include "dcmtk/dcmdata/dcpcache.h"// forward declarationclass DcmSequenceOfItems;/** a class representing a collection of DICOM elements */class DcmItem  : public DcmObject{  public:    /** default constructor     */    DcmItem();    /** constructor.     *  Create new item from given tag and length.     *  @param tag DICOM tag for the new element     *  @param len value length for the new element     */    DcmItem(const DcmTag &tag,            const Uint32 len = 0);    /** copy constructor     *  @param old item to be copied     */    DcmItem(const DcmItem &old);    /** destructor     */    virtual ~DcmItem();    /** clone method     *  @return deep copy of this object     */    virtual DcmObject *clone() const    {      return new DcmItem(*this);    }    /** get type identifier     *  @return type identifier of this class (EVR_item)     */    virtual DcmEVR ident() const;    /** get value multiplicity     *  @return always returns 1 (according to the DICOM standard)     */    virtual unsigned long getVM();    virtual unsigned long card() const;    virtual OFBool isLeaf() const { return OFFalse; }    /** print all elements of the item 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);    virtual Uint32 calcElementLength(const E_TransferSyntax xfer,                                     const E_EncodingType enctype);    virtual Uint32 getLength(const E_TransferSyntax xfer = EXS_LittleEndianImplicit,                             const E_EncodingType enctype = EET_UndefinedLength);    virtual void transferInit();    virtual void transferEnd();    virtual OFBool canWriteXfer(const E_TransferSyntax newXfer,                                const E_TransferSyntax oldXfer);    /** This function reads the information of all attributes which     *  are captured in the input stream and captures this information     *  in elementList. Each attribute is represented as an element     *  in this list. If not all information for an attribute could be     *  read from the stream, the function returns EC_StreamNotifyClient.     *  @param inStream      The stream which contains the information.     *  @param ixfer         The transfer syntax which was used to encode     *                       the information in inStream.     *  @param glenc         Encoding type for group length; specifies     *                       what will be done with group length tags.     *  @param maxReadLength Maximum read length for reading an attribute value.     *  @return status, EC_Normal if successful, an error code otherwise     */    virtual OFCondition read(DcmInputStream &inStream,                             const E_TransferSyntax ixfer,                             const E_GrpLenEncoding glenc = EGL_noChange,                             const Uint32 maxReadLength = DCM_MaxReadLength);    /** write object to a stream     *  @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);    /** write object in XML format     *  @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, EC_Normal if successful, an error code otherwise     */    virtual OFCondition writeXML(ostream &out,                                 const size_t flags = 0);    /** special write method for creation of digital signatures     *  @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 writeSignatureFormat(DcmOutputStream &outStream,                                             const E_TransferSyntax oxfer,                                             const E_EncodingType enctype = EET_UndefinedLength);    /** returns true if the object contains an element with Unknown VR at any nesting level     *  @return true if the object contains an element with Unknown VR, false otherwise     */    virtual OFBool containsUnknownVR() const;    /** insert a new element into the list of elements maintained by this item.     *  The list of elements is always kept in ascending tag order.     *  @param elem element to be inserted, must not be contained in this or     *    any other item.  Will be deleted upon destruction of this item object.     *  @param replaceOld if true, this element replaces any other element with     *    the same tag which may already be contained in the item.  If false,     *    insert fails if another element with the same tag is already present.     *  @param checkInsertOrder if true, a warning message is sent to the console     *    if the element is not inserted at the end of the list.  This is used     *    in the read() method to detect datasets with out-of-order elements.     *  @return status, EC_Normal if successful, an error code otherwise     */    virtual OFCondition insert(DcmElement *elem,                               OFBool replaceOld = OFFalse,                               OFBool checkInsertOrder = OFFalse);    virtual DcmElement *getElement(const unsigned long num);    // get next Object from position in stack. If stack empty    // get next Object in this item. if intoSub true, scan    // complete hierarchy, false scan only elements direct in this    // item (not deeper).    virtual OFCondition nextObject(DcmStack &stack,                                   const OFBool intoSub);    virtual DcmObject  *nextInContainer(const DcmObject *obj);    virtual DcmElement *remove(const unsigned long num);    virtual DcmElement *remove(DcmObject *elem);    virtual DcmElement *remove(const DcmTagKey &tag);    virtual OFCondition clear();    virtual OFCondition verify(const OFBool autocorrect = OFFalse );    virtual OFCondition search(const DcmTagKey &xtag,              // in                               DcmStack &resultStack,              // inout                               E_SearchMode mode = ESM_fromHere,   // in                               OFBool searchIntoSub = OFTrue );    // in    virtual OFCondition searchErrors( DcmStack &resultStack );     // inout    virtual OFCondition loadAllDataIntoMemory();    /** This function takes care of group length and padding elements     *  in the current element list according to what is specified in     *  glenc and padenc. If required, this function does the following     *  two things:     *    a) it calculates the group length of all groups which are     *       contained in this item and sets the calculated values     *       in the corresponding group length elements and     *    b) it inserts a corresponding padding element (or, in case     *       of sequences: padding elements) with a corresponding correct     *       size into the element list.     *  @param glenc          Encoding type for group length; specifies what shall     *                        be done with group length tags.     *  @param padenc         Encoding type for padding; specifies what shall be     *                        done with padding tags.     *  @param xfer           The transfer syntax that shall be used.     *  @param enctype        Encoding type for sequences; specifies how sequences     *                        will be handled.     *  @param padlen         The length up to which the dataset shall be padded,     *                        if padding is desired.     *  @param subPadlen      For sequences (ie sub elements), the length up to     *                        which item shall be padded, if padding is desired.     *  @param instanceLength Number of extra bytes added to the item/dataset     *                        length used when computing the padding; this     *                        parameter is for instance used to pass the length     *                        of the file meta header from the DcmFileFormat to     *                        the DcmDataset object.     *  @return status, EC_Normal if successful, an error code otherwise     */    virtual OFCondition computeGroupLengthAndPadding(const E_GrpLenEncoding glenc,                                                     const E_PaddingEncoding padenc = EPD_noChange,                                                     const E_TransferSyntax xfer = EXS_Unknown,                                                     const E_EncodingType enctype = EET_ExplicitLength,                                                     const Uint32 padlen = 0,                                                     const Uint32 subPadlen = 0,                                                     Uint32 instanceLength = 0);    /* simple tests for existance */    OFBool tagExists(const DcmTagKey &key,                     OFBool searchIntoSub = OFFalse);    OFBool tagExistsWithValue(const DcmTagKey &key,                              OFBool searchIntoSub = OFFalse);    /* --- findAndGet functions: find an element and get it or the value, respectively --- */    /** find element and get a pointer to it.     *  Applicable to all DICOM value representations (VR).     *  The result variable 'element' is automatically set to NULL if an error occurs.     *  @param tagKey DICOM tag specifying the attribute to be searched for     *  @param element variable in which the reference to the element is stored     *  @param searchIntoSub flag indicating whether to search into sequences or not     *  @return EC_Normal upon success, an error code otherwise.     */    OFCondition findAndGetElement(const DcmTagKey &tagKey,                                  DcmElement *&element,                                  const OFBool searchIntoSub = OFFalse);    /** find all elements matching a particular tag and return references to them on a stack.     *  This functions always performs a deep search (i.e. searches into sequence of items).     *  @param tagKey DICOM tag specifying the attribute to be searched for     *  @param resultStack stack where references to the elements are stored (added to).     * 	  If no element is found, the stack is not modified (e.g. cleared).     *  @return EC_Normal if at least one matching tag is found, an error code otherwise.     */    OFCondition findAndGetElements(const DcmTagKey &tagKey,                                   DcmStack &resultStack);    /** find element and get value as a reference to a C string.     *  Applicable to the following VRs: AE, AS, CS, DA, DS, DT, IS, LO, LT, PN, SH, ST, TM, UI, UT     *  Since the getString() routine is called internally the resulting string reference represents     *  the (possibly multi-valued) value as stored in the dataset, i.e. no normalization is performed.     *  The result variable 'value' is automatically set to NULL if an error occurs.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -