CDVCImage Class Reference

#include "dvcImage.h"

List of all members.

Public Member Functions

BOOL Add (int nConstant)
BOOL Add (CDVCImage *pSrcImage)
BOOL And (int nConstant)
BOOL And (CDVCImage *pSrcImage)
 CDVCImage (char *szFileName)
 CDVCImage (PVOID pImageData, int w, int h, int bpp)
 CDVCImage (const CDVCImage &rImg)
 CDVCImage ()
BOOL CloseFile ()
BOOL Copy (CDVCImage *pSrcImage)
BOOL Create (ULONG nWidth, ULONG nHeight, ULONG nBytesPerPixel)
BOOL Divide (int nConstant, double dScaleResult)
BOOL Divide (CDVCImage *pDivisorImage, double dScaleResult, BOOL bClipTo12Bits=FALSE)
BOOL DivideCopy (CDVCImage *pSrcImage, int nConstant, BOOL bClipTo12Bits=FALSE)
int GetBitsPerPixel ()
BOOL GetIndex (int *pIndex)
BOOL GetMetaData (ImageMetaDataP pMeta)
BOOL GetRenderMethod (dvcRenderControl_t *pRenderOp)
BOOL GetSize (int *pWidth, int *pHeight, int *pDepth)
BOOL GetSize (PULONG pWidth, PULONG pHeight)
ULONG HistogramFreq (ULONG nBin)
BOOL HistogramMask (CDVCImage *pMask, double *pMean, double *pStdDev, ULONG *pMin, ULONG *pMax)
BOOL HistogramStats (double *pMean, double *pStdDev, ULONG *pMin, ULONG *pMax)
int Lock (PVOID *ppBuffer, PULONG pWidth, PULONG pHeight, PULONG pDepth)
BOOL Multiply (CDVCImage *pMultiplierImage, double dScaleResult)
BOOL Not (int nConstant)
BOOL Not (CDVCImage *pSrcImage)
BOOL OpenFile (LPSTR szFileName)
CDVCImageoperator *= (double k)
CDVCImageoperator *= (int k)
CDVCImageoperator *= (CDVCImage &rImg)
CDVCImageoperator+= (int k)
CDVCImageoperator+= (CDVCImage &rImg)
CDVCImageoperator-= (int k)
CDVCImageoperator-= (CDVCImage &rImg)
CDVCImageoperator/= (double d)
CDVCImageoperator/= (int k)
CDVCImageoperator/= (CDVCImage &rImg)
CDVCImageoperator= (int k)
CDVCImageoperator= (CDVCImage &rImg)
BOOL Or (int nConstant)
BOOL Or (CDVCImage *pSrcImage)
BOOL ReadCamera (HANDLE hDevice, ULONG uLeft, ULONG uTop, ULONG uWidth, ULONG uHeight)
BOOL ReadFile ()
BOOL ReadPixel (ULONG x, ULONG y, PULONG pPixData)
BOOL ReadRect (RECT *pRect, PVOID pPixData)
BOOL ReadRoi (ULONG x, ULONG y, ULONG width, ULONG height, PVOID pPixData)
BOOL ReadRow (ULONG x, ULONG y, ULONG width, PVOID pPixData)
int Release (void)
BOOL Render (LPSTR szFileName, RECT *pSrcRect, BYTE bBitsPerPixel, int nAppend=0)
BOOL Render (PVOID pRGBBuffer, RECT *pSrcRect, ULONG ulBytesPerLine, BYTE bBitsPerPixel, ULONG ulBufferLines=0)
BOOL ScaleLuts (int nRangeLow=-1, int nRangeHigh=-1)
BOOL SetIndex (int nIndex)
BOOL SetMetaData (ImageMetaDataP pMeta)
BOOL SetRenderMethod (dvcRenderControl_t *pRenderOp)
BOOL Subtract (CDVCImage *pSubImage, int nOffset)
BOOL Subtract (CDVCImage *pSubImage)
BOOL SubtractDivide (CDVCImage *pFlatImage, CDVCImage *pBkgImage, double dScaleResult, BOOL bClipTo12Bits=FALSE)
BOOL Xor (int nConstant)
BOOL Xor (CDVCImage *pSrcImage)
virtual ~CDVCImage ()


Detailed Description

Simple image class for acquistion, processing and file I/O methods. Supported image types are 8 and 16 bit monochrome and 32 bit color.

All methods with a BOOL return type return a TRUE on success of FALSE if an error occurs.

This class maintains a private set of meta data which is automatically updated from a camera when the ReadCamera() method is called and saved with the Render() method.

Examples:

avgdvc.cpp, and FullScreen.cpp.


