Skip to content

Make ImageJ 1.x work in the background

G22nd October 2018

CNo Comments


Run ImageJ macro scripts in “batch mode” to improve performance and allow images to be processed in the background.

Macros are interpreted scripts that perform functions in ImageJ. Some macro functions that change pixel data will update the image to show the result. Displaying such updates uses additional memory and slows down the ImageJ macro. Additionally, the screen activity in ImageJ prevents the computer being used for other purposes whilst the macro is run.

The solution to this is to use BatchMode as follows:

setBatchMode(true); //Start batch mode
// do something
setBatchMode(false); //End batch mode

BatchMode should not be confused for batch processing (although I combine both these days).

Once a macro script is past the development stage and has been demonstrated to work reliably, enact BatchMode as this will allow macro functions to operate ‘in the background’ and use less memory.

A headless mode is available for scripts written for ImageJ2, but this is very much a work in progress and won’t work for ImageJ 1.x macro scripts.



No comments have yet been submitted. Be the first!

Have your say:

The following HTML is permitted:
<a href="" title=""> <b> <blockquote cite=""> <code> <em> <i> <q cite=""> <strike> <strong>

Comments will be published subject to the Editorial Policy.