Batch running plugins


Is there anyway of running plugins on a bunch of images at once, or do I need do them individually.

Specifically, I am trying to run MosaicIA on a bunch of images of dendritic cells and t cells, and I am wondering if I can just plug in a folder of the images and get a series of data.


You can Batch Process a folder of images… there are multiple ways to do this:

  1. ‘Easy’ option using the built in Batch Process window…
  2. ‘Flexible’ option that uses the following script (see below):

In either case - you want to take advantage of the Recorder, which records the actions you take in ImageJ/Fiji into code - it’s the starting point of starting to script in ImageJ/Fiji…

// @File(label = "Input directory", style = "directory") input
// @File(label = "Output directory", style = "directory") output
// @String(label = "File suffix", value = ".tif") suffix

 * Macro template to process multiple images in a folder

// See also for a version of this code
// in the Python scripting language.


// function to scan folders/subfolders/files to find files with correct suffix
function processFolder(input) {
	list = getFileList(input);
	list = Array.sort(list)
	for (i = 0; i < list.length; i++) {
		if(File.isDirectory(input + list[i]))
			processFolder("" + input + list[i]);
		if(endsWith(list[i], suffix))
			processFile(input, output, list[i]);

function processFile(input, output, file) {
	// Do the processing here by adding your own code.
	// Leave the print statements until things work, then remove them.
	print("Processing: " + input + File.separator + file);
	print("Saving to: " + output);

Here are some other helpful links to get you started…

eta :slight_smile: