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

📄 dimoimg.h

📁 转化为DIB位图再显示出来的dicom文件C++代码
💻 H
📖 第 1 页 / 共 4 页
字号:
     *     ** @param  data        untyped pointer memory buffer (set to NULL if not allocated externally)     *  @param  size        size of the memory buffer in bytes (if 0 'data' is set to NULL)     *  @param  frame       index of frame to be converted (starting from 0)     *  @param  bits        number of bits per pixel used for the output bitmap (8, 24 or 32)     *  @param  upsideDown  specifies the order of lines in the images (0 = top-down, bottom-up otherwise)     *  @param  padding     align each line to a 32-bit address if true (default)     *     ** @return number of bytes allocated by the bitmap, or 0 if an error occured     */    unsigned long createDIB(void *&data,                            const unsigned long size,                            const unsigned long frame,                            const int bits,                            const int upsideDown,                            const int padding = 1);    /** create true color (32 bit) or palette (8 bit) bitmap for Java (AWT default format).     *  Memory is not handled internally - must be deleted from calling program.     *     ** @param  data   resulting pointer to bitmap data (set to NULL if an error occurred)     *  @param  frame  index of frame to be converted (starting from 0)     *  @param  bits   number of bits per pixel used for the output bitmap (8 or 32)     *     ** @return number of bytes allocated by the bitmap, or 0 if an error occured     */    unsigned long createAWTBitmap(void *&data,                                  const unsigned long frame,                                  const int bits);    /** create packed bitmap (e.g. 12/16 bit -> 12/12 bit for DICOM printers).     *  Memory is not handled internally - must be deleted from calling program.     *     ** @param  buffer  pointer to input memory buffer     *  @param  size    size of memory buffer (will be checked whether it is sufficient)     *  @param  count   number of entries (pixels) in input buffer     *  @param  alloc   number of bits allocated for the pixels stored in the buffer (e.g. 16)     *  @param  stored  number of bits stored for the pixels stored in the buffer (e.g. 12)     *     ** @return pointer to memory buffer containing the packed output bitmap data (NULL if an error occurred)     */    static void *createPackedBitmap(const void *buffer,                                    const unsigned long size,                                    const unsigned long count,                                    const int alloc,                                    const int stored);    /** create new single frame DiImage with applied grayscale transformations.     *  The method getOutputData() is used internally for the new bitmap.     *     ** @param  frame  index of frame to be converted     *  @param  bits   number of bits per pixel used for the output bitmap     *     ** @return pointer to new DiImage object (NULL if an error occurred)     */    DiImage *createOutputImage(const unsigned long frame,                               const int bits);    /** write current image and related attributes to DICOM dataset.     *     ** @param  dataset  reference to DICOM dataset where the image attributes are stored     *  @param  mode     0 = determine value of BitsStored from 'used' pixel values,     *                   1 = determine value of BitsStored from 'possible' pixel values     *     ** @return true if successful, false otherwise     */    int writeImageToDataset(DcmItem &dataset,                            const int mode);    /** write pixel data to PPM file.     *  pixel data is written in ASCII format.     *     ** @param  stream  open C++ output stream     *  @param  frame   index of frame used for output     *  @param  bits    number of bits used for output of pixel data     *     ** @return true if successful, false otherwise     */    int writePPM(ostream &stream,                 const unsigned long frame,                 const int bits);    /** write pixel data to PPM file.     *  pixel data is written in ASCII format.     *     ** @param  stream  open C output stream     *  @param  frame   index of frame used for output     *  @param  bits    number of bits used for output of pixel data     *     ** @return true if successful, false otherwise     */    int writePPM(FILE *stream,                 const unsigned long frame,                 const int bits);    /** write pixel data to raw PPM file     *     ** @param  stream  open C output stream     *  @param  frame   index of frame used for output     *  @param  bits    number of bits used for output of pixel data     *     ** @return true if successful, false otherwise     */    int writeRawPPM(FILE *stream,                    const unsigned long frame,                    const int bits);    /** write pixel data to BMP file     *     ** @param  stream  open C output stream     *  @param  frame   index of frame used for output (default: first frame = 0)     *  @param  bits    number of bits used for output of pixel data (8 or 24, 0=default means 8)     *     ** @return true if successful, false otherwise     */    int writeBMP(FILE *stream,                 const unsigned long frame,                 const int bits); protected:    /** constructor     *     ** @param  image   pointer to dataset (encapsulated)     *  @param  status  current image status     *  @param  dummy   (necessary to be different from another constructor)     */    DiMonoImage(const DiDocument *image,                const EI_Status status,                const char dummy);    /** constructor, copy     *     ** @param  image   pointer to reference image     *  @param  fstart  first frame to be processed     *  @param  fcount  number of frames     */    DiMonoImage(const DiMonoImage *image,                const unsigned long fstart,                const unsigned long fcount);    /** constructor, convert color images to monochrome     *     ** @param  image  pointer to reference image     *  @param  red    coefficient by which the red component is weighted     *  @param  green  coefficient by which the green component is weighted     *  @param  blue   coefficient by which the blue component is weighted     *     ** @return pointer to new DiImage object (NULL if an error occurred)     */    DiMonoImage(const DiColorImage *image,                const double red,                const double green,                const double blue);    /** constructor, scale/clip     *     ** @param  image         pointer to reference image     *  @param  left_pos      x coordinate of top left corner of area to be scaled     *                        (referring to image origin, negative values create a border around the image)     *  @param  top_pos       y coordinate of top left corner of area to be scaled     *  @param  src_cols      width of area to be scaled     *  @param  src_rows      height of area to be scaled     *  @param  dest_cols     width of scaled image (in pixels)     *  @param  dest_rows     height of scaled image (in pixels)     *  @param  interpolate   specifies whether scaling algorithm should use interpolation (if necessary)     *                        default: no interpolation (0), 1 = pbmplus algorithm, 2 = c't algorithm     *  @param  aspect        specifies whether pixel aspect ratio should be taken into consideration     *                        (if true, width OR height should be 0, i.e. this component will be calculated     *                         automatically)     *  @param  pvalue        P-value used for the border outside the image (0..65535)     */    DiMonoImage(const DiMonoImage *image,                const signed long left_pos,                const signed long top_pos,                const Uint16 src_cols,                const Uint16 src_rows,                const Uint16 dest_cols,                const Uint16 dest_rows,                const int interpolate,                const int aspect,                const Uint16 pvalue);    /** constructor, flip     *     ** @param  image  pointer to reference image     ** @param  horz   flip horizontally if true     *  @param  vert   flip vertically if true     */    DiMonoImage(const DiMonoImage *image,                const int horz,                const int vert);    /** constructor, rotate     *     ** @param  image   pointer to reference image     *  @param  degree  angle by which the image shall be rotated     */    DiMonoImage(const DiMonoImage *image,                const int degree);    /** constructor, createMonoOutput     *     ** @param  image   pointer to reference image     *  @param  pixel   pointer to output pixel data used for the new image     *  @param  frame   number of frame stored in the new image object     *  @param  stored  number of bits stored     *  @param  alloc   number of bits allocated     */     DiMonoImage(const DiMonoImage *image,                 DiMonoOutputPixel *pixel,                 const unsigned long frame,                 const int stored,                 const int alloc);    /** initialize internal data structures and member variables     *     ** @param  modality  pointer to object handling the modality transform     */    void Init(DiMonoModality *modality);    /** initialize internal data structures (for Uint8)     *     ** @param  modality  pointer to object handling the modality transform     */    void InitUint8(DiMonoModality *modality);    /** initialize internal data structures (for Sint8)     *     ** @param  modality  pointer to object handling the modality transform     */    void InitSint8(DiMonoModality *modality);    /** initialize internal data structures (for Uint16)     *     ** @param  modality  pointer to object handling the modality transform     */    void InitUint16(DiMonoModality *modality);    /** initialize internal data structures (for Sint16)     *     ** @param  modality  pointer to object handling the modality transform     */    void InitSint16(DiMonoModality *modality);    /** initialize internal data structures (for Uint32)     *     ** @param  modality  pointer to object handling the modality transform     */    void InitUint32(DiMonoModality *modality);    /** initialize internal data structures (for Sint32)     *     ** @param  modality  pointer to object handling the modality transform     */    void InitSint32(DiMonoModality *modality);    /** check intermediate pixel representation for consistency     *     ** @param  mode  check number of pixels stored in the dataset if true     */    int checkInterData(const int mode = 1);    /** update Image Pixel Module attributes in the given dataset.     *  Removes possibly existing embedded overlay planes and replaces any     *  present modality transformation by a linear rescale/slope.     *  Used in writeXXXToDataset() routines.     *     ** @param  dataset  reference to DICOM image dataset     */    virtual void updateImagePixelModuleAttributes(DcmItem &dataset);    /** get pixel data with specified format.     *  (memory is handled externally)     *     ** @param  buffer    untyped pointer to the externally allocated memory buffer     *  @param  size      size of the memory buffer in bytes (will be checked)     *  @param  frame     number of frame to be rendered     *  @param  bits      number of bits for the output pixel data (depth)     *  @param  planar    flag, only useful for multi-planar images (color)     *  @param  negative  invert pixel data if true     *     ** @return untyped pointer to the pixel data if successful, NULL otherwise     */    const void *getData(void *buffer,                        const unsigned long size,                        const unsigned long frame,                        int bits,                        const int planar,                        const int negative);    /** get pixel data with specified format for Uint8 input (helper function).     *  (memory is handled externally)     *     ** @param  buffer   untyped pointer to the externally allocated memory buffer     *  @param  disp     pointer to current display function object     *  @param  samples  number of samples per pixel     *  @param  frame    number of frame to be rendered     *  @param  bits     number of bits for the output pixel data (depth)     *  @param  low      output pixel value to which 0 is mapped (min)     *  @param  high     output pixel value to which 2^bits-1 is mapped (max)     */    void getDataUint8(void *buffer,                      DiDisplayFunction *disp,                      const int samples,                      const unsigned long frame,                      const int bits,                      const Uint32 low,                      const Uint32 high);    /** get pixel data with specified format for Sint8 input (helper function).     *  (memory is handled externally)     *     ** @param  buffer   untyped pointer to the externally allocated memory buffer     *  @param  disp     pointer to current display function object     *  @param  samples  number of samples per pixel     *  @param  frame    number of frame to be rendered     *  @param  bits     number of bits for the output pixel data (depth)     *  @param  low      output pixel value to which 0 is mapped (min)     *  @param  high     output pixel value to which 2^bits-1 is mapped (max)     */    void getDataSint8(void *buffer,                      DiDisplayFunction *disp,                      const int samples,                      const unsigned long frame,                      const int bits,                      const Uint32 low,                      const Uint32 high);    /** get pixel data with specified format for Uint16 input (helper function).     *  (memory is handled externally)     *     ** @param  buffer   untyped pointer to the externally allocated memory buffer

⌨️ 快捷键说明

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