Difference between revisions of "Batch Processing"

(Update path to Process Folder template.)
(Start work on documenting SciJava batch processor - more updates and new screenshots to follow)
Line 2: Line 2:
 
= Overview =
 
= Overview =
  
A fundamental benefit to creating [[Scripting|scripts and macros]] in [[ImageJ]] is the ability to reuse their functionality on more than one image. Although this can be done manually, there are multiple ways to easily automate this batch processing.
+
A fundamental benefit to creating [[Scripting|scripts and macros]] in [[ImageJ]] is the ability to **reuse** their functionality **on more than one image**. Although this can be done manually, there are multiple ways to easily automate this batch processing.
  
 
= General workflow =
 
= General workflow =
  
# Create a basic macro which operates on the active image.
+
# Create a basic macro/script which operates on the active image or on a single file.
 
#* The [[Introduction into Macro Programming#The_recorder|macro recorder]] is an excellent way to generate macro code.
 
#* The [[Introduction into Macro Programming#The_recorder|macro recorder]] is an excellent way to generate macro code.
 
#* The [[Introduction into Macro Programming]] explains the principles of macro writing.
 
#* The [[Introduction into Macro Programming]] explains the principles of macro writing.
Line 13: Line 13:
 
#* See below for details.
 
#* See below for details.
  
= Easy option =
+
= Option 1 - {{bc | Process | Batch | Macro...}} =
  
 
The fastest way to start batch conversion is via the [http://imagej.net/docs/guide/146-29.html#toc-Subsubsection-29.12.3 {{bc | Process | Batch | Macro...}}] command. This will open a dialog (below) that will allow you to specify an input and output directory. You can select an output file format, and then use the <code>Add Macro Code</code> drop-down to generate a macro with the desired functionality.
 
The fastest way to start batch conversion is via the [http://imagej.net/docs/guide/146-29.html#toc-Subsubsection-29.12.3 {{bc | Process | Batch | Macro...}}] command. This will open a dialog (below) that will allow you to specify an input and output directory. You can select an output file format, and then use the <code>Add Macro Code</code> drop-down to generate a macro with the desired functionality.
Line 19: Line 19:
 
[[Image:BatchProcess.png|center]]
 
[[Image:BatchProcess.png|center]]
  
= Flexible option =
+
= Option 2 - Script Template =
  
 
Open the [[Using_the_Script_Editor|script editor]], select {{bc | Templates | ImageJ 1.x | Batch | Process Folder (IJ1 Macro)}}. This will generate the following boilerplate:
 
Open the [[Using_the_Script_Editor|script editor]], select {{bc | Templates | ImageJ 1.x | Batch | Process Folder (IJ1 Macro)}}. This will generate the following boilerplate:
Line 26: Line 26:
  
 
Lines 26 and 27 can now be edited, replaced with the functional macro code you would like to apply to all images of a given type in a folder. Furthermore you can now modify the batch processing logic itself, for example if you need to customize what (if any) output information is saved.
 
Lines 26 and 27 can now be edited, replaced with the functional macro code you would like to apply to all images of a given type in a folder. Furthermore you can now modify the batch processing logic itself, for example if you need to customize what (if any) output information is saved.
 +
 +
= Option 3 - Batch Processing with Script Parameters =
 +
 +
{{Notice|This section is currently being expanded to document the current state of the [https://github.com/scijava/batch-processor/ SciJava Batch Processor]. The Batch Processor is a new addition to the SciJava/ImageJ framework. If you encounter any issues, please report/ask on the [[forum]].}}
 +
  
 
= See also =
 
= See also =

Revision as of 07:13, 25 June 2018

Learn
Topics
Introduction
Getting Started
User Guides
Tutorials
Tips and Tricks
Presentations
Plugins
Techniques
All Techniques
Colocalization
Deconvolution
Registration
Segmentation
Stitching
Tracking
Visualization
Scripting
Overview
User input
Basics of script writing
Batch processing
Script Editor
Auto Imports
Templates
Running headlessly
Comparisons
Toolbox
Multithreading in Clojure
Multithreading in JavaScript
Chess in Jython
Languages
BeanShell
Groovy
ImageJ Macro
JavaScript
Lisp (Clojure)
MATLAB
Python (Jython)
R (Renjin)
Ruby (JRuby)
Scala

Overview

A fundamental benefit to creating scripts and macros in ImageJ is the ability to **reuse** their functionality **on more than one image**. Although this can be done manually, there are multiple ways to easily automate this batch processing.

General workflow

  1. Create a basic macro/script which operates on the active image or on a single file.
  2. Apply your macro to a group of images.
    • These images do not need to be open in ImageJ already—they will be read in as part of the batch process.
    • See below for details.

Option 1 - Process  ▶ Batch  ▶ Macro...

The fastest way to start batch conversion is via the Process  ▶ Batch  ▶ Macro... command. This will open a dialog (below) that will allow you to specify an input and output directory. You can select an output file format, and then use the Add Macro Code drop-down to generate a macro with the desired functionality.

BatchProcess.png

Option 2 - Script Template

Open the script editor, select Templates  ▶ ImageJ 1.x  ▶ Batch  ▶ Process Folder (IJ1 Macro). This will generate the following boilerplate:

Process folder ij1.png

Lines 26 and 27 can now be edited, replaced with the functional macro code you would like to apply to all images of a given type in a folder. Furthermore you can now modify the batch processing logic itself, for example if you need to customize what (if any) output information is saved.

Option 3 - Batch Processing with Script Parameters



See also