Macros for ImageJ and Fiji

Be careful. 
The ImageJ-macros presented here are written in all conscience. Though, please note that the author of this page is not responsible for any hard- or software damage, that may result from use of the macros presented here, especially not after editing/modification by the user.

Do not process original data without backup.
Some modifications applied to the images may be irreversible and result in data loss, as well as saving an image in a lossy compression.

Avoid lossy compression.
Please avoid use/processing of images with lossy compression like JPEG/JPG since they can produce color artifacts that may falsify your results. Uncompressing formats like BMP, TIF(F) or even original microscopic data (like LSM) are better suitable for reliable evaluation and can be also stored space saving without data loss using archive file formats like ZIP or RAR.

Necessary ImageJ/FIJI-settings.
To ensure, that the macros will work properly and produce reliable results, please apply the following settings to your version of ImageJ/FIJI:


In the software select “Edit” > “Options” > “Colors”:

This are the default program settings, you may leave them that way. 


Open a random image, “Analyze” > “Measure” > open “Results” in the Results-Window > “Set Measurements”:

Especially "Limit to threshold" should be checked to ensure proper function of some macros that identify structures.


The seetings shown above can be completely automatized.
Just add the following two lines of code at the beginning of your macro to apply the settings above:

        run("Colors...", "foreground=black background=black selection=yellow");

        run("Set Measurements...", "area mean standard modal min centroid center perimeter         bounding fit shape feret's integrated median skewness kurtosis area_fraction stack limit         display redirect=None decimal=3");

Execute a macro in ImageJ or FIJI.
Start the software > "Plugins" > "Macros" > "Record" > Paste the Script into the "Record"-window > click the "Create"-button > a "Macro.ijm"-window opens > "Macros" > "Run Macro" ( or press String + R)

Most macros presented here are optimized for "ImageJ 1.50b".

If you change an existing macro...
...make sure you have a backup of the functional original code.
Macros – like all computer code – are unforgiving and literal. Sometimes they even appear to be downright evil-minded in a Faustian manner. In most cases, the small things are driving us crazy. Therefore, remember trivia like using the straight quotation marks (") and not the diagonal ones (“) – otherwise the macro will not work. Also, macros are case sensitive and quite bitchy if you forget the semicolon at the end of a command-line. "Stack" is not the same as "stack", " stack", “stack“ or "stack ".
Test your macro step-by-step, apply changes gradually.

Download FIJI
Download ImageJ