Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Some simple macros for Fiji/ImageJ that we are using in the lab.

Most of these tools are available via the quantixed ImageJ update site. Instructions for how to follow a 3rd party update site are here. This is the best way to install these macros and maintain the latest versions.

If you want to install manually, add the contents of macros and scripts to the corresponding directories in your Fiji/ImageJ installation.

After installation, all macros can be found under the menu item called LabCode.

Quick links

  1. Figure Maker
    1. Prepare your images
    2. Make a montage
    3. Optional: add ROI Zoom
    4. Compile your montages
    5. Figures the quantixed way
  2. Blind Analysis
  3. ELN Saver
  4. Other Utilities
  5. Misc Macros
  6. I'm getting errors

Figure Maker

There are macros to help you to make figures with montages - made the way we like them! There are other plugins for making figures in ImageJ but none did what we wanted, so we made our own.

Prepare your images

Load in your multichannel image, adjust how you want and then crop to a square. To do this select Click Square ROI from the >> on the toolbar.


This tool gives 400 x 400 pixel square ROI, right click to get a different size. Select the area you want.


Crop your images and save them as TIFFs.


Make a montage

To make a nicely spaced montage (row of images). Select LabCode > Figure Maker > Make Montage

You are asked to pick your cropped TIFF.

You can specify the number of grayscale (channel) panels and choose the number of merges.


In the next dialog you can pick which panels go where in your montage and how to merge channels using which colours.

You can also specify a vertical (column) montage rather than horizontal (row).

Grout and scale bars can be added flexibly, no border is added. This is different to ImageJ's Make Montage and makes figure rows the way we like them! Note that if you are going to compile montages, it's best to add a scale bar at this stage to just one of the images.


Your montage is saved in the same directory as the original image. The macro leaves it displayed, so that you can admire your awesome data!


Multiple montages

If you want to make many montages. Then select LabCode > Figure Maker > Make Montage Directory. This macro allows the user to make montages from TIFFs in a directory. A dialog is shown at the start that allows the user to select which channels go where and then the montages are made in batch mode.

Optional: add ROIs and zooms

Sometimes, we like to add a ROI and a zoomed version of this ROI to various panels in the montage. To do this open your montage and select LabCode > Figure Maker > ROI Zoom


You can pick which corner you want the zoom and which panels you'd like to add an ROI and zoom.

After clicking OK, you are asked to select the centre of the ROI.


The resulting image is saved in the same directory as the montage.


Note that this code will run on stacks as well so that you can add ROIs and zooms to movies!

It only works on square images and montages made from squares. If your zooms are in the wrong place, check the size(s) of your input images.

Now put the rows together

Finally, if we have more than one montage, we need to compile them together. Load in all the montages you'd like to compile. Now select LabCode > Figure Maker > Montage Compiler

The dialog asks you to select which montage you'd like where.

The routine is intelligent enough to recognise vertical and horizontal montages and to compile them left-to-right or top-to-bottom as appropriate.


Your compilation will save back in the same directory as the montages. Note that you can use this macro to make one compilation and then use it again to add more montages (extra rows) or other compilations. Very large compilation can be built this way.


Note that results from Figure Maker are saved as 300 ppi TIFF ready for use in Illustrator or equivalent software.

Figures the quantixed way

For multichannel microscopy images, e.g. from an immunofluorescence experiment, quantixed follows these rules for best practice.

  1. Individual channels as grayscale - reason: the eye does not detect black-to-red in the same way as black-to-green or black-to-blue
  2. In a row montage the merge is on the right. In a column montage it is at the bottom
  3. Square images, square ROIs and square zooms
  4. No border
  5. Scale bar in the bottom right corner
  6. Fixed grout of 8 pixels (suggested)
  7. Scale bar of 10 µm, height of 2 x grout (suggested)
  8. Grouting between conditions is 2 x grout between channels (suggested)
  9. Labelling is done in Illustrator or some other software to assemble the final figure, not in ImageJ

Blind Analysis

BlindAnalysis.ijm Takes a directory of TIFFs, strips the label from them and saves them with a blinded name. A tsv called log.txt is created to log the association between the original file and the blinded copy. Works on TIFF only.

ELN Saver

This is a simple utility to save a version of the file you are viewing in Fiji/ImageJ to put in your electronic lab notebook. A png version or low-res movie of the file you are looking at is saved to the Desktop with a unique name. A text file is saved to explain the filenames.


Other utilities

In qUtils there are some other utility macros that we use in the lab.

We've had problems with nd2 files being saved with a LUT that is not pure red, pure green or pure blue. This is because it uses a LUT that is based on absolute wavelengths of the fluorophore. You can use Make_NIS_Pure_RGB.ijm to sort out the colours.

Open all the nd2 files in a directory and save them as TIFF to another directory with nd2SaveAsTiff.ijm.

Maybe you like to open a whole directory of images, look through them, closing the bad ones and leaving the good ones open. Perhaps you want to grab the list of good images so that you can come back to it later? Well, PrintTitlesOfNiceImages.ijm does this for you.


Misc Macros

Other macros that we use - but are not included in the update site - are found in the misc directory.



Most problems are solved by allowing Fiji's updater to install the latest code from the quantixed ImageJ Update Site.

Still not working? All routines use a number of custom functions which get loaded when Fiji starts up. Errors in running these routines usually traceback to third party code that modifies StartupMacros.fiji.ijm. Which can be found in the macros directory. Specifically, if the third party has deleted this code block, then none of the autorun functions happen at startup.

macro "AutoRun" {
	// run all the .ijm scripts provided in macros/AutoRun/
	autoRunDirectory = getDirectory("imagej") + "/macros/AutoRun/";
	if (File.isDirectory(autoRunDirectory)) {
		list = getFileList(autoRunDirectory);
		// make sure startup order is consistent
		for (i = 0; i < list.length; i++) {
			if (endsWith(list[i], ".ijm")) {
				runMacro(autoRunDirectory + list[i]);

If you can't bear to uninstall the third-party code (or don't know which update site causes the problem), just paste that code block into StatupMacros.fiji.ijm and things will start to work again.


No releases published
You can’t perform that action at this time.