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

📄 dcpixel.h

📁 转化为DIB位图再显示出来的dicom文件C++代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * *  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:  Andreas Barth * *  Purpose: Interface of class DcmPixelData * *  Last Update:      $Author: meichel $ *  Update Date:      $Date: 2005/12/08 16:28:30 $ *  CVS/RCS Revision: $Revision: 1.28 $ *  Status:           $State: Exp $ * *  CVS/RCS Log at end of file * */#ifndef DCPIXEL_H#define DCPIXEL_H#include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */#include "dcmtk/ofstd/ofconsol.h"#include "dcmtk/dcmdata/dcvrpobw.h"#include "dcmtk/ofstd/oflist.h"class DcmCodec;class DcmCodecList;class DcmStack;class DcmPixelSequence;class DcmPixelData;class DcmRepresentationEntry;class DcmRepresentationParameter{public:    /// default constructor    DcmRepresentationParameter() {}    /// copy constructor    DcmRepresentationParameter(const DcmRepresentationParameter&) {}    /// destructor    virtual ~DcmRepresentationParameter() {}    /** this methods creates a copy of type DcmRepresentationParameter *     *  it must be overweritten in every subclass.     *  @return copy of this object     */    virtual DcmRepresentationParameter *clone() const = 0;    /** returns the class name as string.     *  can be used in operator== as poor man's RTTI replacement.     */    virtual const char *className() const = 0;    /** compares an object to another DcmRepresentationParameter.     *  Implementation must make sure that classes are comparable.     *  @param arg representation parameter to compare with     *  @return true if equal, false otherwise.     */    virtual OFBool operator==(const DcmRepresentationParameter &arg) const = 0;};/** an object of this class maintains one compression "version" *  of a PixelData element within a DICOM dataset.  There can be *  multiple compressed versions in parallel, with different *  transfer syntaxes (compression algorithms) or representation *  parameters (e.g. compression factors). */class DcmRepresentationEntry{    /** constructor     *  @param rt transfer syntax     *  @param rp pointer to representation parameter on heap,     *     will be deleted when this object destructs.     *  @param pixSeq pointer to pixel sequence on heap,     *     will be deleted when this object destructs.     */    DcmRepresentationEntry(        const E_TransferSyntax rt,        const DcmRepresentationParameter * rp,        DcmPixelSequence * pixSeq);    /// copy constructor    DcmRepresentationEntry(const DcmRepresentationEntry &oldEntry);    /// destructor    ~DcmRepresentationEntry();    /// comparison operator    OFBool operator==(const DcmRepresentationEntry& x) const;    /// comparison operator    OFBool operator!=(const DcmRepresentationEntry & x) const    {      return !(*this == x);    }private:    /// private undefined copy assignment operator    DcmRepresentationEntry &operator=(const DcmRepresentationEntry &);    /// transfer syntax    E_TransferSyntax repType;    /// representation parameter for this pixel sequence    DcmRepresentationParameter * repParam;    /// the compressed pixel sequence itself    DcmPixelSequence * pixSeq;    friend class DcmPixelData;};typedef OFList<DcmRepresentationEntry *> DcmRepresentationList;typedef OFListIterator(DcmRepresentationEntry *) DcmRepresentationListIterator;typedef OFListConstIterator(DcmRepresentationEntry *) DcmRepresentationListConstIterator;/** The class DcmPixelData stores different pixel representations identified by * a type (the transfer syntax) and some representation parameters * The three unencapsulated transfer syntaxes belong to the same pixel * representation. * A type (or transfer syntax) conforms to a representation if * the type and the representation type are equal or both are unencapsulated. * If this is valid for the representation read or set by chooseRepresentation * then this representation is the conforming representation. * else a representation with the default parameter set defined in the * codec is the conforming representation. */class DcmPixelData : public DcmPolymorphOBOW{private:    friend class DcmRepresentationEntry;    /// List of representations of pixel data    DcmRepresentationList repList;    /// Iterator to the last dummy element in representation lis    DcmRepresentationListIterator repListEnd;    /// Iterator to the original representation. if an uncompressed    /// representation is used the iterator points to repList.end()    DcmRepresentationListIterator original;    /// current list element for some operations    DcmRepresentationListIterator current;    /// shows if an unecapsulated representation is stored    OFBool existUnencapsulated;    /** this flag indicates that this pixel data element will be written     *  in uncompressed (defined length) format even if the dataset     *  itself is written in a compressed syntax where pixel data is normally     *  written in encapsulated (undefined length) format.     *  By default this flag is false, unless the dataset was read in an     *  encapsulated transfer syntax and this pixel data element was already     *  present in uncompressed format.     */    OFBool alwaysUnencapsulated;        /// value representation of unencapsulated data    DcmEVR unencapsulatedVR;    /// in write function: pointer to current pixel sequence    DcmPixelSequence * pixelSeqForWrite;    /** This function removes all pixel representations from the list     *  of pixel representations except the one which was passed. Note     *  that if parameter leaveInList equals repListEnd, all representations     *  will be removed from the list.     *  @param leaveInList Iterator to a representation which shall not     *                     be removed from the list of representations.     */    void clearRepresentationList(        DcmRepresentationListIterator leaveInList);    /** find a conforming representation in the list of     *  encapsulated representations     */    OFCondition findConformingEncapsulatedRepresentation(        const DcmXfer & repType,        const DcmRepresentationParameter * repParam,        DcmRepresentationListIterator & result);    /** find a representation entry and return an iterator to the found entry     *  or the next element in the list. The condition returned can be EC_Normal     *  if such an entry is found or EC_RepresentationNotFound. The pixSeq     *  attribute in findEntry can be NULL, it is not needed for the find     *  operation!     */    OFCondition findRepresentationEntry(        const DcmRepresentationEntry & findEntry,        DcmRepresentationListIterator & result);    /** insert or replace a representation entry in the list     */    DcmRepresentationListIterator insertRepresentationEntry(        DcmRepresentationEntry * repEntry);    /** decode representation to unencapsulated format     */    OFCondition decode(        const DcmXfer & fromType,        const DcmRepresentationParameter * fromParam,        DcmPixelSequence * fromPixSeq,        DcmStack & pixelStack);    /** encode to encapsulated format     */    OFCondition encode(        const DcmXfer & fromType,        const DcmRepresentationParameter * fromParam,        DcmPixelSequence * fromPixSeq,        const DcmXfer & toType,        const DcmRepresentationParameter *toParam,        DcmStack & pixelStack);    void recalcVR()    {        if (current == repList.end()) Tag.setVR(unencapsulatedVR);        else Tag.setVR(EVR_OB);    }public:    DcmPixelData(const DcmTag & tag, const Uint32 len = 0);    DcmPixelData(const DcmPixelData & pixelData);    virtual ~DcmPixelData();    DcmPixelData &operator=(const DcmPixelData &obj);    /** clone method     *  @return deep copy of this object     */    virtual DcmObject *clone() const    {      return new DcmPixelData(*this);    }    virtual OFCondition setVR(DcmEVR vr);    virtual DcmEVR ident() const { return EVR_PixelData; }    virtual void print(ostream &out,                       const size_t flags = 0,                       const int level = 0,                       const char *pixelFileName = NULL,                       size_t *pixelCounter = NULL);    /** tests if it is possible to write a specific representation     *  Only existing representations are considered, since this     *  method does not create a representation.     */    virtual OFBool canWriteXfer(const E_TransferSyntax newXfer,                                const E_TransferSyntax oldXfer);    /** returns length of representation conforming to the     *  transfer syntax with tag, vr, ... It does not create a     *  representation. If no conforming representation exists an     *  error code is set and 0 returned.     */    virtual Uint32 calcElementLength(const E_TransferSyntax xfer,                                     const E_EncodingType enctype);    /** returns length of representation value field conforming to     *  given transfer syntax. It does not create a representation.     *  If no conforming representation exists, an error code is set     *  and 0 returned.     */    virtual Uint32 getLength(        const E_TransferSyntax xfer  = EXS_LittleEndianImplicit,        const E_EncodingType enctype = EET_UndefinedLength);

⌨️ 快捷键说明

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