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

📄 diovpln.h

📁 转化为DIB位图再显示出来的dicom文件C++代码
💻 H
📖 第 1 页 / 共 2 页
字号:
     */    inline int isEmbedded() const    {        return EmbeddedData;    }    /** get label of overlay plane     *     ** @return label if successful, NULL otherwise     */    const char *getLabel() const    {        return (Label.empty()) ? OFstatic_cast(const char *, NULL) : Label.c_str();    }    /** get description of overlay plane     *     ** @return description if successful, NULL otherwise     */    const char *getDescription() const    {        return (Description.empty()) ? OFstatic_cast(const char *, NULL) : Description.c_str();    }    /** get group number of overlay plane     *     ** @return group number (0x6000-0x60ff)     */    Uint16 getGroupNumber() const    {        return GroupNumber;    }    /** get overlay plane data as an array of 1/8/16 bit values.     *  Overlay plane is clipped to the area specified by the four min/max coordinates.     *  Memory isn't handled internally and must therefore be deleted from calling program.     *     ** @param  frame  number of frame     *  @param  xmin   x-coordinate of the top left hand corner     *  @param  ymin   y-coordinate of the top left hand corner     *  @param  xmax   x-coordinate of the bottom right hand corner     *  @param  ymax   y-coordinate of the bottom right hand corner     *  @param  bits   number of bits (stored) in the resulting array     *  @param  fore   foreground color used for the plane (0x00-0xff)     *  @param  back   transparent background color (0x00-0xff)     *     ** @return pointer to pixel data if successful, NULL otherwise     */    void *getData(const unsigned long frame,                  const Uint16 xmin,                  const Uint16 ymin,                  const Uint16 xmax,                  const Uint16 ymax,                  const int bits,                  const Uint16 fore,                  const Uint16 back);    /** create overlay plane data in (6xxx,3000) format.     *  (1 bit allocated and stored, foreground color is 1, background color is 0,     *   data is 16 bit padded - even length)     *  Memory isn't handled internally and must therefore be deleted from calling program.     *     ** @param  buffer  stores pointer to overlay data (memory is allocated internally)     *  @param  width   returns width of overlay plane (in pixels)     *  @param  height  returns height of overlay plane (in pixels)     *  @param  frames  returns number of frames (multiple overlay frames possible!)     *     ** @return number of bytes allocated for the 'buffer' if successful, 0 otherwise     */    unsigned long create6xxx3000Data(Uint8 *&buffer,                                     unsigned int &width,                                     unsigned int &height,                                     unsigned long &frames);    /** reset internal 'cursor' to the beginning of the specified frame     *     ** @param  frame  number of current frame     *     ** @return status, true if successful, false otherwise     */    inline int reset(const unsigned long frame);    /** get value of the current overlay plane bit and move 'cursor' to the next position     *     ** @return true if plane bit is set, false otherwise     */    inline int getNextBit();    /** set internal 'cursor' to a specific position     *     ** @param  x  new x-coordinate to start from     *  @param  y  new y-coordinate to start from     */    inline void setStart(const Uint16 x,                         const Uint16 y); protected:    /// number of frames    Uint32 NumberOfFrames;    /// number of starting frame    Uint16 ImageFrameOrigin;    /// y-coordinate of overlay plane's origin    Sint16 Top;    /// x-coordinate of overlay plane's origin    Sint16 Left;    /// visible height    Uint16 Height;    /// visible width    Uint16 Width;    /// number of (stored) rows    Uint16 Rows;    /// number of (stored) columns    Uint16 Columns;    /// number of allocated bits per pixel    Uint16 BitsAllocated;    /// position of overlay plane bit    Uint16 BitPosition;    /// "color" of overlay plane (in percent: '0.0' = dark, '1.0' = bright)    double Foreground;    /// threshold value used for "threshold replace"    double Threshold;    /// P-value used for bitmap shutters    Uint16 PValue;    /// current overlay mode    EM_Overlay Mode;    /// default (stored) overlay mode    EM_Overlay DefaultMode;    /// label of overlay plane    OFString Label;    /// textual description of overlay plane    OFString Description;    /// group number of overlay plane    Uint16 GroupNumber;    /// validity status    int Valid;    /// visibility status    int Visible; private:    /// current bit position    unsigned long BitPos;    /// starting bit position of current frame    unsigned long StartBitPos;    /// x-coordinate of first pixel in surrounding memory buffer    unsigned int StartLeft;    /// y-coordinate of first pixel in surrounding memory buffer    unsigned int StartTop;    /// true, if overlay data in embedded in pixel data    int EmbeddedData;    /// pointer to current element of 'Data'    const Uint16 *Ptr;    /// pointer to starting element of current frame    const Uint16 *StartPtr;    /// pointer to overlay data (standalone) or pixel data (embedded)    const Uint16 *Data; // --- declarations to avoid compiler warnings    DiOverlayPlane(const DiOverlayPlane &);    DiOverlayPlane &operator=(const DiOverlayPlane &);};/********************************************************************/inline int DiOverlayPlane::reset(const unsigned long frame){    int result = 0;    if (Valid && (Data != NULL) && (frame >= ImageFrameOrigin) && (frame < ImageFrameOrigin + NumberOfFrames))    {        const unsigned long bits = (OFstatic_cast(unsigned long, StartLeft) + OFstatic_cast(unsigned long, StartTop) *            OFstatic_cast(unsigned long, Columns) + frame * OFstatic_cast(unsigned long, Rows) *            OFstatic_cast(unsigned long, Columns)) * OFstatic_cast(unsigned long, BitsAllocated);        StartBitPos = BitPos = OFstatic_cast(unsigned long, BitPosition) + bits;        StartPtr = Ptr = Data + (bits >> 4);        result = (getRight() > 0) && (getBottom() > 0);    }    return result;}inline int DiOverlayPlane::getNextBit(){    int result;    if (BitsAllocated == 16)                                       // optimization        result = OFstatic_cast(int, *(Ptr++) & (1 << BitPosition));    else    {       Ptr = StartPtr + (BitPos >> 4);                             // div 16       result = OFstatic_cast(int, *Ptr & (1 << (BitPos & 0xf)));  // mod 16       BitPos += BitsAllocated;                                    // next bit    }    return result;}inline void DiOverlayPlane::setStart(const Uint16 x,                                     const Uint16 y){    if (BitsAllocated == 16)        Ptr = StartPtr + OFstatic_cast(unsigned long, y - Top) * OFstatic_cast(unsigned long, Columns) +            OFstatic_cast(unsigned long, x - Left);    else        BitPos = StartBitPos + (OFstatic_cast(unsigned long, y - Top) * OFstatic_cast(unsigned long, Columns) +            OFstatic_cast(unsigned long, x - Left)) * OFstatic_cast(unsigned long, BitsAllocated);}#endif/* * * CVS/RCS Log: * $Log: diovpln.h,v $ * Revision 1.26  2005/12/08 16:48:03  meichel * Changed include path schema for all DCMTK header files * * Revision 1.25  2004/01/05 14:52:20  joergr * Removed acknowledgements with e-mail addresses from CVS log. * * Revision 1.24  2003/12/09 10:11:28  joergr * Adapted type casts to new-style typecast operators defined in ofcast.h. * Removed leading underscore characters from preprocessor symbols (reserved * symbols). Updated copyright header. * * Revision 1.23  2003/06/12 15:08:34  joergr * Fixed inconsistent API documentation reported by Doxygen. * * Revision 1.22  2002/12/09 13:32:55  joergr * Renamed parameter/local variable to avoid name clashes with global * declaration left and/or right (used for as iostream manipulators). * * Revision 1.21  2002/11/27 14:08:07  meichel * Adapted module dcmimgle to use of new header file ofstdinc.h * * Revision 1.20  2002/04/16 13:53:12  joergr * Added configurable support for C++ ANSI standard includes (e.g. streams). * * Revision 1.19  2001/09/28 13:10:32  joergr * Added method to extract embedded overlay planes from pixel data and store * them in group (6xxx,3000) format. * * Revision 1.18  2001/06/01 15:49:49  meichel * Updated copyright header * * Revision 1.17  2001/05/22 13:20:44  joergr * Enhanced checking routines for corrupt overlay data (e.g. invalid value for * OverlayBitsAllocated). * * Revision 1.16  2000/03/08 16:24:22  meichel * Updated copyright header. * * Revision 1.15  2000/02/02 11:02:39  joergr * Removed space characters before preprocessor directives. * * Revision 1.14  1999/10/20 10:34:06  joergr * Enhanced method getOverlayData to support 12 bit data for print. * * Revision 1.13  1999/09/17 12:46:59  joergr * Added/changed/completed DOC++ style comments in the header files. * * Revision 1.12  1999/08/25 16:41:55  joergr * Added new feature: Allow clipping region to be outside the image * (overlapping). * * Revision 1.11  1999/05/03 11:09:31  joergr * Minor code purifications to keep Sun CC 2.0.1 quiet. * * Revision 1.10  1999/04/29 16:46:47  meichel * Minor code purifications to keep DEC cxx 6 quiet. * * Revision 1.9  1999/03/24 17:20:21  joergr * Added/Modified comments and formatting. * * Revision 1.8  1999/03/22 08:52:18  joergr * Added parameter to specify (transparent) background color for method * getOverlayData(). * * Revision 1.7  1999/02/03 17:34:36  joergr * Added BEGIN_EXTERN_C and END_EXTERN_C to some C includes. * Added support for calibration according to Barten transformation (incl. * a DISPLAY file describing the monitor characteristic). * * Revision 1.6  1998/12/23 13:21:29  joergr * Changed parameter type (long to int) to avoid warning reported by MSVC5. * * Revision 1.5  1998/12/23 11:37:42  joergr * Changed order of parameters for addOverlay() and getOverlayData(). * Changed behaviour of getLabel/Description/Explanation() methods: return * NULL if string empty, no empty string "". * * Revision 1.4  1998/12/22 14:36:30  joergr * Added method to check whether plane is visible, to get plane mode and to * remove all planes. Set 'value' used for getOverlay/PlaneData(). * * Revision 1.3  1998/12/16 16:37:51  joergr * Added method to export overlay planes (create 8-bit bitmap). * Implemented flipping and rotation of overlay planes. * * Revision 1.2  1998/12/14 17:28:18  joergr * Added methods to add and remove additional overlay planes (still untested). * Added methods to support overlay labels and descriptions. * * Revision 1.1  1998/11/27 15:45:09  joergr * Added copyright message. * Added method to detach pixel data if it is no longer needed. * Added methods and constructors for flipping and rotating, changed for * scaling and clipping. * * Revision 1.7  1998/07/01 08:39:26  joergr * Minor changes to avoid compiler warnings (gcc 2.8.1 with additional * options), e.g. add copy constructors. * * Revision 1.6  1998/05/11 14:53:26  joergr * Added CVS/RCS header to each file. * * */

⌨️ 快捷键说明

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