GGA Sofware Services

Table of Contents

C Library Reference

Distribution

The following items are included:

Interface

The function headers in imago_c.h file are the following:

/* All functions return 0 on error, and a nonzero value on success */

/* Imago library acts as a state machine.
 * You can use multiple Imago instances simultaneously, using the
 * 'session ID-s' (see below). It is obligatory to allocate at least one
 * instance to get Imago library work properly.
 */

/* Get the last error message.
 * This can be called if some other function returned zero value.
 */
const char *imagoGetLastError();

/* Allocate an instance. All instances are independent, that is,
 * they have separate images, configurations settings, resulting
 * molfiles, and error messages.
 * Using Imago library without allocation an instance will cause an error.
 */
 qword imagoAllocSessionId();

/* Set the ID of the instance you are working with from current thread */
void imagoSetSessionId( qword id );

/* Release a previously allocated instance */
void imagoReleaseSessionId( qword id );

/* Set one of predefined configuration sets.
 * The given number must be nonnegative and less than the number of
 * available configuration sets. By default, the number is 0.
 */
 int imagoSetConfigNumber( const int number );

/* Get the number of available predefined configuration sets. */
 int imagoGetConfigsCount();

/* Choose filter to process image before recognition. 
 * name can be "sharp" or "blur".
 * By default, filter from current config will be used.
 */
int imagoSetFilter( const char *name );

/* Manually choose binarization level for image.
 * level can be between 0 and 255.
 * If the pixel color is less than the given level, it is considered black.
 * Otherwise, white. By default, the level from the current configuration set
 * will be used.
 */
int imagoSetBinarizationLevel( const int level );

/* PNG image loading functions. */
int imagoLoadPngImageFromBuffer( const char *buf, const int buf_size );
int imagoLoadPngImageFromFile( const char *FileName );

/* PNG image saving function. */
int imagoSavePngImageToFile( const char *FileName );

/* Load raw grayscale image - byte array of length width*height. */
int imagoLoadGreyscaleRawImage( const char *buf, const int width, const int height );

/* Set the callback function for log printing. 
 * By default, log is printed to the standard output.
 */
int imagoSetLogPrinter( void (*printer)( const char *str ) );

/* Disable log printing (set quiet mode). */
int imagoDisableLog();

/* Attach some arbitrary data to the current Imago instance. */
int imagoSetSessionSpecificData( void *data );
int imagoGetSessionSpecificData( void **data );

/* Main recognition routine. 
 * Image must be loaded previously. */
int imagoRecognize();

/* Molfile (.mol) output functions. */
int imagoSaveMolToBuffer( char **buf, int *buf_size );
int imagoSaveMolToFile( const char *FileName );