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

📄 dcmimage.h

📁 转化为DIB位图再显示出来的dicom文件C++代码
💻 H
📖 第 1 页 / 共 5 页
字号:
     ** @return pixel aspect ratio (floating point value)     */    inline double getHeightWidthRatio() const    {        return (Image != NULL) ?            Image->getRowColumnRatio() : 0;    }    /** set width height ratio (pixel aspect ratio: x/y)     *     ** @param  ratio  pixel aspect ratio (x/y)     *     ** @return status code (true if successful)     */    inline int setWidthHeightRatio(const double ratio) const    {        return (Image != NULL) ?            Image->setColumnRowRatio(ratio) : 0;    }    /** set height width ratio (pixel aspect ratio: y/x)     *     ** @param  ratio  pixel aspect ratio (y/x)     *     ** @return status code (true if successful)     */    inline int setHeightWidthRatio(const double ratio) const    {        return (Image != NULL) ?            Image->setRowColumnRatio(ratio) : 0;    }    /** check whether given output value is unused     *     ** @param  value  output value to be checked     *     ** @return status, true if unused (1 = within output range, 2 = out of range), false otherwise     */    inline int isOutputValueUnused(const unsigned long value)    {        return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?            Image->getMonoImagePtr()->isValueUnused(value) : 0;    }  // --- output: return pointer to output data if successful    /** get number of bytes required for the rendered output of a single frame.     *  This function determines the size of a rendered frame as created by getOutputData().     *  Therefore, it can be used to allocate a sufficiently large memory buffer and pass     *  its size to the second variant of getOutputData().     *     ** @param  bits  number of bits per sample used to render the pixel data     *                (image depth, 1..MAX_BITS, 0 means 'bits stored' in the image)     *                (MI_PastelColor = -1 for true color pastel mode, EXPERIMENTAL)     *     ** @return number of bytes if successful, 0 otherwise     */    inline unsigned long getOutputDataSize(const int bits = 0) const    {        return (Image != NULL) ?            Image->getOutputDataSize(Image->getBits(bits)) : 0;    }    /** render pixel data and return pointer to internal memory buffer.     *  apply VOI/PLUT transformation and (visible) overlay planes.     *  internal memory buffer will be delete for the next getBitmap/Output operation.     *  output data is always padded to 8, 16, 32, ... bits (bits allocated).     *  Supported output color models: Monochrome 2, RGB (and YCbCr_Full if flag     *  CIF_KeepYCbCrColorModel set). The rendered pixel data is alway unsigned.     *     ** @param  bits    number of bits per sample used to render the pixel data     *                  (image depth, 1..MAX_BITS, 0 means 'bits stored' in the image)     *                  (MI_PastelColor = -1 for true color pastel mode, EXPERIMENTAL)     *  @param  frame   number of frame to be rendered (0..n-1)     *  @param  planar  0 = color-by-pixel (R1G1B1...R2G2B2...R3G2B2...)     *                  1 = color-by-plane (R1R2R3...G1G2G3...B1B2B3...)     *                  (only applicable to multi-planar/color images, otherwise ignored)     *     ** @return pointer to internal memory buffer containing rendered pixel data     *          (if successful, NULL otherwise)     */    inline const void *getOutputData(const int bits = 0,                                     const unsigned long frame = 0,                                     const int planar = 0)    {        return (Image != NULL) ?            Image->getOutputData(frame, Image->getBits(bits), planar) : NULL;    }    /** render pixel data and output to given memory buffer.     *  apply VOI/PLUT transformation and (visible) overlay planes.     *  output data is always padded to 8, 16, 32, ... bits (bits allocated).     *  Supported output color models: Monochrome 2, RGB (and YCbCr_Full if flag     *  CIF_KeepYCbCrColorModel set). The rendered pixel data is alway unsigned.     *     ** @param  buffer  pointer to memory buffer (must already be allocated)     *  @param  size    size of memory buffer (will be checked whether it is sufficient)     *  @param  bits    number of bits per sample used to render the pixel data     *                  (image depth, 1..MAX_BITS, 0 means 'bits stored' in the image)     *                  (MI_PastelColor = -1 for true color pastel mode, EXPERIMENTAL)     *  @param  frame   number of frame to be rendered (0..n-1)     *  @param  planar  0 = color-by-pixel (R1G1B1...R2G2B2...R3G2B2...)     *                  1 = color-by-plane (R1R2R3...G1G2G3...B1B2B3...)     *                  (only applicable to multi-planar/color images, otherwise ignored)     *     ** @return status code (true if successful)     */    inline int getOutputData(void *buffer,                             const unsigned long size,                             const int bits = 0,                             const unsigned long frame = 0,                             const int planar = 0)    {        return (Image != NULL) ?            Image->getOutputData(buffer, size, frame, Image->getBits(bits), planar) : 0;    }    /** render pixel data and return pointer to given plane (internal memory buffer).     *  apply VOI/PLUT transformation and (visible) overlay planes     *  internal memory buffer will be delete for the next getBitmap/Output operation.     *  Supported output color models: Monochrome 2, RGB (and YCbCr_Full if flag     *  CIF_KeepYCbCrColorModel set). The rendered pixel data is alway unsigned.     *     ** @param  plane  number of plane to be rendered     *     ** @return pointer to internal memory buffer containing rendered pixel data     *          (if successful, NULL otherwise)     */    inline const void *getOutputPlane(const int plane) const    {        return (Image != NULL) ?            Image->getOutputPlane(plane) : NULL;    }    /** delete internal memory buffer used for rendered images.     *  Save memory if data is no longer needed.     */    inline void deleteOutputData() const    {        if (Image != NULL)            Image->deleteOutputData();    }  // --- misc    /** check whether image is monochrome or not.     *     ** @return true if image is monochrome, false otherwise (i.e. color image)     */    inline int isMonochrome() const    {        return (PhotometricInterpretation == EPI_Monochrome1) || (PhotometricInterpretation == EPI_Monochrome2);    }    /** get code for photometric interpretation (color model).     *     ** @return code for photometric interpretation of the image     */    inline EP_Interpretation getPhotometricInterpretation() const    {        return PhotometricInterpretation;    }    /** check whether image has given SOP class UID.     *     ** @return true if image has given SOP class UID, false otherwise     */    int hasSOPclassUID(const char *uid) const;    /** get intermediate pixel data representation (read-only).     *  This function allows to access the pixel data after they have been extracted     *  from the DICOM data element and the modality transformation has been applied     *  (if present and not disabled).  Please note that for monochrome images the     *  internal representation might be signed whereas color images are automatically     *  converted to unsigned RGB format.  Pixels are aligned to 8, 16 or 32 bits.     *     ** @return pointer to intermediate pixel data representation     */    inline const DiPixel *getInterData() const    {        return (Image != NULL) ?            Image->getInterData() : NULL;    } // --- display function for output device characteristic (calibration): //     only applicable to grayscale images    /** get display function     *     ** @return pointer to current display function, NULL if absent     */    inline DiDisplayFunction *getDisplayFunction() const    {        return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?            Image->getMonoImagePtr()->getDisplayFunction() : OFstatic_cast(DiDisplayFunction *, NULL);    }    /** set display function     *     ** @param  display  object describing the output device characteristic (only referenced!)     *     ** @return true if successful, false otherwise     */    inline int setDisplayFunction(DiDisplayFunction *display)    {        return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?            Image->getMonoImagePtr()->setDisplayFunction(display) : 0;    }    /** set no display function.     *  disables display function transformation, object is not deleted!     *     ** @return true if successful (1 = disabled current function,     *                              2 = there was no function to disable)     *          false otherwise     */    inline int setNoDisplayFunction()    {        return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?            Image->getMonoImagePtr()->setNoDisplayFunction() : 0;    }    /** delete specified display LUT(s)     *     ** @param  bits  parameter of LUT to be deleted (0 = all)     *     ** @return true if successful, false otherwise     */    inline int deleteDisplayLUT(const int bits = 0)    {        return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?            Image->getMonoImagePtr()->deleteDisplayLUT(bits) : 0;    }    /** convert P-value to DDL.     *  conversion uses display LUT if present, linear scaling otherwise.     *     ** @param  pvalue  P-value to be converted (0..65535)     *  @param  ddl     reference to resulting DDL     *  @param  bits    number of bits for output     *     ** @return true if successful (1 = display function transformation,     *                              2 = linear scaling),     *          false otherwise     */    inline int convertPValueToDDL(const Uint16 pvalue,                                  Uint16 &ddl,                                  const int bits = 8)    {        return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?            Image->getMonoImagePtr()->convertPValueToDDL(pvalue, ddl, bits) : 0;    } // --- windowing (voi): only applicable to grayscale images //                      return true if successful (see also 'dimoimg.cc')    /** unset all VOI transformations (windows and LUTs).     *  only applicable to monochrome images     *     ** @return true if successful (1 = previous window/LUT has been valid,     *                              2 = otherwise),     *          false otherwise (image is invalid or not monochrome)     */    inline int setNoVoiTransformation()    {        return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?            Image->getMonoImagePtr()->setNoVoiTransformation() : 0;    }    /** set automatically calculated minimum/maximum window.     *  possibly active VOI LUT is implicitly disabled.     *  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  idx  ignore global min/max values if true (1)     *     ** @return true if sucessful (1 = window has changed,     *                             2 = new window is the same as previous one),     *          false otherwise     */    inline int setMinMaxWindow(const int idx = 0)    {        return ((Image != NULL) && (Image->getMonoImagePtr() != NULL)) ?            Image->getMonoImagePtr()->setMinMaxWindow(idx) : 0;    }    /** set automatically calculated histogram window.     *  possibly active VOI LUT is implicitly disabled.     *     ** @param  thresh  threshhold value specifying percentage of histogram border which     *                  shall be ignored (defaut: 5%).

⌨️ 快捷键说明

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