xdisplay display="";
ui display=xdisplay create!;
/* read the 2d image file using the mio (medical I/O)
class */
mio_2d new: skull prefix="/home/karnack/nobk_users/lorensen/head/slices/headsq" slice=20;
/* set the colormap to a grayscale */
scalar new: number_of_cells = 128;
xshared_cells new: the_cells number_of_colors=number_of_cells allocate!;
loop new: load_gray resolution=1 duration=[object#the_cells number_of_colors?] time=1 start_actions=" scalar new: _ramp = 0; scalar new: _delta = 1.0 / [object#the_cells number_of_colors?]; scalar new: _pixel = 1; " tick_actions=" object#the_cells @ _pixel
rgb: (_ramp, _ramp, _ramp); _ramp + _delta; _pixel + 1; " end_actions=" _ramp free!; _delta free!; _pixel free!; " ;
load_gray start!;
/* make an ximage */
scalar new: width=128;
scalar new: height=128;
xz_pixmap new: skull_image
width=width
height=width;
/* map Bill's data through the colormap */
ivm_mapper new: _mapper
image=skull
cells=the_cells
width=width
height=height;
skull_image data=[_mapper data?];
/* create control panel and place the button in it */
ui_control_panel new: test_panel
parent=ui
create!;
ui_static_raster new: the_static_raster_button
parent= test_panel
@ "rasterImage" : [skull_image id?]
@ x : 100
@ y : 100
@ "width" : width
@ "height" : width
action=next_action
create!;
actions new: next_action
tick_actions= "! static raster button was pressed! :-) " ;
ui on! start!;