Page history Edit this page How do I edit this website?


RunImageJScript is a CellProfiler plugin that allows the addition of a new module type that runs ImageJ scripts. Built on the PyImageJ core, image data can be freely exchanged between the two applications across what has long been a Java-Python boundary.


Note: you will need to build CellProfiler from source to support RunImageJScript

CellProfiler has a plugin mechanism that allows runtime extension of modules, with the caveat that plugins requiring external libraries are not supported out-of-the-box. Unfortunately this includes RunImageJScript due to its dependency on PyImageJ and related software.

Build from source

You will need to create a python environment (whether through venv, conda, or your systemwide environment) that contains both PyImageJ and CellProfiler:

  1. Activate the environment of your choice
  2. Install PyImageJ
  3. Install Maven, either by downloading it or through your platform’s package manager. The mvn command must be available on your system path.
  4. Using Git, clone CellProfiler to get the source code
  5. On the CellProfiler wiki follow the installation instructions appropriate for your operating system

Add CellProfiler-plugins

  1. Using Git, clone CellProfiler-plugins to get the RunImageJScript module
  2. Open the CellProfiler you installed previously and set the CellProfiler plugins directory to the top level of the CellProfiler-plugins repository you just cloned
  3. Restart CellProfiler to complete the installation

CellProfiler preferences screen

Using the RunImageJScript module

After Installation we can now create RunImageJScript modules in a running CellProfiler.

  1. Use EditAdd ModuleAdvancedRunImageJScript to add the new module to your pipeline
  2. Select how your ImageJ/Fiji will be initialized. This follows the same principles of PyImageJ initialization:
    • RunImageJScript local initialization RunImageJScript endpoint initialization RunImageJScript latest initialization
    • Local will point to a on disk. This is the only option which does not automatically download and cache additional assets
    • Endpoint will take a list of one or more endpoint(s), e.g. sc.fiji:fiji:2.3.1
    • Latest will default to the latest release
  3. Select your ImageJ script to run. This can be any ImageJ2-style script, so it is highly recommended to read about Scripting in ImageJ to understand the basic concepts and syntax. You can select scripts of any supported language (not just Python). One starting point are the Tutorials script templates. There are a few additional notes about scripting particular to RunImageJScript:
    • Select script
    • Note that saving your CellProfiler workflow will save the path to the script, but not the script’s body. You will have to version and distribute the script with the workflow to attain reproducibility.
  4. Click the Get parameters from script button to detect your script’s parameters and expose them in CellProfiler. Note that the first time you run this it may be slow as the Java process running ImageJ is created. Subsequent parsing within the same CellProfiler session should be much faster.
    • Parsing parameters
    • @Parameters that are Image or basic (numeric, text) types will be automatically converted to CellProfiler settings. This may mean scripts with specialized parameters are not suitable for RunImageJScript at this time
  5. Adjust the parameter values as needed
    • Set parameters
    • Parameter settings can be removed from the CellProfiler GUI. This will stop outputs for showing. For inputs, ImageJ tries to make sensible guesses about defaults, but removing a critical input may cause the script to fail.
  6. (Optional) Disable Adjust image type
    • Adjust image type
    • This setting is enabled by default because ImageJ typically expects images to be an unsigned integer type, while CellProfiler always uses signed float types. It should only be disabled if your script accounts for images being signed floats.
  7. Run your workflow
    • Output
    • If RunImageJScript is your only module you can run things at this point (assuming you’ve loaded image(s) into the pipeline). You can also connect more modules up/downstream as desired.


If you run into any issues, please connect with us on the forum.