Run ImageJ runs an ImageJ command.
ImageJ is an image processing and analysis program. It operates by processing commands that operate on one or more images, possibly modifying the images. ImageJ has a macro language which can be used to program its operation and customize its operation, similar to CellProfiler pipelines. ImageJ maintains a current image and most commands operate on this image, but it's possible to load multiple images into ImageJ and operate on them together.
The RunImageJ module runs one ImageJ command or macro per cycle. It first loads the images you want to process into ImageJ, then runs the command, and, if desired, retrieves images you want to process further in CellProfiler.
Technical notes
ImageJ runs using Java, and as such, relies on proper handling of the Java memory requirements. When ImageJ starts, the Java Virtual Machine (JVM) allocates a portion of memory for its own use from the operating system; this memory is called the java heap memory. If you encounter JVM memory errors, you can tell CellProfiler to increase the size of the Java heap memory on startup.
To do this, run CellProfiler from the command line with the following argument: --jvm-heap-size=JVM_HEAP_SIZE
where JVM_HEAP_SIZE
is the amount of memory to be reserved for the JVM. Example formats for JVM_HEAP_SIZE
include 512000k, 512m, 1g, etc. For example, to increase the JVM heap memory to 2GB, use --jvm-heap-size=2g
Settings:
Run an ImageJ command or macro?
This setting determines whether
RunImageJ runs either a:
- Command: Select from a list of available ImageJ commands
(those items contained in the ImageJ menus); or
- Script: A script written in one of ImageJ 2.0's
supported scripting languages.
- Macro: An ImageJ 1.x macro, written in the
ImageJ 1.x macro language. Run_ImageJ runs ImageJ in 1.x
compatability mode.
Command
(Used only if running a Command)
The command to execute when the module runs.
Macro
(Used only if running a Macro)
This is the ImageJ macro to be executed. The syntax for ImageJ
macros depends on the scripting language engine chosen.
We suggest that you use the Beanshell scripting language
(Beanshell documentation).
Macro language
This setting chooses the scripting language used to execute
any macros in this module
Input the currently active image in ImageJ?
Select
Yes if you want to set the currently
active ImageJ image using an image from a
prior CellProfiler module.
Select No to use the currently
active image in ImageJ. You may want to do this if you
have an output image from a prior RunImageJ
that you want to perform further operations upon
before retrieving the final result back to CellProfiler.
Select the input image
(Used only if setting the currently active image)
This is the CellProfiler image that will become
ImageJ's currently active image.
The ImageJ commands and macros in this module will perform
their operations on this image. You may choose any image produced
by a prior CellProfiler module.
Retrieve the currently active image from ImageJ?
Select
Yes if you want to retrieve ImageJ's
currently active image after running the command or macro.
Select No if the pipeline does not need to access
the current ImageJ image. For example, you might want to run
further ImageJ operations with additional RunImageJ
upon the current image prior to retrieving the final image
back to CellProfiler.
Name the current output image
(Used only if retrieving the currently active image from ImageJ)
This is the CellProfiler name for ImageJ's current image after
processing by the command or macro. The image will be a
snapshot of the current image after the command has run, and
will be available for processing by subsequent CellProfiler modules.
Wait for ImageJ before continuing?
Some ImageJ commands and macros are interactive; you
may want to adjust the image in ImageJ before continuing.
Select
Yes to stop CellProfiler while you adjust the image in
ImageJ. Select
No to immediately use the image.
This command will not wait if CellProfiler is executed in
batch mode. See Help > Other Features > Batch Processing for more
details on batch processing.
Function to run before each group of images?
You can run an ImageJ 2.0 script, an ImageJ 1.x macro or a command before each group of
images. This can be useful in order to set up ImageJ before
processing a stack of images. Choose Nothing if
you do not want to run a command or macro, Command
to choose a command to run, Script to run an
ImageJ 2.0 script or Macro to run an ImageJ 1.x
macro in ImageJ 1.x compatibility mode.
Command
(Used only if running a command before an image group)
Select the command to execute before processing a group of images.
Macro
(Used only if running a macro before an image group)
This is the ImageJ macro to be executed before processing
a group of images. For help on writing macros, see
here.
Function to run after each group of images?
You can run an ImageJ 2.0 script, an ImageJ macro or a command after each group of
images. This can be used to do some sort of operation on a whole
stack of images that have been accumulated by the group operation.
Choose Nothing if
you do not want to run a command or macro, Command
to choose a command to run, Script to run an
ImageJ 2.0 script or Macro to run an ImageJ 1.x
macro in ImageJ 1.x compatibility mode.
Command
(Used only if running a command after an image group)
The command to execute after processing a group of images.
Macro
(Used only if running a macro after an image group)
This is the ImageJ macro to be executed after processing
a group of images. For help on writing macros, see
here.
Retrieve the image output by the group operation?
You can retrieve the image that is currently active in ImageJ
at the end of macro processing and use it later in CellProfiler.
The image will only be available during the last cycle of the
image group.
Select Yes to retrieve the active image for use in CellProfiler.
Select No if you do not want to retrieve the active image.
Name the group output image
(Used only if retrieving an image after an image group operation)
This setting names the output image produced by the
ImageJ command or macro that CellProfiler runs after processing
all images in the group. The image is only available at the
last cycle in the group