(a) An example of a simple Jython script that achieves complex segmentation and 3d visualization drawing on the Fiji libraries steered by simple scripting commands. The task is to open a 3d RGB image (line 5) of a Drosophila first instar brain where cortex and neuropile glia are labeled in green by Nirvana-Gal4 and UASmcd8GFP, surface glial cells are labeled red with anti-repo antibody, and all nuclei are labeled blue with Sytox. The goal is to automatically count red surface glial cells using the Difference of Gaussian (DoG) detector (line 9) applying the constraints for cell size and labeling intensity (lines 3 and 4). These constraints are expressed as DoG sigma parameters (lines 7 and 8) by extracting image dimensions from metadata (line 6). The cell count is printed in the dialog box (line 10) and cells are subsequently displayed in the 4d viewer as red spheres of fixed diameter, overlaid with orthogonal view of the raw 3d images (lines 13–16). (b–j) Algorithms implemented using generic ImgLib constructs operate on images regardless of dimensionality. The figure shows the output of two ImgLib algorithms: Maximally Stable Extremal Regions (MSER) and again DoG. The 3d input image is a confocal stack of a C. elegans worm expressing nuclear marker. Scale bar 10 μm. (h). A slice from the stack is used as the 2d input image. Scale bar 10 μm. (e). A line segment from the slice is used as the 1d input image (b). The results of the DoG algorithm for 1d, 2d, and 3d are visualized in (c), (f), and (i). The results of the MSER algorithm for 1d, 2d, and 3d are shown in (d), (g), and (j). The algorithms are run on 1d (c,d), 2d (f,g), and 3d (i,j) input without changing a single line of code (see ). The nested MSER regions representing competing segmentation hypotheses for the nuclei are color coded (green, red, blue and magenta).