Processing image-files in batch

Process image-files in batch

The ACQUIFER update site (available upon request) provides the following plugins to process individual image-files in batch (ACQUIFER > Batch > List of files):

These plugins directly operate on individual image files, contrary to the Batch Process Hyperstack plugins, which first display a multi-dimensional/hyperstack-image for each well/sub-position.

These plugins allow the execution of custom commands for every image-file matching the dimension selected in the plugins interface

For instance, you can exclusively process the images corresponding to the central Z-slice of a given channel for every time point of a time-lapse (see the Batch-plugins documentation).

See the tutorial on Youtube !

With the Batch Copy plugin, you can efficiently copy part or all images of an IM dataset to a new directory of your choice. 

Only images matching the dimensions selected in the plugin interface are copied, so you can selectively copy only images for a specific channel, well…

If the output directory does not exist, then the plugin will automatically create it. While if it already exists and already contains images, these won’t be overwritten.

Finally, the plugin provides the option to copy the Log subdirectory in addition to the images. This directory contains metadatas related to the acquisition and is required for visualization with the PlateViewer

The Batch Converter is ideal to rapidly convert all or a fraction of an IM dataset, either to a new file format, or to the same file format but with different image dimensions (cropping and/or resizing). 

The plugin does not overwrite the original dataset, the converted images are saved to the output directory set in the plugin interface (if left empty, to a subdirectory Converted in the image dataset directory).  

 – image-cropping

The Batch Converter can automatically crop your images provided a region-of-interest (roi) file

This is useful if your sample is always located in a given part of the image (for instance if you use a sample holder).

To generate such roi-file:

1) open an original IM image in ImageJ/Fiji

2 ) Draw your region of interest using the rectangle tool or another ROI tool (cropping will use the enclosing rectangle in this case).

3) Press “t” on your keyboard to add this ROI to the Roi Manager

4) Select the ROI in the Roi Manager (it should be highlighted in blue)

5) Click the button More >> of the Roi Manager and Save…

Cropping images help reducing the file size for each image, and thus can spare subsequent space disk for large datasets.  

– image-resizing

Besides cropping, you can use the plugin to resize your images (Scale factor).

Especially, downsizing (Scale factor<1, equivalent of binning) can be useful to reduce the individual file sizes. 

For instance, downsizing using a scale factor of 0.5 (from the original 2048 x 2048 pixels to 1024 x 1024 pixels) will reduce the size of a dataset by a factor of 4 if applied to every image ! (the number of pixels is divided by 2 along both x and y).

This plugin allows the execution of a custom macro for every image file matching the dimensions selected in the plugin interface. See the example macros.

The custom macro can recover the filepath of the image currently processed by the plugin as a string using the getArgument() macro function.

Given this filepath, you can either:

  • directly perform some file operations (copy, move…), without actually opening the images in Fiji

For instance, this example macro simply prints the file paths of the images to a log window.

Double click the filepaths in this window to directly open the images in Fiji ! This simple macro can be used to have a simple way to browse images matching a specific dimensions (e.g. given channel, and Z-slice index).

  • open the image in Fiji to perform some operation on the image

See this second example macro, that opens the image and performs edge detection.

This plugin allows the execution of a custom script saved to disk, systematically for each image file.

In this case, a java File object for the current image is directly passed from the batch plugin to the script. See this example jython script for how to handle such File object.

Scripts of any language supported by Fiji are supported, including the imageJ macro language.

The only condition is that scripts should have a single input script parameter of type File and name “image_file” as below.

#@ File image_file
print image_file 
# the rest of your jython, groovy, javascript... code

For imageJ macros, the variable image_file will be populated with a String corresponding to the image filepath.
Use the macro command open(image_file) to open the image in Fiji, as shown in this example macro.

Leave A Comment

Your email address will not be published.