📄 diimage.h
字号:
/* * * 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: DicomImage (Header) * * Last Update: $Author: meichel $ * Update Date: $Date: 2005/12/08 16:47:42 $ * CVS/RCS Revision: $Revision: 1.38 $ * Status: $State: Exp $ * * CVS/RCS Log at end of file * */#ifndef DIIMAGE_H#define DIIMAGE_H#include "dcmtk/config/osconfig.h"#include "dcmtk/dcmdata/dctypes.h"#include "dcmtk/dcmdata/dcitem.h"#ifdef SUNCC#include "dcmtk/dcmimgle/didocu.h"#endif#include "dcmtk/dcmimgle/diovlay.h"#include "dcmtk/dcmimgle/diutils.h"#define INCLUDE_CSTDIO#include "dcmtk/ofstd/ofstdinc.h"#include "dcmtk/ofstd/ofstream.h"/*------------------------* * forward declarations * *------------------------*/class DcmPixelData;class DcmUnsignedShort;#ifndef SUNCC class DiDocument;#endifclass DiPixel;class DiMonoImage;class DiInputPixel;/*---------------------* * class declaration * *---------------------*//** Base class for images */class DiImage{ public: /** constructor * ** @param docu pointer to the DICOM document * @param status status of the image object * @param spp samples per pixel */ DiImage(const DiDocument *docu, const EI_Status status, const int spp); /** destructor */ virtual ~DiImage(); /** get status of the image object * ** @return status of the image object */ inline EI_Status getStatus() const { return ImageStatus; } /** get number of frames * ** @return number of frames */ inline Uint32 getNumberOfFrames() const { return NumberOfFrames; } /** get index of first frame * ** @return index of first frame */ inline Uint32 getFirstFrame() const { return FirstFrame; } /** get representative frame * ** @return representative frame */ inline Uint32 getRepresentativeFrame() const { return RepresentativeFrame; } /** get number of rows * ** @return number of rows */ inline Uint16 getRows() const { return Rows; } /** get number of columns * ** @return number of columns */ inline Uint16 getColumns() const { return Columns; } /** get pixel's width * ** @return pixel's width */ inline double getPixelWidth() const { return (PixelWidth > 0) ? PixelWidth : 1; } /** get pixel's height * ** @return pixel's height */ inline double getPixelHeight() const { return (PixelHeight > 0) ? PixelHeight : 1; } /** get pixel's rows/column ratio * ** @return pixel's rows/column ratio */ inline double getRowColumnRatio() const { return getPixelHeight() / getPixelWidth(); } /** get pixel's column/rows ratio * ** @return pixel's column/rows ratio */ inline double getColumnRowRatio() const { return getPixelWidth() / getPixelHeight(); } /** set pixel's rows/column ratio * ** @param ratio pixel's rows/column ratio * ** @return status, true if successful, false otherwise */ int setRowColumnRatio(const double ratio); /** set pixel's column/rows ratio * ** @param ratio pixel's column/rows ratio * ** @return status, true if successful, false otherwise */ int setColumnRowRatio(const double ratio); /** get polarity. * possible values are EPP_Normal and EPP_Reverse * ** @return currently active polarity mode */ inline EP_Polarity getPolarity() const { return Polarity; } /** set polarity. * ** @param polarity polarity (normal or reverse) * ** @return true if successful (1 = polarity has changed, * 2 = polarity has not changed) * false otherwise */ int setPolarity(const EP_Polarity polarity); /** get number of bits per sample. * If the optional parameter is specified the value will be checked and in any case * a valid value will be returned. * ** @param bits value to be returned (if less than 1 or greater than the maximum (32) * the default value will be used which is equal to the bits per sample * value stored in the DICOM dataset) * ** @return status, true if successful, false otherwise */ virtual int getBits(const int bits = 0) const { return ((bits < 1) || (bits > MAX_BITS)) ? BitsPerSample : bits; } /** get color model of internal pixel representation. * Possible values are: EPI_Monochrome1, EPI_Monochrome2, EPI_RGB and EPI_YBR_Full * ** @return color model of internal pixel representation */ virtual EP_Interpretation getInternalColorModel() const = 0; /** get access to intermediate pixel data representation (abstract) * ** @return pointer to intermediate pixel data */ virtual const DiPixel *getInterData() const = 0; /** get number of bytes required for the rendered output of a single frame * * @param bits number of bits for the output pixel data (depth) * ** @return number of bytes if successful, 0 otherwise */ virtual unsigned long getOutputDataSize(const int bits = 0) const = 0; /** get pixel data with specified format (abstract). * (memory is handled internally) * ** @param frame number of frame to be rendered * @param bits number of bits for the output pixel data (depth) * @param planar flag, whether the output data (for multi-planar images) should be planar or not * ** @return untyped pointer to the pixel data if successful, NULL otherwise */ virtual const void *getOutputData(const unsigned long frame, const int bits, const int planar) = 0; /** get pixel data with specified format (abstract). * (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, whether the output data (for multi-planar images) should be planar or not * ** @return status, true if successful, false otherwise */ virtual int getOutputData(void *buffer, const unsigned long size, const unsigned long frame, const int bits, const int planar) = 0; /** get pixel data of specified plane (abstract). * (memory is handled internally) * ** @param plane number of plane which should be rendered (starting from 0) * ** @return untyped pointer to the pixel data if successful, NULL otherwise */ virtual const void *getOutputPlane(const int plane) const = 0; /** delete internally handled output memory buffer (abstract) */ virtual void deleteOutputData() = 0; /** get pointer to the object managing the overlay planes * ** #param idx index of overlay group (here: not used, since only applicable for monochrome images) * ** @return pointer to the overlay managing object, here: NULL */ virtual DiOverlay *getOverlayPtr(const unsigned int /*idx*/) { return NULL; } /** get pointer to monochrome image object * ** @return pointer to monochrome image object (here: always NULL) */ virtual DiMonoImage *getMonoImagePtr() { return NULL; } /** create copy of current image object (abstract) * ** @param fstart first frame to be processed (not fully implemented!) * @param fcount number of frames (not fully implemented!) * ** @return pointer to new DiImage object (NULL if an error occurred) */ virtual DiImage *createImage(const unsigned long fstart, const unsigned long fcount) const = 0; /** create scaled copy of specified (clipping) area of the current image object (abstract). * ** @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 clip_width width of area to be scaled * @param clip_height height of area to be scaled * @param scale_width width of scaled image (in pixels) * @param scale_height 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) * ** @return pointer to new DiImage object (NULL if an error occurred) */ virtual DiImage *createScale(const signed long left_pos, const signed long top_pos, const unsigned long clip_width, const unsigned long clip_height, const unsigned long scale_width, const unsigned long scale_height, const int interpolate, const int aspect, const Uint16 pvalue) const = 0; /** flip current image horizontally and/or vertically (abstract) * ** @param horz flip horizontally if true * @param vert flip vertically if true * ** @return true if successful, false otherwise */ virtual int flip(const int horz, const int vert) = 0; /** create a flipped copy of the current image (abstract). * ** @param horz flip horizontally if true * @param vert flip vertically if true * ** @return pointer to new DiImage object (NULL if an error occurred) */ virtual DiImage *createFlip(const int horz, const int vert) const = 0; /** rotate current image (by steps of 90 degrees) * ** @param degree angle by which the image shall be rotated * ** @return true if successful, false otherwise */ virtual int rotate(const int degree); /** create a rotated copy of the current image (abstract). * ** @param degree angle by which the image shall be rotated * ** @return pointer to new DiImage object (NULL if an error occurred) */ virtual DiImage *createRotate(const int degree) const = 0; /** create monochrome copy of the current image (abstract). * ** @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) */ virtual DiImage *createMono(const double red, const double green, const double blue) const = 0; /** create true color (24/32 bit) or palette (8 bit) bitmap for MS Windows (abstract).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -