ij_piv#

Invoke ImageJ2 to run PIV macro PIV_STACK_directory.ijm based on PIV_.jar plugin, in headless mode. For more information about ImageJ headless mode, see here.

The macro itself is capable of iterating over all the *.tif files in a given directory, so there is no need to repeat in the python script.

Syntax

python ij_piv.py img_folder
  • img_folder: folder containing *.tif images

Note

To be able to run the command ImageJ or ImageJ-win64 (or other variants of ImageJ in different OS), we need to include the directory of the executable (.exe on windows) in the system path.

Note

I put the actual macro file PIV_STACK_directory.ijm in the main macro folder of FIJI (in my case “C:Fiji.appmacro”), so that ImageJ can find it without specifying the full path. On a different computer, I need to repeat this step.

Note

I did a slight modification on the PIV_.jar, just to suppress the tedious logging info every step. The core algorithm should be the same as the original plugin.

Edit

  • Dec 02, 2022 – Initial commit.

  • Jan 04, 2023 – Add quotation marks ” around directories, to make it capable of processing directories with spaces.

  • Jan 05, 2023 – Remove unused import.

  • Jan 18, 2023 – Fix docstring directory backslashes.

  • Feb 08, 2023 – Rewrite in function wrapper form, to make autodoc work properly. (autodoc import the script and execute it, so anything outside if __name__=="__main__" will be executed, causing problems)