Constructor & Destructor Documentation

CDVCImage::CDVCImage (  ) 

Create an instance of a DVC Image Class

CDVCImage::CDVCImage ( const CDVCImage rImg  ) 

Copy an Image

Parameters:
rImg source image to be copied.

CDVCImage::CDVCImage ( PVOID  pImageData,
int  w,
int  h,
int  bpp 
)

Create an Image from a buffer of given width, height and depth.

Parameters:
pImageData pointer to an image buffer with bpp bytes per pixel.
w width in pixels of the pImageData buffer.
h height in pixels of the pImageData buffer.
bpp number of bytes per pixel.

CDVCImage::CDVCImage ( char *  szFileName  ) 

Instantiates a DVC Image Class from a file. Supported file types are TIF, JPEG and BMP.

Parameters:
szFileName file path and name of the image file to open.

CDVCImage::~CDVCImage (  )  [virtual]

close an image and release all resources.


Member Function Documentation

BOOL CDVCImage::Add ( int  nConstant  ) 

Add a constant integer to an image.

this(x,y) += nConstant

Parameters:
nConstant constant added to each pixel. Output is clipped to the maximum DN of the original image.

BOOL CDVCImage::Add ( CDVCImage pSrcImage  ) 

Add two images.

this(x,y) += pSrcImage(x,y)

Parameters:
pSrcImage source image for pixel by pixel addition. Output is clipped to the maximum DN of the original image.
Examples:
avgdvc.cpp.

BOOL CDVCImage::And ( int  nConstant  ) 

Bitwise logical AND of an image and a constant.

this(x,y) &= nConstant

Parameters:
nConstant AND'd with each pixel.

BOOL CDVCImage::And ( CDVCImage pSrcImage  ) 

Bitwise logical AND of two images.

this(x,y) &= pSrcImage(x,y)

Parameters:
pSrcImage source image for pixel by pixel AND operation.

CDVCImage::CloseFile (  ) 

Close an open image file and releases disk and system resources.

Examples:
avgdvc.cpp.

BOOL CDVCImage::Copy ( CDVCImage pSrcImage  ) 

Copy an image

Parameters:
pSrcImage the source image to copy. If a different size or depth, the resulting image is resized to match pSrcImage.

BOOL CDVCImage::Create ( ULONG  nWidth,
ULONG  nHeight,
ULONG  nBytesPerPixel 
)

Create and allocate memory for an image of a given width x height x bytes

Parameters:
nWidth width of image in pixels
nHeight height of image in pixels
nBytesPerPixel bytes per pixel.
Examples:
avgdvc.cpp.

BOOL CDVCImage::Divide ( int  nConstant,
double  dScaleResult 
)

Divide and image by a constant and scale the result by a constant.

this(x,y) = this(x,y) / nConstant * dScaleResult

Parameters:
nConstant constant to divide each pixel by.
dScaleResult constant multiplier to scale the pixel by pixel result.

BOOL CDVCImage::Divide ( CDVCImage pDivisorImage,
double  dScaleResult,
BOOL  bClipTo12Bits = FALSE 
)

Divide and image by another image scaling the results by a constant and optionally clipping the returnined image between 0 and 4095.

this(x,y) /= pDivisorImage(x,y) * dScaleResult

Parameters:
pDivisorImage image divided into this image pixel by pixel.
dScaleResult constant multiplier to scale the pixel by pixel result.
bClipTo12Bits clips the output between 0 and 4095 if TRUE.

BOOL CDVCImage::DivideCopy ( CDVCImage pSrcImage,
int  nConstant,
BOOL  bClipTo12Bits = FALSE 
)

Divide a source image by a constant, and return the optionally clipped results.

this(x,y) = pSrcImage(x,y) / nConstant

Parameters:
pSrcImage numerator image.
nConstant constant denominator
bClipTo12Bits when TRUE clips the output between 0 and 4095.
Examples:
avgdvc.cpp.

int CDVCImage::GetBitsPerPixel (  ) 

Get the number of bits per pixel. Unlike the pDepth parameter in GetSize() which returns the number of bytes used for storage, this method returns the number of bits which may be 10, 12, 14 or 16 for an image with two bytes per pixel. Set in ReadCamera().

Returns:
the number of bits per pixel.
See also:
GetSize(), ReadCamera().

BOOL CDVCImage::GetIndex ( int *  pIndex  ) 

Returns the image index of a multipage TIFF file.

Parameters:
pIndex returns the current zero based index or page.
See also:
OpenFile().

BOOL CDVCImage::GetMetaData ( ImageMetaDataP  pMeta  ) 

Get or Copy the meta data from this image.

