Biomedical Engineering Reference
In-Depth Information
rows of results with the 'setResults' command. These can be new results
or calculations. However, in macros the user often wants to capture many
different sets of results throughout the macro by clearing the results table.
To bring all the results back together, several options exist. First, copies
of the results table can be made with the 'IJ.renameResults(name)'
function, which can be saved out to compile with others in a different
application such as Microsoft Excel. Second, all results can be saved in a
single 1D array, which can be read back into the results table using the
'setResults' command using offset for loops to turn the 1D array back
into a 2D array of rows and columns.
Other elements in ImageJ macro language
Lastly, the conditional statements of 'if' and 'else' are implemented within
ImageJ to provide a dichotomous selection of which piece of code to
execute.
The statements in ImageJ are supported by standard Java boolean
operators, but with fewer precedence levels. Care must taken to use these
correctly, for example '=' is used to assign a value to a variable and '=='
is used as an operator to check if variables are equal.
The macro language can also call on plug-ins that are installed within
the plug-in folder. This allows the user to blend bespoke code and
discrete functionality of a plug-in within the workfl ow. The syntax to call
on a plug-in is straightforward using the run command shown below,
which in this case calls on a plug-in called 'colour transformer' and
provides an input variable for the plug-in, in this case the colour space to
convert to.
￿ ￿ ￿ ￿ ￿
run('Color Transformer Corrected', 'colour=LCHLab');
run('Color Transformer Corrected', 'colour=LCHLab');
5.4 Graphical user interface
The main tool and menu bar in ImageJ (Figure 5.1) allows the user to
interact with all the functionality and tools, and, in addition, to access
links to service ImageJ such as updates and help, and to get started with
macros and Javascript. The macro language allows the display of splash
screens, input boxes and dialog boxes. If more complex GUIs are needed,
then this requires involvement of Javascripts as in the example of
SmartRoot (Figure 5.3). The following macro is given as an example of a
macro that comes ready installed with ImageJ to demonstrate dialog
 
Search WWH ::




Custom Search