Page 17 out of 26 total pages


QbGenericImageDataClass


QbGenericImageDataClass is derived from the QbGenericDataClass. It includes all the methods of the superclass, plus other methods specific to processing images, such as reading the image from memory or disk, getting the image's size, and specifying a mask image which allow you to query a subpart of an image based on a reference image (the mask).

ToQueryString in the derived class is implemented to encode the domain-specific data, and then to call the base class ToQueryString method to encode the generic information. FromQueryString reverses this process.

QbGenericImageDataClass includes methods ReadImageDataFromFile and ReadImageDataFromPickerFile, which perform image I/O. They support reading a variety of common image formats, including:

Dwidth,height:Rulx,uly,rwidth,rheight,R,G,B:...

where:

QbGenericImageDataClass method

This is the constructor for the class.

Syntax

QbGenericImageDataClass( void )

Parameters

None

~QbGenericImageDataClass method

This is the destructor for the class.

Syntax

virtual ~QbGenericImageDataClass( void )

Parameters

None

DecodeSubPartDef method

This method decodes a subpart definition from a QbDatumClass instance, and initializes the object's private variables describing the subparts. This method assumes the image that corresponds to the parent key has already been stored in the object. If not, this method will give unexpected results.

Syntax

virtual int DecodeSubPartDef( const QbDatumClass &subPartDatum )

Parameters

Input

subPartDatum-A reference to a QbDatumClass object whose byte string holds the subpart information to be decoded

Output

An integer value: 0 indicates success; -1 indicates failure

EncodeSubPartDef method

This method encodes the subpart definition inside the object to a byte string, and assigns it to the byte string of the input QbDatumClass object.

Syntax

virtual int EncodeSubPartDef( QbDatumClass &subPartDatum )

Parameters

Input

subPartDatum-A reference to a QbDatumClass object that will hold the encoded subpart description

Output

An integer value: 0 indicates success; -1 indicates failure

FromQueryString method

This method decodes a byte string of a QbDatumClass object to initialize the object.

Syntax

virtual int FromQueryString( const QbDatumClass &datum, const char 
*featureClassname )

Parameters

Input

Output

An integer value: 0 indicates success; -1 indicates failure

GetFilename method

This method returns the image name whose data the current object represents.

Syntax

const char * GetFilename( void )

Parameters

Input

None

Output

A pointer to a string to hold the file name

GetImage method

This method returns a pointer to an array of image pixel indexing.

Syntax

unsigned char * GetImage( void )

Parameters

Input

None

Output

A pointer to an unsigned char. Its size is Xsize*Ysize, where Xsize and Ysize are the width and height of the image. The pixel index value at point (x,y) should be:

GetImage()[y*Xsize+x]

For more information, see the "GetLut method" on page  131, "GetXsize method" on page  132, and "GetYsize method" on page  132. Also, see the "GetImageDataFromMemory method" on page  130.

GetImageDataFromMemory method

This method initializes a QbGenericImageDataClass object using a given image in memory. The memory image should include a palette with a color table or look-up table.

Syntax

int GetImageDataFromMemory( const unsigned long width, const unsigned 
long height, unsigned char *imageArg, unsigned char *lutArg, 
unsigned char *maskArg, const Boolean subpart = False, Boolean 
deletesStorageArg = False )

Parameters

Input

Output

An integer value: 0 indicates success; -1 indicates failure

GetLut method

This method returns a pointer to the look-up table, which has an array size of 768 (256 * 3).

Syntax

unsigned char * GetLut( void )

Parameters

Input

None

Output

A pointer to an unsigned char array

GetMask method

This method returns a pointer to the array to hold the image mask.

Syntax

unsigned char * GetMask( void )

Parameters

Input

None

Output

A pointer to an unsigned char array that holds the image mask

GetMaskname method

This method returns the mask image name whose data the current object represents.

Syntax

const char * GetMaskname( void )

Parameters

Input

None

Output

A pointer to a string to hold the mask file name

GetXsize method

This method returns the width of the image.

Syntax

unsigned long GetXsize( void )

Parameters

Input

None

Output

An unsigned long integer to hold the image's width

GetYsize method

This method returns the height of the image.

Syntax

unsigned long GetYsize( void )

Parameters

Input

None

Output

An unsigned long integer to hold the image's height

Itype method

This method returns the interface type defined in the base class.

Syntax

virtual const QbInterfaceType Itype( void )

Parameters

Input

None

Output

GenericDataInterfaceType of QbInterfaceType defined in the QbBaseClass. See page 49.

ReadImageDataFromFile method

This method reads in image data from a file.

Syntax

int ReadImageDataFromFile( const char *filename, const char 
*maskFileName = NULL, const Boolean subpart = False )

Parameters

Input

Output

An integer value: 0 indicates success; -1 indicates failure

ReadImageDataFromPickerFile method

This method reads in image data from a picker file.

Syntax

int ReadImageDataFromPickerFile( const char *filename, const char 
*maskFileName = NULL, const Boolean subpart = False )

Parameters

Input

Output

An integer value: 0 indicates success; -1 indicates failure

ReadPickerImageDescriptionFile method

This method reads a picker image description from a file.

Syntax

int ReadPickerImageDescriptionFile( const char *filename, const 
Boolean subpart = False )

Parameters

Input

Output

An integer value: 0 indicates success; -1 indicates failure

ReadPickerImageDescriptionString method

This method reads a picker image description from a string. QBIC currently supports only rectangles for this method.

Syntax

int ReadPickerImageDescriptionString( const char *dstr, const Boolean 
subpart = False )

Parameters

Input

Output

An integer value: 0 indicates success; -1 indicates failure

ToQueryString method

This method encodes the content of the object to a byte string and assigns it to the byte string of the input QbDatumClass object.

Syntax

virtual int ToQueryString( QbDatumClass &datum )

Parameters

Input

datum-A reference to a QbDatumClass object that will hold the byte string that encodes the object data

Output

An integer value: 0 indicates success; -1 indicates failure

Type method

This method returns a constant string of the class name.

Syntax

virtual const char * Type( void )

Parameters

Input

None

Output

A constant string, QbGenericImageDataClass

UpdateMaskInImageObject method

This method reads the given maskFileName and updates the object's image mask.

Syntax

int UpdateMaskInImageObject( const char *maskFileName )

Parameters

Input

maskFileName-A pointer to a string that contains the mask file name

Output

An integer value: 0 indicates success; -1 indicates failure




Page 17 out of 26 total pages


xzhu@almaden.ibm.com or tedl@almaden.ibm.com
Copyright © 1998, IBM Corporation. All rights reserved.