Parameters:
pMeta pointer to an ImageMetaData structure to copy from this image.
See also:
ReadCamera(), Render().

BOOL CDVCImage::GetRenderMethod ( dvcRenderControl_t pRenderOp  ) 

Get up an image's render method

Parameters:
pRenderOp structure sets the rendering method.
See also:
Render().
Examples:
FullScreen.cpp.

BOOL CDVCImage::GetSize ( int *  pWidth,
int *  pHeight,
int *  pDepth 
)

Returns the width and height of an image in pixels and depth in bytes per pixel.

Parameters:
pWidth returned with the image buffer's width
pHeight returned with the image buffer's height
pDepth returned with the image buffers's depth in bytes per pixel.

BOOL CDVCImage::GetSize ( PULONG  pWidth,
PULONG  pHeight 
)

Returns the width and height of an image in pixels.

Parameters:
pWidth returned with the image buffer's width
pHeight returned with the image buffer's height

ULONG CDVCImage::HistogramFreq ( ULONG  nBin  ) 

Get the frequency of a selected bin in the image's histogram.

Parameters:
nBin the DN frequency
Returns:
the frequency at DN of nBin

BOOL CDVCImage::HistogramMask ( CDVCImage pMask,
double *  pMean,
double *  pStdDev,
ULONG *  pMin,
ULONG *  pMax 
)

Compute the histogram statistics using a second image as a mask for the pixels to be included.

Parameters:
pMask image with non-zero pixels used to include in the histogram
pMean returns the mean DN in the image.
pStdDev returns the standard deviation of DN in the image.
pMin returns the minimum DN in the image.
pMax returns the maximum DN in the image.

BOOL CDVCImage::HistogramStats ( double *  pMean,
double *  pStdDev,
ULONG *  pMin,
ULONG *  pMax 
)

Compute the histogram statistics of an image buffer.

Parameters:
pMean returns the mean DN in the image.
pStdDev returns the standard deviation of DN in the image.
pMin returns the minimum DN in the image.
pMax returns the maximum DN in the image.
Examples:
FullScreen.cpp.

int CDVCImage::Lock ( PVOID *  ppBuffer,
PULONG  pWidth,
PULONG  pHeight,
PULONG  pDepth 
)

Lock an image's resources returning a pointer to the image's pixel data.

Parameters:
ppBuffer returned with the pointer to the image data.
pWidth returned width.
pHeight returned height.
pDepth returned bytes per pixel.

BOOL CDVCImage::Multiply ( CDVCImage pMultiplierImage,
double  dScaleResult 
)

Multiply and image by another image scaling the result by a constant.

this(x,y) *= pMultiplierImage(x,y) * dScaleResult

Parameters:
pMultiplierImage image divided into this image pixel by pixel.
dScaleResult constant multiplier to scale the pixel by pixel result.

BOOL CDVCImage::Not ( int  nConstant  ) 

Negate a constant.

this(x,y) = ~nConstant

Parameters:
nConstant value negated and written to each pixel.

BOOL CDVCImage::Not ( CDVCImage pSrcImage  ) 

Negate an image.

this(x,y) = ~pSrcImage(x,y)

Parameters:
pSrcImage source image returned with each pixel negated.

BOOL CDVCImage::OpenFile ( LPSTR  szFileName  ) 

Open and read an image file. Supported file types are TIFF, JPEG and BMP.

Parameters:
szFileName file path and name of the image file to open.
TIFF images with one 16-bit sample per pixel are read as raw image 16-bit image. All others are converted to color with 8 bits per red, green and blue channel.

CDVCImage & CDVCImage::operator *= ( double  k  ) 

multiply an image by a double precision constant

this(x,y) *= k

Parameters:
k constant to multiply this image.

CDVCImage & CDVCImage::operator *= ( int  k  ) 

multiply an image by an integer constant

this(x,y) *= k

Parameters:
k constant to multiply this image.

CDVCImage & CDVCImage::operator *= ( CDVCImage rImg  ) 

Multiply two images

this(x,y) = this(x,y) * rMultiplyImage(x,y)

Parameters:
rImg image to mulitiply by this image, pixel by pixel. Overflows are clipped to the maximum DN this image depth supports.

CDVCImage & CDVCImage::operator+= ( int  k  ) 

Add a constant to an image

this(x,y) += k

Parameters:
k integer constant to add. Overflow is clipped to the maximum DN the depth supports.

CDVCImage & CDVCImage::operator+= ( CDVCImage rImg  ) 

Add an image

this(x,y) += rAddImage(x,y)

Parameters:
rImg image to add. Must be the same dimension (width and height) as this image. Overflow is clipped to the maximum DN the depth supports.

