Biomedical Engineering Reference
In-Depth Information
boxes and how to use them to capture user information that can then be
subsequently used by the macro.
// This macro demonstrates how a macro can display a
// data input dialog box. The dialog it creates contains
// one string fi eld, one popup menu, two numeric fi elds,
// and one check box.
title = 'Untitled';
width=512; height=512;
Dialog.create('New Image');
Dialog.addString('Title:', title);
Dialog.addChoice('Type:', newArray('8-bit', '16-bit', '32-bit', 'RGB'));
Dialog.addNumber('Width:', 512);
Dialog.addNumber('Height:', 512);
Dialog.addCheckbox('Ramp', true);
Dialog.show();
title = Dialog.getString();
width = Dialog.getNumber();
height = Dialog.getNumber();;
type = Dialog.getChoice();
ramp = Dialog.getCheckbox();
if (ramp==true) type = type + ' ramp';
newImage(title, type, width, height, 1);
// End of macro
// This macro demonstrates how a macro can display a
// data input dialog box. The dialog it creates contains
// one string fi eld, one popup menu, two numeric fi elds,
// and one check box.
title = 'Untitled';
width=512; height=512;
Dialog.create('New Image');
Dialog.addString('Title:', title);
Dialog.addChoice('Type:', newArray('8-bit', '16-bit', '32-bit', 'RGB'));
Dialog.addNumber('Width:', 512);
Dialog.addNumber('Height:', 512);
Dialog.addCheckbox('Ramp', true);
Dialog.show();
title = Dialog.getString();
width = Dialog.getNumber();
height = Dialog.getNumber();;
type = Dialog.getChoice();
ramp = Dialog.getCheckbox();
if (ramp==true) type = type + ' ramp';
newImage(title, type, width, height, 1);
// End of macro
When executed, this macro provides the following GUI, which
incorporates free text fi elds, drop-down options and tick boxes with
options to confi rm these or cancel the macro (Figure 5.6).
￿ ￿ ￿ ￿ ￿
An example of a GUI that can be generated within the
ImageJ macro language to capture user inputs
Figure 5.6
 
Search WWH ::




Custom Search