Skip to content

Dear Internet Explorer user: Your browser is no longer supported

Please switch to a modern browser such as Microsoft Edge, Mozilla Firefox or Google Chrome to view this website's content.

Make ImageJ 1.x work in the background

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.

   

Comments

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.