CDVCImage & CDVCImage::operator-= ( int  k  ) 

Subtract a constant from an image

this(x,y) -= k

Parameters:
k integer constant to subtract. Underflow is clipped to 0.

CDVCImage & CDVCImage::operator-= ( CDVCImage rImg  ) 

Subtract an image

this(x,y) -= rImg(x,y)

Parameters:
rImg is subtracted from the buffer, pixel by pixel. Must be the same dimension (width and height) as this image. Underflow is clipped to 0.

CDVCImage & CDVCImage::operator/= ( double  d  ) 

divide an image by a double precision constant

this(x,y) /= d

Parameters:
d constant to divide into this image.

CDVCImage & CDVCImage::operator/= ( int  k  ) 

divide an image by an integer constant

this(x,y) /= k

Parameters:
k constant to divide into this image.

CDVCImage & CDVCImage::operator/= ( CDVCImage rImg  ) 

Divide an image by another image

this(x,y) = this(x,y) / rImg(x,y)

Parameters:
rImg is divided into this image, pixel by pixel.

CDVCImage & CDVCImage::operator= ( int  k  ) 

Fill this image with a constant

this(x,y) = k

Parameters:
k constant to fill an image with.

CDVCImage & CDVCImage::operator= ( CDVCImage rImg  ) 

Assignment operator

Parameters:
rImg source image copied to the new image. This image is modified to match the size and depth of rSourceImage.

BOOL CDVCImage::Or ( int  nConstant  ) 

Bitwise logical OR of an image and a constant.

this(x,y) |= nConstant

Parameters:
nConstant OR'd with each pixel.

BOOL CDVCImage::Or ( CDVCImage pSrcImage  ) 

Bitwise logical OR of two images.

this(x,y) |= pSrcImage(x,y)

Parameters:
pSrcImage source image for pixel by pixel OR operation.

BOOL CDVCImage::ReadCamera ( HANDLE  hDevice,
ULONG  uLeft,
ULONG  uTop,
ULONG  uWidth,
ULONG  uHeight 
)

Read a captured image from a DVC camera.

Parameters:
hDevice returned from dvcOpenCamera().
uLeft first column in camera's readout area to return.
uTop first row in camera's readout area to return.
uWidth width in pixels to copy.
uHeight height in pixels to copy.
An internal ImageMetaData copy is updated with the last captured image, and the render method's lookup tables are updated from the camera device.
Examples:
avgdvc.cpp, and FullScreen.cpp.

BOOL CDVCImage::ReadFile (  ) 

Copies or updates the image data in from an image file. Internally called by OpenFile() and SetIndex().

BOOL CDVCImage::ReadPixel ( ULONG  x,
ULONG  y,
PULONG  pPixData 
)

Get the pixel data at a given x,y position.

Parameters:
x the horizontal or column pixel location
y the vertical or row pixel location
pPixData returns the DN at pixel x,y.

BOOL CDVCImage::ReadRect ( RECT *  pRect,
PVOID  pPixData 
)

Get the pixel data from a rectangular region within an image.

Parameters:
pRect pointer to a RECT struct with the area to return
pPixData returns the array of DN from pixel pRect->left, pRect->top to pRect->right, pRect->bottom.
Same as
 	::ReadRoi(
                pRect->left,
                pRect->top, 
                pRect->right - pRect->left,
                pRect->bottom - pRect->top,
                pPixData );

BOOL CDVCImage::ReadRoi ( ULONG  x,
ULONG  y,
ULONG  width,
ULONG  height,
PVOID  pPixData 
)

Get the pixel data from a rectangular region within an image.

Parameters:
x the horizontal or column starting pixel location
y the vertical or row starting pixel location
width the number of columns to return
height the number of rows to return
pPixData returns the array of DN from pixel x,y to x+width,y+height

BOOL CDVCImage::ReadRow ( ULONG  x,
ULONG  y,
ULONG  width,
PVOID  pPixData 
)

Get the pixel data at a given row starting at x,y for width pixels.

Parameters:
x the horizontal or column starting pixel location
y the vertical or row starting pixel location
width the number of columns to return
pPixData returns the array of DN from pixel x,y to x+width,y

int CDVCImage::Release ( void   ) 

Release a locked image.

Examples:
FullScreen.cpp.

BOOL CDVCImage::Render ( LPSTR  szFileName,
RECT *  pSrcRect,
BYTE  bBitsPerPixel,
int  nAppend = 0 
)

Render an image to a file using the internal render method.

