ImageJ Macros

The UIC team is constantly developing macros to facilitate IGC researcher's interaction with their data as well as provide new capabilitities (automated measurements and data management are just a few examples).

Below you can find some of the macros we've developed internally that are of use to most researchers and publicly available. In order to use them you can either find the file and run each time, or add to the list of macros that start with ImageJ. To do that, click "Plugins > Macros > Startup macros". This will open a text file with all ImageJ macros. First you need to open the macro file with notepad and copy the text. On the end of the Startup Macros file, write the text below with the necessary changes.

macro "edit name" {




  • - Bio-formats, previously known as LOCI.
  • - Specific plugin.
Note: These icons refer to the plugins required to use in the associated macro, usually these should come with Fiji, unless specified.


  • Centromere Recognition and Quantification | CRaQ

    This macro is described in Bodor et al. (2012) Analysis of Protein Turnover by Quantitative SNAP-Based Pulse-Chase Imaging. Current Protocols in Cell Biology, UNIT 8.8. The macro recognizes centromere or kinetochore foci in Delta Vision or TIFF images and determines their centroid position. Fluorescent intensities are then measured for each centromere by placing a small box around the centroid position of the centromere. The peak intensity value within the box is corrected for local background by subtraction of the minimum pixel value. This process results in an accurate measurement of large numbers of centromere or kinetochore-specific signals.

  • XY Grid reconstruction | Reconstruct

    Micromanager can make use of automated stages to acquire a large area in a grid pattern. It will save these pictures in a standard folder and filename structure. We've made use of this structure to make a macro that will, in seconds, reconstruct the imaged area, permitting imaging in high resolution of large samples. The macro also provides the option to perform background correction to correct for uneven illumination using either a reference picture or automatically (by performing a FFT bandpass filter). You can see an example below.
    Importantly, this macro assumes no overlap for quicker reconstruction. If your data has overlap, please check the "XYZ reconstruction" macro below.

    • Uncorrected

    • Corrected from a reference empty field

  • XYZ reconstruction | XYZreconstruct

    Micromanager also permits multi-dimentional acquisition (Z and channels) acquisition of several overlapping points. This macro will extract the location information from the metadata and output a grid.txt file that can be used with the excelent 2D/3D stitching plugin from the FIJI package. It is useful in cases where a grid with no overlap wasn't used since it will bypass the "Compute overlap" step.

  • Save orthogonal views | OrthoSaver

    ImageJ's orthogonal viewer for 3D stacks doesn't let you easily save the current orthogonal view. This macro, once installed, lets users create a montage with the currently open orthogonal views and selection guides. To use it, open an image z-stack and open the orthogonal viewer. With the mouse, choose which are the sections of interest to you and without moving the mouse, press F2. You'll get a montage of the currently selected orthogonal view.

  • Set size scale of all images | BatchSetScale

    This macro batch processes a folder of images, setting the scales to a given specification. All the images must be in TIFF format. It's based on the default BatchSetScale macro, with the added advantage that the user can set their own pizel size as well as automatically add a scale bar.

  • Import ROI files from Andor iQ | AndorRegionImporter

    This macro let's you import .rgn files created with Andor iQ. Regions are added to the ROI Manager. This is useful for users of Andor's FRAPPA system, since the default file system doesn't include the frap'ed Region of Interest (ROI). Since this Macro is oriented for FRAPPA user it only supports points, squares and polygons. It also let's you choose between adding all region types or just regions marked for FRAPPA.

  • Stitch z-stacks from Andor SpinningDisk | AndorStitcher

    This macro opens all stacks on an Andor .tif, does a maximum projection and then stitches them all together (requires FIJI).

  • Find all pictures in a folder and save to a common folder | PictureFinder

    This macro will open every .tif in a folder, including subfolders. This variant will then save all files to a new folder on the root of the chosen folder.

  • Make stacks from images taken with the Screening microscope | ScreeningPositionStacker

    This macro will cycle through all Pos_folders made by µManager and creates a hyperstack with all the channels properly set and all positions in the stack. It will then save a seperate stack for each channel.

  • Time Projection or frame-averaging Macro | TimeProjections

    Let's you do fractioned time-projections on stacks or hyperstacks. You can choose how many frames to project and how many to skip.

    That means: With a skip of 1 and average of 10 you'll project from frame 1 to 10, from frame 2 to 11, from frame 3 to 13 and so on. But with a skip of 5 you'll project from frame 1 to 10, from frame 5 to 15 and so on).

    When using hyperstacks it will only project the currently selected z-series.

    You can choose between maximum projection (retains all information) or average projection (with the same average and skip number you'll get a post-processing frame-averaging effect).

  • Tiff-to-movie converter for Andor files | AndorMovieConverter

    This macro will open every .tif in a folder, try to convert them to RGB and save it as an .avi.

  • Lif file to separate Tiff file converter | lif_to_tiff v1.8 |

    This macro will open a selected Leica Lif file, create a new folder inside the parent one with the same name and save every series from inside the Lif as a separate tiff stack file.


    • 2018-05-09 - v1.8: Added batch file conversion mode.

    • 2018-04-27 - v1.7: Added zero padding ("001" instead of "1" when there are hundrers of series) to file name when saving. Prevents problems with stitching plugins for Fiji.

    • 2017-07-26 - v1.6:
      • Works with files in .nd (MetaMorph), .nd2 (NIS Elements) and .lif (Leica) Files.
      • Fixed a bug that would stop the macro while saving in OME Tiff format. Directory had an extra "\".
      • New - renames files to exclude some special characters that could cause some problems.
      • Rearranged the code, it is now simpler and more compact.
    • 2017-03-27 - v1.4: changes to file separator to prevent problems with different OS'.

    • 2016-12-07 - v1.3: bug fix and slight correction.

    • 2016-10-17 - v1.2: bug fixes while saving series with no title.

    • 2016-05-06 - v1.1
      • Added a new GUI and the ability to change name of the destination folder.
      • Now you can choose if you want to save as TIFF or OME TIFF.
      • Added a progress bar.
    • 2015-06-16 - Slight reword to the saving name title to prevent overwriting files with the same name. Added "_series number" to the save name.

  • Grid/Mosaic batch stitcher | batch_grid_stitcher |

    Note: requires Image_Stitching.

    Stich several grids or mosaics in a single folder by the number of tiles of each grid. May be required when images are saved with general names inside a single folder or when they are not properly identified or named. With this macro, it is possilbe to define the number of tiles/images by grid and their base name, which will be used by the stitching plugin.

  • Get tiles from a Mosaic/Grid | batch_grid_to_tiles |

    Note: requires Image_Stitching.

    Converts all grids or mosaics in a directory into their component tiles and saves them automatically. Requres grid/mosaic format and (ex: 3 x 3 ) and file extension for filter purposes.

  • Creates a substack (Z) from the original files | batch_make_substack |

    Creates a substack in the Z dimension of several files in a target directory. This will reduce the size of the current stack in the Z axis, eliminating slices from the beggining and from the end of the stack.

  • Converts all Tiff files into OME TIFF | batch_tiff_to_ome_tiff |

    Opens and saves all Tiff files inside a folder into OME TIFF files using Bio-formats exporter plugin autoamtically and in a different folder. This process may be slow!

  • Batch convert stacks into hyperstacks | batch_stack_to_hyperstack |

    Duplicates and converts all image stacks of a defined extension inside the working directory into hyperstacks. The user is required to provide the dimensions (Z, C and T) and extension of the files to convert.

  • PSF Analyser for Quality Control | quality_control_psf_analyser v2.1.2 |

    Note: requires MetroloJ.

    Workflow developed at the facility to more automatically and with less user interaction to automatically detect beads in the field of view and then measure their PSF FWHM using the MetroloJ plugin.

  • Co-localization analysis for Quality control | quality_control_coloc v0.7.7 |

    Macro developed at the facility to more automatically and with less user interaction check the chromatic shift between multicolor beads and retrieve an average to be used for chromatic shift correction created by the illumination or the microscope itself.

  • 2P/Multi-photon stripe correction using Fourier transform | 2p_FFT

    Script written to correct stripes and bands created at our 2P/Multiphoton microscope due to stage gittering, using a Fast Fourier Transform to detect maxima on the FFT image and then eliminate high freq bands.

  • Saves czi files as Tiff files | CziToTiff_single_and_multiple_positions |

    Opens and saves all CZI files inside a folder and subfolders into Tiff files using Bio-formats exporter plugin automatically and in a different folder, copying the same folder structure.