Welcome to the Macklin lab macros, scripts, and other microscopy processing fun!
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Macklin lab macros and scripts for Fiji/ImageJ

Welcome to the Macklin lab macros, scripts, and other microscopy processing fun!

This repository contains a series of short ImageJ/Fiji plugins and scripts that perform tedious image manipulation tasks common in our lab. This central README contains documentation for using all of the plugins. If you find problems or would like to make improvements, please fork the repository and submit a pull request. If you don’t want to modify the code, you can also email me (Nick) at:


This repository is licensed under the Mozilla Public License 2.0. Free software license (https://choosealicense.com/licenses/mpl-2.0/, https://www.gnu.org/licenses/license-list.en.html#MPL-2.0) Please feel free to use the provided code and incorporate it into your work, but please give us a shout out if you do and share the source code of your changes.

make your own

If you know a little bit of a scripting language, I am working on a guide for working with Java from a script in ImageJ here. Please let me know if it helps or if you want any improvements!


I made an update site (search Lab-utility-plugins) for these plugins. Now, to install you simply add the update site to Fiji.

Quick install: Open Fiji, and under the Help menu click Update. Once Fiji finishes checking for updates do the following:

  1. Click Manage update sites
  2. Scroll and find Lab-utility-plugins and check the box.
  3. Click Close
  4. Click Apply changes
  5. Restart Fiji

Summarized below: img/install-simple.png

Please ensure that you have the latest Fiji downloaded and installed on your computer. Fiji (batteries included ImageJ) will be the only requirement for this set of plugins. You will now get updates automatically.

MacOSX INFO! Due to a possible bug in a recent Fiji update, if you add this from a Mac the plugins will not appear in your =Plugins= folder (see http://forum.imagej.net/t/plugin-scripts-no-longer-appear-in-plugin-menu-on-mac-osx/11924/2 and http://forum.imagej.net/t/missing-plugins-menu-item/11888?u=imagejan). As a workaround, I added the files to the =scripts/Plugins= folder as well, so now 6 files will be added. Note this was addressed (see the links above), but I will keep this interface as is for now, I kind of like it! On a Mac, you will now find the plugins in the main menu at the top of the screen like so:


I will remove this as soon as this issue is resolved in Fiji, though they will work the same.


I use ImageJ script parameters https://imagej.net/Script_Parameters for UI design with these Jython (python on the JVM) scripts. Scrip parameters are awesome. Let me know if you want other options set.


This plugin blinds files– that’s it. It uses the Jython implementation of universally unique identifiers (UUIDs) to generate the new, unique blinded names for your files, and then simply copies them to a newly created directory.

When you launch it, you will see the following interface: img/blind-files-interface.png


  1. Select the folder containing the images you want to blind.
  2. file ending of the files you want to blind.
    • Note Sometimes folders contain other files that you don’t want to blind as part of your analysis. For example, I typically have a metadata file along with the tif’s that I don’t need to blind. For this reason, I filter based on file ending– though there is no technical reason why you need to do that. If you want other file types supported, please let me know. I can also just add an empty field for you to enter your file endings of choice, but for now I think this works.

An example input directory may look like this: img/blind-files-input.png


  1. The plugin will make a new folder in your chosen folder called blinded and will copy your images with new random names into it.
  2. In the original folder you will find a KEY.csv, which contains a column with the old names and a column with the new names.
  3. Inside the new blinded directory you will find your photos and a blinded-key.csv file with the blinded names on it as a list. The blinded-key is just so you can then write notes or whatever next to the blinded names, then you can easily merge it with KEY.csv in excel or whatever when you want to un-blind the results.

This plugin does not modify the original files, it only copies and renames the files. For this reason, I haven’t had the need to un-blind the images, as you have keys and retain the originals. If you want to unblind them too, I can add that but let me know why.

Below is a picture of the folder structure after running this plugin. img/blind-files-output.png


Under active development!

This script is meant to use Fiji and bioformats to convert images from many different proprietary vendor types to the easy to work with tif format.

Supported image types

  • Zeiss czi
  • Zeiss lsm
  • Nikon nd2
  • Olympus oib
  • Leica lif

Not yet supported but planned

  • Slidebook sld
  • tiled lif’s lif
  • Volocity mvd2

Basically anything Bioformats can open. Let me know what you need.


  1. a directory of files with one of the currently supported file endings.

The UI for this scipt is very minimal. You simply get a choose a folder dialogue. Here is a picture of an example folder with all the supported file types in it: img/tif-convert-input.png


  1. a new directory called converted-tif
  2. tif files with formatted names in the new directory.


I do a little text processing of image names in this one in order to clean stuff up (i.e. remove spaces and the old .XXX format). If you have specific naming concerns, especially in the archive formats (.lif) please let me know and I can modify it to be more generic or suit your needs.

Below is what your folder will look like after running it. img/tif-convert-output.png

Planned features

  • Leica tiled images

Right now, if you want separate tiles saved this script won’t work. It will continually overwrite the individual tiles. The tiled image is fine, just the individual tiles aren’t converted correctly.

Batch projector

img/batch-project.png Very simple script that will batch project your images using one of the offered imageJ methods. This will format the names nicely and save them in a sub directory as well. NOTE If you are doing something like fluorescence intensity measurements on projected images, you need to project with SUM projection rather than max projection. See: http://forum.imagej.net/t/measuring-fluorescence-intensity-on-a-z-stack/7485 There are numerous other caveats to fluorescence intensity as well… more here in the future.


Under active development! Sometimes you want to apply a single ROI to a directory full of images. That’s what this plugin started as, but I am developing it to add a few other useful features as well.


  1. a directory of images
  2. a file type
  3. an ROI
    • This MUST be an ROI generated by the ROI manager and saved as .roi

Currently, the interface looks like so: img/take-roi-interface.png


  1. A subfolder called cropped with the cropped images.

New features:

  1. random ROI, same for each image
  2. Random series of ROIs from each image.
  3. Systematic random sampling ROIs

Other script ideas?

Don’t waste your time by repeating yourself (follow DRY– don’t repeat yourself). We can work together to reduce boring work so you can spend more time with the important stuff (you know, reading, doing experiments, and beer. definitely beer). Let me know if you run into any problems or have ideas for other scripts.

Write your own

If you know a little bit of a scripting language, I am working on a guide for working with Java from a script in ImageJ here. Please let me know if it helps or if you want any improvements!


in progress working on this one (2018-07-03), suggestions welcome.

Planned features:

  1. batch split image channels, format names appropriately
  2. Save image channels to their own appropriately named folders


  1. image directory
  2. list of channel names (optional)


  1. directory for each channel and single channel images in each


Don’t use this… I have this here so that I can eventually merge it with tif-convert.

This is an experimental script that will convert and save all the individual tiles in a lif archive containing a tiled image in their own appropriately named directory. This is a very rough script I wrote in a hurry. I would NOT recommend using it yet. I plan to merge it with tif-convert but have not gotten the chance yet. Let me know if you need this functionality and I will fix it.