Parameters:
szFileName the path and name of the file to be written.
pSrcRect is the region to render or NULL if the entire image.
bBitsPerPixel number of bits per pixel to render.
nAppend is 0 to write a single image, 1 to append a multipage TIFF or 2 to append and close a multipage TIFF.
The default rendering method outputs the raw data to a TIFF file format. If pFileName ends with tif, jpg or bmp, the corresponding file type is rendered automatically. Otherwise, after calling SetRenderMethod() with an eMethod of
          DVC_FORMAT_RAW, default, saves as a TIFF format with the original data.
          DVC_RENDER_TIFF saves a color TIFF format image file,
          DVC_RENDER_BMP saves a color BMP format image file.
          DVC_RENDER_JPG saves a color JPEG format image file.

In the later cases, the file type is automatically appended to the szFileName.

BOOL CDVCImage::Render ( PVOID  pRGBBuffer,
RECT *  pSrcRect,
ULONG  ulBytesPerLine,
BYTE  bBitsPerPixel,
ULONG  ulBufferLines = 0 
)

Render an image to a buffer using the internal render method.

Parameters:
pRGBBuffer destination buffer rendered.
pSrcRect optional region to be rendered or NULL if the full image.
ulBytesPerLine number of bytes per line in pRGBBuffer.
bBitsPerPixel number of bits per pixel to render.
ulBufferLines number of lines ( vertical dimension ) of pRGBBuffer. If ulBufferLines is 0, the height of the output buffer is assumed to be greater or equal the height of the pSrcRect or the current image buffer.
Intended for rendering an image to a display buffer writing the output using the private lookup tables.
Examples:
avgdvc.cpp, and FullScreen.cpp.

BOOL CDVCImage::ScaleLuts ( int  nRangeLow = -1,
int  nRangeHigh = -1 
)

Rescale the render luts to a given range.

Parameters:
nRangeLow DN equal or greater than outputs mapped to black
nRangeHigh DN equal or less than outputs mapped to white or full scale.
If either nRangeLow or nRangeHigh is -1, the output is autmatically scaled between the minimum and/or maximum DN in the current image.
Examples:
FullScreen.cpp.

BOOL CDVCImage::SetIndex ( int  nIndex  ) 

Sets the image index of a multipage TIFF file and copies the image data.

Parameters:
nIndex the current zero based index or page.
See also:
OpenFile().

BOOL CDVCImage::SetMetaData ( ImageMetaDataP  pMeta  ) 

Set or Copy the meta data to this image.

Parameters:
pMeta pointer to an ImageMetaData structure to copy to this image.
See also:
ReadCamera(), Render().

BOOL CDVCImage::SetRenderMethod ( dvcRenderControl_t pRenderOp  ) 

Set an image's render method

Parameters:
pRenderOp structure sets the rendering method.
See also:
Render().
Examples:
FullScreen.cpp.

BOOL CDVCImage::Subtract ( CDVCImage pSubImage,
int  nOffset 
)

subtract an image with an offset

this(x,y) -= pSubImage(x,y) + nOffset

Parameters:
pSubImage is subtracted from this image, pixel by pixel
nOffset is added to each pixel before returning.

BOOL CDVCImage::Subtract ( CDVCImage pSubImage  ) 

subtract an image.

this(x,y) -= pSubImage(x,y)

Parameters:
pSubImage is subtracted from this image, pixel by pixel

BOOL CDVCImage::SubtractDivide ( CDVCImage pFlatImage,
CDVCImage pBkgImage,
double  dScaleResult,
BOOL  bClipTo12Bits = FALSE 
)

Subtract a background image and divide by a flatfield, single pass Results are scaled by a constant dScaleResult and optionally clipped to a 12-bits (0-4095).

this(x,y) = ( this(x,y) - pBkgImage(x,y) ) / pFlatImage(x,y) * dScaleResult

Normally, dScaleResult is set to the mean DN of the pFlatImage image.

Parameters:
pFlatImage image to be divided into the source
pBkgImage image to be subtracted from the source
dScaleResult constant used to rescale the returned image.
bClipTo12Bits when TRUE returns the result clipped between 0 and 4095.

BOOL CDVCImage::Xor ( int  nConstant  ) 

Bitwise logical XOR of an image and a constant.

this(x,y) ^= nConstant

Parameters:
nConstant XOR'd with each pixel.

BOOL CDVCImage::Xor ( CDVCImage pSrcImage  ) 

Bitwise logical XOR of two images.

this(x,y) ^= pSrcImage(x,y)

Parameters:
pSrcImage source image for pixel by pixel XOR operation.


The documentation for this class was generated from the following files:
©DVC Company, 2006. All rights reserved.    www.dvcco.com   Created Thu Nov 16 10:07:23 2006