//************************************************************************** // FILENAME : RealImageRGB.h // // CLASSES : RealImageRGB // //* ECOMPACS DICOM Network Transport Libraries * Version 0.1 Beta //************************************************************************** #ifndef _DICOM_REALIMAGE_RGB_ #define _DICOM_REALIMAGE_RGB_ #include "RealImage.hpp" //************************************************************************** // class RealImageRGB //************************************************************************** class DICOM_API RealImageRGB : public RealImage { public: RealImageRGB (unsigned char *theImage, int width, int height, int depth, int min, int max, int minSet, int maxSet, float offset = 0, float slope = 1); RealImageRGB (const RealImageRGB & OrgImageRGB); virtual ~RealImageRGB(); virtual void Invert (); virtual void FlipVertical (void) ; virtual void FlipHorizontal (void) ; virtual void Rotate (RotateAngle angle) ; //************************************************************************ // Purpose: to get the 8 bits image (240 gray levels) from the image data. //************************************************************************ virtual unsigned char * GetPixmap (BOOL relativMode) const; //************************************************************************ // Purpose: to get the 8 bits image (240 gray levels) from the image data, // corresponding to the given colortable. //************************************************************************ virtual unsigned char * GetPixmap (unsigned char *colortable) const; virtual unsigned char * GetPixmapEx (unsigned char *colortable) const; virtual unsigned char * GetPixmap (void) const; virtual RealImage8 * Remap (void) const; //************************************************************************ // Purpose: returns the value of pixel (x,y). // Purpose: set the value of pixel (x,y). //************************************************************************ int GetPixelValue (int x, int y) const { return (int)((float)(*(PixelData + ((long)y) * Width + x) * Slope) + Intercept); }; void SetPixelValue (int x, int y, short val) { *(PixelData + ((long)y) * Width + x) = (char)((float)(val - Intercept) / Slope); }; //************************************************************************ // Purpose: returns the value of pixel (x,y) without calibration factor // Purpose: set the value of pixel (x,y) without calibration factor //************************************************************************ short GetInternalPixel (int x, int y) const { return (short) *(PixelData + ((long)y) * Width + x); }; void SetInternalPixel (int x, int y, short val); //************************************************************************ // Purpose: an abstract method for returning a image. //************************************************************************ unsigned short* GetImage () const { return (unsigned short *) PixelData;}; virtual UINT32 GetImageLength () const { return Width * Height * 3; } virtual unsigned short * Attach (void * pixelData) { unsigned short * t = (unsigned short *) PixelData; PixelData = (unsigned char *) pixelData; return t; } virtual unsigned short * Detach () { unsigned short * t = (unsigned short *) PixelData; PixelData = NULL; return t; } virtual RealImage * GetImagePart (const DRect * lpRect) const; // (x, y) is top-left corner virtual BOOL SetImagePart (int x, int y, const RealImage * realImage, int nOPCode = 0); virtual BOOL SaveAsWindowsBitmap (const char * filename) const ; virtual BOOL SaveAsRaw (const char * filename) const ; virtual void Scale (UINT NewWidth, UINT NewHeight); virtual HANDLE CreateDIB (void) const ; virtual HBITMAP CreateBitmap (void) const; private: friend class ImageProcess; friend class DICOMImage; private: unsigned char * PixelData; void ConvertTo240 (RGBQUAD * origCol, RGBQUAD * convertedCol); }; #endif // _DICOM_REALIMAGE_RGB_