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

📄 dcmimage.h

📁 转化为DIB位图再显示出来的dicom文件C++代码
💻 H
📖 第 1 页 / 共 5 页
字号:
/* * *  Copyright (C) 1996-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:  dcmimgle * *  Author:  Joerg Riesmeier * *  Purpose: Provides main interface to the "DICOM image toolkit" * *  Last Update:      $Author: meichel $ *  Update Date:      $Date: 2005/12/08 16:47:31 $ *  CVS/RCS Revision: $Revision: 1.54 $ *  Status:           $State: Exp $ * *  CVS/RCS Log at end of file * */#ifndef DCMIMAGE_H#define DCMIMAGE_H#include "dcmtk/config/osconfig.h"#include "dcmtk/ofstd/ofcast.h"#include "dcmtk/dcmimgle/dimoimg.h"#include "dcmtk/dcmimgle/didispfn.h"#include "dcmtk/dcmimgle/diutils.h"/*------------------------* *  forward declarations  * *------------------------*/class DcmXfer;class DcmObject;class DcmOverlayData;class DcmLongString;class DcmUnsignedShort;class DiPixel;class DiDocument;class DiPluginFormat;/*---------------------* *  class declaration  * *---------------------*//** Interface class for dcmimgle/dcmimage module. *  The main purpose of these modules is image display. */class DicomImage{ public: // --- constructors and destructor    /** constructor, open a DICOM file.     *  opens specified file and reads image related data, creates internal representation     *  of image data. use getStatus() to obtain detailed information about any errors.     *     ** @param  filename  the DICOM file     *  @param  flags     configuration flags (see diutils.h, CIF_MayDetachPixelData is set automatically)     *  @param  fstart    first frame to be processed (optional, 0 = 1st frame), all subsequent use     *                    of parameters labeled 'frame' in this class refers to this start frame.     *  @param  fcount    number of frames (optional, 0 = all frames)     */    DicomImage(const char *filename,               const unsigned long flags = 0,               const unsigned long fstart = 0,               const unsigned long fcount = 0);#ifndef STARVIEW    /** constructor, use a given DcmObject     *     ** @param  object  pointer to DICOM data structures     *                  (do not delete while referenced, i.e. while this image object or any     *                   descendant exists; not deleted within dcmimage unless configuration flag     *                   CIF_TakeOverExternalDataset is set - in this case do not delete it at all)     *  @param  xfer    transfer syntax     *  @param  flags   configuration flags (CIF_xxx, see diutils.h)     *  @param  fstart  first frame to be processed (optional, 0 = 1st frame), all subsequent use     *                  of parameters labeled 'frame' in this class refers to this start frame.     *  @param  fcount  number of frames (optional, 0 = all frames)     */    DicomImage(DcmObject *object,               const E_TransferSyntax xfer,               const unsigned long flags = 0,               const unsigned long fstart = 0,               const unsigned long fcount = 0);    /** constructor, use a given DcmObject with specified rescale/slope.     *  NB: This constructor ignores the Photometric Interpretation stored in the DICOM dataset     *      and always creates a MONOCHROME2 image - useful in combination with Presentation States.     *     ** @param  object     pointer to DICOM data structures     *                     (do not delete while referenced, i.e. while this image object or any     *                      descendant exists; not deleted within dcmimage unless configuration flag     *                      CIF_TakeOverExternalDataset is set - in this case do not delete it at all)     *  @param  xfer       transfer syntax     *  @param  slope      rescale slope (modality transformation)     *  @param  intercept  rescale intercept (modality transformation)     *  @param  flags      configuration flags (CIF_xxx, see diutils.h)     *  @param  fstart     first frame to be processed (optional, 0 = 1st frame), all subsequent use     *                     of parameters labeled 'frame' in this class refers to this start frame.     *  @param  fcount     number of frames (optional, 0 = all frames)     */    DicomImage(DcmObject *object,               const E_TransferSyntax xfer,               const double slope,               const double intercept,               const unsigned long flags = 0,               const unsigned long fstart = 0,               const unsigned long fcount = 0);    /** constructor, use a given DcmObject with specified modality LUT.     *  NB: This constructor ignores the Photometric Interpretation stored in the DICOM dataset     *      and always creates a MONOCHROME2 image - useful in combination with Presentation States.     *     ** @param  object       pointer to DICOM data structures     *                       (do not delete while referenced, i.e. while this image object or any     *                        descendant exists; not deleted within dcmimage unless configuration flag     *                        CIF_TakeOverExternalDataset is set - in this case do not delete it at all)     *  @param  xfer         transfer syntax     *  @param  data         dataset element containing modality LUT data     *  @param  descriptor   dataset element containing modality LUT descriptor     *  @param  explanation  dataset element containing modality LUT explanation     *  @param  flags        configuration flags (CIF_xxx, see diutils.h)     *  @param  fstart       first frame to be processed (optional, 0 = 1st frame), all subsequent use     *                       of parameters labeled 'frame' in this class refers to this start frame.     *  @param  fcount       number of frames (optional, 0 = all frames)     */    DicomImage(DcmObject *object,               E_TransferSyntax xfer,               const DcmUnsignedShort &data,               const DcmUnsignedShort &descriptor,               const DcmLongString *explanation = NULL,               const unsigned long flags = 0,               const unsigned long fstart = 0,               const unsigned long fcount = 0);#endif    /** destructor     */    virtual ~DicomImage(); // --- information: return requested value if successful    /** convert status code to status string     *     ** @param  status  code of current internal status     *     ** @return pointer to status string     */    static const char *getString(const EI_Status status);    /** convert photometric interpretation code to interpretation string     *     ** @param  interpret  code of image's photometric interpretation     *     ** @return pointer to photometric interpretation string     */    static const char *getString(const EP_Interpretation interpret);    /** get current status information     *     ** @return status code     */    inline EI_Status getStatus() const    {        return (Image != NULL) ?            Image->getStatus() : ImageStatus;    }    /** get number of frames.     *  Please note that this function does not return the number of frames stored in the     *  DICOM file/dataset. It rather refers to the number of frames processed by this class     *  (see constructors for details).     *     ** @return number of frames     */    inline unsigned long getFrameCount() const    {        return (Image != NULL) ?            Image->getNumberOfFrames() : 0;    }    /** get index of first frame.     *  This functions returns the index of the first frame processed by this class (see     *  constructors for details).     *     ** @return index of first frame (0..n-1)     */    inline unsigned long getFirstFrame() const    {        return (Image != NULL) ?            Image->getFirstFrame() : 0;    }    /** get index of representative frame.     *  This attribute is optionally stored in the DICOM dataset (type 3).     *     ** @return index of representative frame (0..n-1)     */    inline unsigned long getRepresentativeFrame() const    {        return (Image != NULL) ?            Image->getRepresentativeFrame() : 0;    }    /** get image width in pixels     *     ** @return number of pixels in one row     */    inline unsigned long getWidth() const    {        return (Image != NULL) ?            Image->getColumns() : 0;    }    /** get image height in pixels     *     ** @return number of pixels in one column     */    inline unsigned long getHeight() const    {        return (Image != NULL) ?            Image->getRows() : 0;    }    /** get image depth     *     ** @return number of bits per sample     */    inline int getDepth() const    {        return (Image != NULL) ?            Image->getBits() : 0;    }    /** get minimum and maximum pixel values.     *  the resulting pixel values are stored in 'double' variables to avoid problems     *  with different number ranges, limited to monochrome images.     *  Please note that the min/max values refer to the full pixel data (i.e. including     *  all possible present frames as specified in the constructor of this class).     *     ** @param  min   minimum pixel value (reference parameter)     *  @param  max   maximum pixel value (reference parameter)     *  @param  mode  0 = min/max 'used' pixel values,     *                1 = min/max 'possible' pixel values (absolute min/max)     *     ** @return status code (true if successful)     */    inline int getMinMaxValues(double &min,                               double &max,                               const int mode = 0) const    {        return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?            Image->getMonoImagePtr()->getMinMaxValues(min, max, mode) : 0;    }    /** get width height ratio (pixel aspect ratio: x/y)     *     ** @return pixel aspect ratio (floating point value)     */    inline double getWidthHeightRatio() const    {        return (Image != NULL) ?            Image->getColumnRowRatio() : 0;    }    /** get height width ratio (pixel aspect ratio: y/x)     *

⌨️ 快捷键说明

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