The following items are included:
imago.jar containing com.scitouch.Imago wrapper classlib directory containing binaries for all supported platforms:lib/Linux/x86/libimagojni.so — 32-bit Linux binarylib/Linux/x64/libimagojni.so — 64-bit Linux binarylib/Win/x86/imagojni.dll — 32-bit Windows binarylib/Win/x64/imagojni.dll — 64-bit Windows binarylib/Mac/10.5/libimagojni.dylib — Mac OS 10.5 binarylib/Mac/10.6/libimagojni.dylib — Mac OS 10.6 binaryDepending on the OS and architecture, proper binaries are loaded automatically.
Imago class object represents a library instance. All operations are represented by methods of this object.
Several library instances may be created within one thread to act simultaneously and independently. However,
each instance requires a certain amount of memory, and thus it is recommended to have as few instances as
possible.
The procedure for rendering workflow is the following:
recognize().getResult()Any method of the Imago class can throw and Exception if something got wrong. The recognize() method
can throw an Imago.NoResultException in case the image has failed to be recognized as a molecule.
Imago (String path);
Receives the path to Win and Linux directories containing binary modules (see distribution section above for details). E.g., if the libraries are stored in lib/Win/ and
lib/Linux directories, call new Imago(“lib”). You can specify absolute paths as well.
Imago ();
Same as Imago(“lib”).
Instances are independent and are safe to be used in parallel.
void loadPNG (byte[] buf);
Loads a PNG image from memory buffer.
void loadPNG (String filename);
Loads a PNG image from file.
void setFilter (String filter);
void setBinarizationLevel (int level);
void setConfig (int n);
Sets one of pre-loaded configuration parameter sets. n is the index of the set, which must be nonnegative
and less than the number of parameter sets, which you can know from Imago.configsCount public variable. The
index of the parameter set is saved to currentConfigId public member.
void setLogCallback (ImagoLogCallback callback);
ImagoLogCallback is an interface defined within Imago class which has only one method:
public interface ImagoLogCallback {
public void log (String str);
}
void recognize ();
string getResult ();
Returns a string with the recognized molecule in Molfile format.
com.scitouch.Imago imago = new com.scitouch.Imago();
imago.setLogCallback(new Imago.ImagoLogCallback() {
public void log(String str) {
System.out.print(str);
}
});
imago.setFilter("blur");
imago.setBinarizationLevel(150);
imago.loadPNG("my-image.png");
imago.recognize();
System.out.println(imago.getResult());