Batch PIV

Batch processing for Particle Image Velocitometry (PIV) plugin to measure 2D time series

img

editing

Description

Particle Image Velocimetry (PIV) is a way of quantifying speed and direction of movement occurring within video sequences. The results are typically presented as a vector field, where movement vectors are plotted at regular intervals in the image. Two different algorithms are known for the computation of vector field: the gradient method and the cross-correlation methods.

Two ImageJ plugins use the cross-correlation methods: one by Jean-Yves Tinevez (PIV analyzer), and another one by Qing Zong Tseng (PIVhttp://imagej.net/FlowJ plugin). This PIV plugin takes two 2D images and estimate the displacement vector field between two time points. One ImageJ plugin is available that implements the gradient method (generally called optical flow): FlowJ (or also see FlowJ@ImageJ.net for a link to github repo). I implemeted the gradient method as a Igor Procedure and is available for downlaod: Vec2D package.

The script presented here is an add-on for Qing Zong Tseng’s PIV plugin, to batch process multiple images and outputs a sequence of vector fields. For more details, see the plugin site.

Input:

An image stack. The full path to which should be directly written in the script (see Usages).

Output:

Displacement vector fields as sequence of images. These results are saved in the folder declared in #3 above.

Dependency

  1. ImageJ
  2. PIV plugin: as the PIV plugin depends on OpenCV library, please read the installation section of the PIV plugin website carefully and follow the instruction.

Installation

batch PIV cross-correlation

batch PIV template matching

Usages

For most type of time-lapse sequences, preprocessing the sequence by running average (also called “box averaging or moving averaging”) is recommended. For this, install Running Z Projector written by Nico Stuurman. This preprocessing averages several framed before and after the current frame, and will reduce noise in background to have a smooth image sequence, which is better for detecting optical flows / movements. We use the sample image eb1_8bit.tif in the following workflow.

Preprocessing

  1. Open [EMBL-CMCI > Samples > eb1_8bit.tif].
  2. Apply [Plugins > Running Z Projector]. Choose “3” frames for averaging. In other image sequences, this value could be larger depending on the result of running averaging. More frames for averaging results in less noise.
  3. Save the resulting stack.

Batch PIV analysis

  1. Within the script, change
    1. change the path to the image containing folder.
    2. change the file name of the image stack.
  2. Name of the output directory (currently, “vecdata”).

Repository

https://github.com/miura/ijmacros/