//************************************************************************** // FILENAME : RealImage16.h // // CLASSES : RealImage16 // //* ECOMPACS DICOM Network Transport Libraries * Version 0.1 Beta //************************************************************************** #ifndef _DICOM_REALIMAGE_16_ #define _DICOM_REALIMAGE_16_ #include "RealImage.hpp" //************************************************************************** // class RealImage16 //************************************************************************** class DICOM_API RealImage16 : public RealImage { public: RealImage16 (unsigned short *theImage, int width, int height, int depth, int min, int max, int minSet, int maxSet, float offset = 0, float slope = 1); RealImage16 (const RealImage16 & OrgImage16); virtual ~RealImage16(); 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 ; //************************************************************************ // 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) = (unsigned short)((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 * 2; } virtual unsigned short * Attach (void * pixelData) { unsigned short * t = (unsigned short *) PixelData; PixelData = (unsigned short *) 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 short * PixelData; }; #endif // _DICOM_REALIMAGE_16_