This chapter applies to using ImageWarp as an automation server. It is intended for developers who are willing to write their own application while taking an advantage of ImageWarp's functionality. Provided are examples of COM programming in C++ and Visual Basic.
Component Object Model (COM) is one of the mechanisms of interprocess communication supported under Windows. It allows a third party program to manipulate an application's object from outside the application. An "Automation server" is an application that exposes programmable objects to other applications, which are called "Automation clients." This exposure enables clients to "automate" certain functions by directly accessing objects and using the services they provide. When ImageWarp is used as a COM server, it can be integrated with any application written in a programming language that can interface to COM objects (such as Visual Basic, VB.NET, Visual C++, C#, Java).
When a client application that has an ImageWarp COM object embedded is executed, it will automatically start ImageWarp in the invisible mode. Typically the client application would use COM methods to instruct ImageWarp to perform a series of image processing and analysis command and then request the results from ImageWarp. During this process both the client application and ImageWarp must be synchronized.
The client application can instruct ImageWarp to load a desired script file and execute it by calling the Load and Run methods. The client then has to wait for the script to end. This can be done by continuously checking the Status property of ImageWarp COM object until a return value becomes "IDLE". As soon as it happens, the client can request the desired data through the GetParam, and GetGridCell methods.
Alternatively, ImageWarp can notify the client application about completing a certain image processing block by firing COM events via the sendMessage script function. This technique is more efficient, as ImageWarp does not have to process continuous Status requests from the client during the execution of the script.
If the application requires multiple data transfers during the script execution or if it is using a cyclic script, the pause function can be used throughout the script to notify the client and make it initiate the data transfer. Once the client receives and process the data, it should call the Run method to have ImageWarp continue the script execution.
The client application can exchange images with ImageWarp via GetImageArray and SetImageArray methods. ImageWarp's GUI can be brought on screen with the Show method.
Before using ImageWarp as an Automation server, make sure to execute it so it can register itself in your system. As an alternative, you can register it by issuing the following command in the Command Prompt:
C:\Program Files\ImageWarp\ImageWarp.exe /register
Next section provides full reference to ImageWarp's COM properties, methods and events.