IDL 8.0 introduces an entirely new graphics interface. Currently, there is no name for this system except Graphics (am I supposed to say it capitalized when talking?), so I will refer to them as function graphics because all the routines are functions instead of procedures as in most direct graphics and iTools graphics routines. This new system is easy to use, interactive, programmatically accessible, and fairly complete even in this first release.
One major problem with the iTools is that controlling them via a script can be quite complicated (and I'm not even talking about extending them, i.e., adding new capabilities to them). IDL 7.1 is a major change in the programmatic iTools API: many routines were renamed, several routines were added, and a couple keywords were added.
`MGitWriteSparkline` is an example of a file writer for the iTools system. It creates a PNG file representing a [sparkline](http://en.wikipedia.org/wiki/Sparkline) for vector data. Sparklines are intense, word-like graphics like 55. Readers and writers are some of the simplest components to add to an iTool and a good place to start learning how to create custom iTools.
In order to run this demo, you will need the the [`MGitWriteSparkline` class](http://michaelgalloy.com/demos/itools/mgitwritesparkline__define.pro) ([doc](http://michaelgalloy.com/demos/itools/mgitwritesparkline__define.html)), the [calling program](http://michaelgalloy.com/demos/itools/mg_sparkwriter_demo.pro) ([doc](http://michaelgalloy.com/demos/itools/mg_sparkwriter_demo.html)), and the [original sparklines routine](https://github.com/mgalloy/mglib/tree/master/src/vis/lineplots/sparklines/mg_sparkline.pro) ([doc](http://michaelgalloy.com/lib/sparklines/mg_sparkline.html) and see [this article](http://michaelgalloy.com/2006/04/19/sparklines-implementation.html) about the sparklines routine).
Every component in the iTools has a unique identifier placing it in a hierarchy of components for the tool. This identifier is necessary to programmatically use the component. So how do you find the identifier of some component? The standard technique is to use the `IDLitTool::findIdentifiers` method. Alternatively, `MG_ITBROWSER` allows interactive browsing of all the identifiers (and their properties) of an iTool. This is very useful for learning and exploring the components that make up an iTool.
Here is the [source code](https://github.com/mgalloy/mglib/tree/master/src/itools/mg_itbrowser.pro) and
docs for `MG_ITBROWSER`.
When rendering object graphics atoms with transparency, the order the atoms are rendered (i.e. the order the atoms are created and added to the hierarchy) determines what can be seen. You want to draw the atoms from back to front when the front items are transparent. The same principle holds true for iTools since they use object graphics.
The iTools are easy to use interactively (O.K., easy once you learn some of the conventions and jargon). But they also have the ability to be extended and controlled programmatically. I have given a couple examples of extending an iTool with new operations ([data operation](http://michaelgalloy.com/2006/05/01/creating-an-itool-data-operation.html), [general operation](http://michaelgalloy.com/2006/06/20/creating-an-itool-generalized-operation.html)). I'll post more extending iTools visualizations, file readers/writers, manipulators, user interface services, and custom user interfaces in the weeks to follow. But programmatically controlling an iTool is both fairly easy and extremely useful, especially in situations where a visualization needs to be created which further needs to be explored interactively.
For simple operations, subclassing `IDLitDataOperation` is an easy way to quickly add an operation to the iTools system. See previous post ["Creating an iTool data operation"](http://michaelgalloy.com/2006/05/01/creating-an-itool-data-operation.html) for more information about `IDLitDataOperation`. If you want to do anything more complicated than a numeric operation on the dependent variable of the currently selected visualization, then you want to subclass `IDLitOperation`. We will examine a fairly simple subclass of `IDLitOperation`, `MGitOpDerivative`, which calculates the derivative of data in a plot visualization.
The ability to extend the itools is one of their main strengths. This can be adding a button for an operation (like our example here), the capability to read/write new file types, new visualizations, or new ways to manipulate visualizations. Plus, the user interface can be customized to various levels. Toolbars and panels can be added to the standard configuration, but a totally custom interface can be created also. Capabilities can also be removed to provide a simpler interface for a specific task.
This example adds an adaptive histogram equalization operation to `IIMAGE`.
There are two files for this demo program: [`mgitopadapthistequal__define.pro`](http://michaelgalloy.com/demos/itools/mgitopadapthistequal__define.pro) (
doc) to define the operation and [`mg_dataop_demo.pro`](http://michaelgalloy.com/demos/itools/mg_dataop_demo.pro) ( doc) to setup using the operation. To run the demo, make sure both files are compiled or in your path and run `MG_DATAOP_DEMO`.