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.
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
- Activate the environment of your choice
- Install PyImageJ
- Install Maven, either by downloading it or through your platform’s package manager. The
mvncommand must be available on your system path.
- Using Git, clone CellProfiler to get the source code
- On the CellProfiler wiki follow the installation instructions appropriate for your operating system
- Using Git, clone CellProfiler-plugins to get the
- Open the
CellProfileryou installed previously and set the
CellProfiler plugins directoryto the top level of the
CellProfiler-pluginsrepository you just cloned
CellProfilerto complete the installation
Using the RunImageJScript module
After Installation we can now create
RunImageJScript modules in a running CellProfiler.
- Use Edit › Add Module › Advanced › RunImageJScript to add the new module to your pipeline
- Select how your ImageJ/Fiji will be initialized. This follows the same principles of PyImageJ initialization:
- Local will point to a
Fiji.appon 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.
- Latest will default to the latest release
- 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:
- 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.
- Click the
Get parameters from scriptbutton 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.
@Parametersthat 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
- Adjust the parameter values as needed
- 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.
- (Optional) Disable
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.
- Run your workflow
RunImageJScriptis 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 Image.sc forum.