Setting up your first GUI or "widget" in IDL can be frustrating, so there are several examples here of increasing complexity to help you out. Object graphics provides support for advanced graphics techniques like 3-dimensional rendering, varying the opacity of objects, and building up complex images. Most of this can be accomplished within standard graphics using the Z-buffer, but once you write your first Object-Graphics program you will never go back! Well, almost never; standard graphics are still appropriate in many situations. Object graphics are trickier to set up, but much more versatile and expandable than standard graphics. This is a technique to let you write widgets that you want to plug into other larger widgets and use over and over.
|Published (Last):||9 January 2011|
|PDF File Size:||5.53 Mb|
|ePub File Size:||13.98 Mb|
|Price:||Free* [*Free Regsitration Required]|
Setting up your first GUI or "widget" in IDL can be frustrating, so there are several examples here of increasing complexity to help you out.
Object graphics provides support for advanced graphics techniques like 3-dimensional rendering, varying the opacity of objects, and building up complex images. Most of this can be accomplished within standard graphics using the Z-buffer, but once you write your first Object-Graphics program you will never go back! Well, almost never; standard graphics are still appropriate in many situations.
Object graphics are trickier to set up, but much more versatile and expandable than standard graphics. This is a technique to let you write widgets that you want to plug into other larger widgets and use over and over.
The trick is how to create this beast so it is independent of other simultaneous instances of itself. A couple of examples of compound widgets are provided, together with a discussion of some of the nuances of building them. This page contains links to several tutorials for programming in IDL. Training Manuals. There are a few books on IDL programming which I have found very useful. The IDL reference manuals are quite helpful if you already have some idea of what you need.
The reference manuals contain a few examples for beginners, but the first book I would recommend reading is: "IDL Programming Techniques" by David Fanning.
It has a lot of examples and is a great book! This is a somewhat more advanced book, but also has some very nice example programs that are quite useful for image analysis. I have copies of both of these books if you want to borrow them and you work in my lab! IDL is a structured programming language that provides a complete environment for image processing.
It has basic flow-control operators like if , while , and for , it supports pointers, structures, and arrays, has a vast number of built-in library functions, supports object-oriented programming, and provides a convenient image display interface. On top of that, there is a widget-builder to create complex GUIs, "Live Tools" that let you create and edit graphs and images on-the-fly, and Object Graphics which support modern complex 3D graphics displays. The IDL language is most similar to Matlab one of its competitors , but is also similar to Pascal and in some respects to C in structure.
IDL is fundamentally an array processor; it wants to work with arrays or groups of numbers. There are many built-in routines to facilitate this; several are variations of the Numerical Recipes programs.
Examples of some of the basic control elements are:. All of these elements can be nested within one another. IDL is a zero-index language; that is, the first element in an array has index number "0" zero.
The last element thus has an index number of N This is similar to C, but different than Matlab, which indexes from 1-N. I mention this here because in a 0-index language, you generally run a for-loop index from 0 to N IDL really shines when it can work on a large array like a 2D or 3D image.
It's performance suffers when it has to examine individual array elements one at a time, as when you have a for-loop to step through an array one element at a time. There are a host of methods for avoiding a for-loop that are beyond the scope of this brief tutorial. Suffice it to say that with good programming technique, IDL approaches the performance of compiled C for most number-crunching tasks.
That's it. The only thing this program does is print a message. This is a good time to talk about the fact that IDL does not normally run a precompiled program. Although it can- this is confusingly called Run-Time mode. The source-code is a normal text file that is read and compiled as each particular program is encountered in the calling program. This approach has several ramifications:.
IDL has a gentle but long learning curve. If you want more information, refer to one of the training manuals. A widget is an atomic element of a GUI. Various types of widgets combine to make a GUI. The major widget types include:. Following is an example of the simplest possible GUI. It is a small button that reads "Continue". The purpose of this GUI is to halt the flow of another IDL program, letting you inspect results which would otherwise fly by too fast.
Pressing the button causes the GUI to destroy itself, and the calling program can then proceed. Notice that this program can only respond to a single event. An event is generated every time you press a button or perform any other allowed action within a GUI.
It is somwhere between painful and impossible to use an approach like this to process multiple events, for example letting the user select several options for image display and then display an image. If you intend to have multiple events and any GUI worth its salt will you will want to create an event processor.
This is simply a program that collects all of the possible events from your GUI and decides what to do with them. By having this occur in a seperate program, you can call the program every time an event is generated!
The event-handler is usually included in the same file as the GUI creation program. I mention this because it seems strange to most people when they don't see the GUI program until they get to the end of the file. Since we have only a single button, it is pretty simple to deduce where the event came from. As soon as we get two buttons, however, we must have a way of telling them apart.
Every widget button, slider, base, etc. The example above contains everything you need to include to have a fully-functional GUI. More complicated GUIs just have more buttons and other options, but the mechanism for how any widget event works is the same! I haven't found a simple enough one that I like yet Watch this space!
There are two main types of programs in Spamalize: 1 Mature programs that perform an image analysis or display task, like BrainMaker or BrainSpinner; 2 All the others, that let you take a more modular approach to image processing. This section concentrates on the latter, since there are already web-pages devoted to most of the more mature self-standing programs.
All of the programs are accessed through the main menu, which looks like this:. The first five buttons are pull-down menus.
For more information on the menu features and how to use them, see the Spamalize MainMenu page. PRO to add the program to the menu.
You will need to add a new label to the menu, and also make sure to add a new call for your program in the event-handler. The basic idea behind Spamalize is that you can read image data into a single array, store it in memory, and do things to it. Things like display, drawing, scaling, flipping, writing, etc. Whenever you read in a new image file, it gets stored there.
For non-IDL'ers, this is a type of global environment variable. The general read process can be seen in a diagram. Most of these steps are transparent or at least ignorable to the user. The top-level read program looks like:. You may select an alternate file type from the dropdown menu in the upper left.
Context-sensitive options will appear. Clicking on "Continue, Load Image s " pops up a browser that lets you select an image file.
Depending on the type of image, a menu may pop up to let you select which images you want to load. The menu for PET multi-plane, multi-frame image set will look like:. Every image in the data set is represented by a check-box. You can select or unselect any combination of images.
The sliders in the center of the menu let you quickly select a range of images. When yo select one or more images, their check-boxes get filled in. If you move the check-box-window-sliders, you can see all of the check-boxes, as well as boxes that let you select a single plane or frame, as shown in the following menu:.
Here, I selected "P33", which then selected all of the images in plane 33, and "Frame 11, All Planes" which selected all the images in Frame Unselecting works the same way. If you do several iterations, eventually the GUI will get confused and you will have to start over Click "Continue, Load Selected Images" to load in the desired images.
When you want to display, write, print, etc. There are associated common variables that contain main-header information for the entire image array X,Y,Z dimensions, pixel dimensions, etc. One nice result of this scheme is that missing slices do not interfere with the display or storage of images. A big downfall of this scheme is that it is difficult to extract orthogonal views. There are two ways to get around this in Spamalize.
Because of the way IDL stores arrays and how the image data get read in, frequently you will never notice a problem. Problems will show up first as an inability to display an image using the general "Display" tools if you take this approach. A second technique is just to shift the data to another array that is designed to be 3D or 4D from the get-go. However, I should mention that keeping track of this has caused more hair to be pulled out than any other aspect of Spamalize.
IDL (programming language)
It is popular in particular areas of science, such as astronomy , atmospheric physics and medical imaging. IDL is vectorized , numerical , and interactive, and is commonly used for interactive processing of large amounts of data including image processing. The syntax includes many constructs from Fortran and some from C. The findgen function in the above example returns a one-dimensional array of floating point numbers, with values equal to a series of integers starting at 0.
IDL Programming Techniques Training Course