123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- //**************************************************************************
- // FILENAME : RealImage.h
- //
- // CLASSES : RealImage
- //
- // ECOMPACS DICOM Network Transport Libraries * Version 0.1 Beta
- //**************************************************************************
- #ifndef _DICOM_REALIMAGE_
- #define _DICOM_REALIMAGE_
- #include "LookupTable.hpp"
- class RealImage8;
- //**************************************************************************
- // class RealImage
- //**************************************************************************
- class DICOM_API RealImage
- {
- public:
- enum RotateAngle { alpha0, alpha90, alpha180, alpha270 };
- char PhotometricInterpretation[65];
- int NumberOfFrames;
- int FrameIndex;
- int PixelRepresentation; // = 1 : signed, = 0 : unsigned
- LookupTable LUT;
- RGBQUAD Colors[256];
- public:
- ImageProcess * ImgProc;
- UINT32 lParam;
- UINT32 ImageHandle0; // Used for display system, such as HBITMAP or HDIB
- UINT32 ImageHandle1; // Used for display system, such as HPALETTE or Palette index
- UINT32 ImageHandle2; // Other handles
- UINT32 ImageHandle3;
- public:
- RealImage (
- int width, int height, int depth,
- int min, int max,
- int minSet, int maxSet,
- float offset = 0, float slope = 1);
- RealImage (const RealImage & OrgRealImage);
- virtual ~RealImage ();
- //************************************************************************
- // Purpose: to get the 8 bits image (240 gray levels) from the image data.
- //************************************************************************
- virtual unsigned char * GetPixmap (BOOL relativMode) const = 0;
- virtual unsigned char * GetPixmap (unsigned char *colortable) const = 0;
- virtual unsigned char * GetPixmapEx (unsigned char *colortable) const = 0;
- virtual unsigned char * GetPixmap (void) const = 0;
- virtual RealImage8 * Remap (void) const ;
- virtual void Invert (); // invert the original image
- virtual void FlipVertical (void) = 0;
- virtual void FlipHorizontal (void) = 0;
- virtual void Rotate (RotateAngle angle) = 0; // rotates the original image
- int GetMinImage () const {return MinImage;}; // gets the minimum pixel value of the image
- int GetMaxImage () const {return MaxImage;};
- int GetMinSet () const {return MinSet;}; // gets the minimum pixel value of the image
- int GetMaxSet () const {return MaxSet;};
- int GetDepth () const {return Depth;}; // gets the depth
- int GetWidth () const {return Width; }; // gets the width
- int GetHeight() const {return Height;};
- float GetIntercept() const {return Intercept;}; // gets the Intercept from 0 (pixel value)
- float GetSlope () const {return Slope;}; // get the slope of the gray levels
- //************************************************************************
- // Purpose: returns the value of pixel (x,y).
- // Purpose: set the value of pixel (x,y).
- //************************************************************************
- virtual int GetPixelValue (int x, int y) const = 0;
- virtual void SetPixelValue (int x, int y, short val) = 0;
- //************************************************************************
- // Purpose: returns the value of pixel (x,y) without calibration factor
- // Purpose: set the value of pixel (x,y) without calibration factor
- //************************************************************************
- virtual short GetInternalPixel (int x, int y) const = 0;
- virtual void SetInternalPixel (int x, int y, short val) = 0;
- //************************************************************************
- // Purpose: an abstract method for returning a image.
- //************************************************************************
- virtual unsigned short * GetImage () const = 0;
- virtual UINT32 GetImageLength () const = 0;
- virtual unsigned short * Attach (void * PixelData) = 0;
- virtual unsigned short * Detach () = 0;
- virtual RealImage * GetImagePart (const DRect * lpRect) const = 0;
- // (x, y) is top-left corner
- virtual BOOL SetImagePart (int x, int y, const RealImage * realImage, int nOPCode = 0) = 0;
- virtual BOOL SaveAsWindowsBitmap (const char * filename) const = 0;
- virtual BOOL SaveAsRaw (const char * filename) const = 0;
- virtual void Scale (UINT NewWidth, UINT NewHeight) = 0;
- virtual void CalcHistogram (UINT32 HistogramData[256]) ;
- virtual void CalcMinMaxPixelValue (void) ;
- virtual HANDLE CreateDIB (void) const = 0;
- virtual HBITMAP CreateBitmap (void) const = 0;
- private:
- friend class ImageProcess;
- friend class DICOMImage;
- protected:
- int Width;
- int Height;
- int Depth;
- float Intercept; // intercept from 0
- float Slope; // factor
- int MinImage; // min pixel raw value of the image
- int MaxImage; // max pixel raw value of the image
- int MinSet; // min pixel value of the set of images
- int MaxSet; // max pixel value of the set of images
- };
- #endif // _DICOM_REALIMAGE_
|