Robert Cudmore

bAlignBatch.ijm (ImageJ/FIJI macro)


This ImageJ/Fiji macro takes a source directory of 3D image stacks (.tif or .lsm) and after some processing saves the results (as .tif files) in a new directory. For each 3D stack in the source directory, bAlignBatch will:

You can modify these behaviors (source directory, median filter, stack alignment) when you run the macro.

This macro can handle 1 or 2 channel source stacks and goes through some pains to preserve the header information for each stack. Thus, it should result in .tif files that contain any original header information from programs like ScanImage or Zeiss LSM. This is particularly useful to preserve detection parameters saved during acquisition for future processing steps.


Step 1: Email Bob

Step 2: Download the MultiStackReg v1.45 plugin from Brad Busse or locally from here.


Remember, you will need to install BOTH the bAlignBatch_v2 macro and Brad Busse's MultiStackReg plugin.

Step 1: Install Brad Busse's MultiStackReg plugin by draging and dropping the downloaded file 'MultiStackReg1.45_.jar' into your ImageJ/Fiji 'plugins' folder.

Step 2: Install the bAlignBatch_v2 macro by draging and dropping the downloaded file 'bAlignBatch_v2.ijm' into your ImageJ/Fiji 'plugins' folder.


Select 'bAlignBatch v2' from the plugins menu.

How To Use

Run the macro and select a 'source' directory with .tif or .lsm files, specify your desired options using the dialog (See below) and hit the 'OK' button. The results will be placed in a new folder inside your 'source' directory. If your source folder is named 'mySourceFolder', the output will be in a new folder named 'mySourceFolder_aligned'.


bAlignBatch puts all its results into a new folder inside your source folder. If your source folder is named mySourceFolder, the output of bAlignBatch will be a new folder named mySourceFolder_aligned. This new output folder, in turn, contains the following folders:


Know Your Channels. bAlignBatch can read ScanImage or Zeiss LSM header information to determine the number of channels in each .tif stack. If your .tif stacks do not have header information you can specify the number of channels in your stacks using the popup, 'Number of channels' in the Options dialog. In this case we will assume that ALL your .tif stacks have the specified number of channels. If this is not the case, split your source .tif stacks into two different folders: a folder of one channel .tif files and a second folder with two channel .tif files. Then, run bAlignBatch on each folder.

One image stacks. bAlignBatch assumes all the .tif files in your source folder are stacks, e.g. a stack has >1 image. If you have .tif files with only one image, please hide these from bALignBatch by putting them in a temporary folder.

Why does the output split the channels into two different .tif files? I have found it is more useful at subsequent processing steps to have each channel as a seperate file. For example, (i) it takes less time to load one channel when you only want one, (ii) if two channels are combined you have to load both and then do even more processing to seperate them.

Version History

20110909, initial v1
20111101, initial v2
20110220, final v2

Feb 20, 2012, bAlignBatch_v3.ijm will work with ImageJ version 1.46a
Oct 25, 2012, bAlignBatch_v4.ijm is working nicely with either .tif or .lsm files
Feb, 2013, General bug fixes, updated documentation.

Dept. of Neuroscience, Linden Lab Johns Hopkins Medicine © 2008-2013