Python bridge to ImageJ2/Fiji for macros, plugins (Bio-Formats, TrackMate, Analyze Particles), NumPy↔ImagePlus/ImgLib2 exchange, and ImageJ Ops. Automates Fiji headlessly from Python. Use scikit-image for pure Python without Fiji plugins; napari for visualization.
SkillScore91Maintained
Automatic
◆Coding pack
Last verified 8/23/2026
What it changes
Passed 20 of 22 test cases with the skill, and 13 of 22 without it.
Without skill59%
With skill91%
Checks it passed that the model alone missed
Checks if size() equals zero on the results table.
Calls ij.macro.runMacroFile with the path to the script.
Sets the JAVA_TOOL_OPTIONS environment variable with the -Xmx8g flag.
and 4 more in the full report
7 fixed13 passed either way2 still failing0 broke
Pass-rate lift
+32 pp
Tokens
+277%
Agent turns
0%
Response time
-36%
Model gemini-3.6-flashMeasured 8/23/2026v120 of 22 cases passed with skill
Tokens, turns and time describe resource use, not a dollar price.
See it in action
One of 7 test cases the skill fixed. Same model, same prompt, with and without the skill.
1 of 7
Prompt
I want to apply a Gaussian blur with sigma=2 and an Otsu threshold using an inline macro string in PyImageJ. Show how to write and execute this inline macro on the currently open active image.
What was checked, without and with the skill
Checked
Without skill
With skill
Executes ij.macro.run with Gaussian Blur or setAutoThreshold in the macro string.
Missed
Passed
case-17 · gemini-3.6-flash · 8/23/2026 · answers are capped and redacted
What's inside
The instructions your model reads when the skill loads.
SKILL.md644 linessingle file
PyImageJ — Python Bridge to ImageJ/Fiji
Overview
PyImageJ provides a Python interface to ImageJ2 and Fiji through PyJNIus and scyjava, embedding a full Java Virtual Machine inside a Python process. It enables bidirectional data exchange between NumPy arrays and ImageJ's ImagePlus/ImgLib2 data structures, so you can preprocess images in Python, pass them into Fiji plugins (Bio-Formats, TrackMate, Analyze Particles, Weka segmentation), and return results back to pandas DataFrames. The library supports headless operation for scripting and batch processing, as well as GUI mode for interactive Fiji sessions.
When to Use
Running Fiji-specific plugins from Python: Bio-Formats multi-format I/O, TrackMate particle tracking, CLIJ2 GPU processing, or community Fiji update site plugins
Automating ImageJ macro pipelines headlessly without opening the Fiji GUI, e.g., batch processing an entire experiment overnight
Applying the ImageJ Ops framework (150+ image processing operations) with the full ImageJ type system
Converting between NumPy arrays (SciPy ecosystem) and ImageJ hyperstacks (TZCYX channel order) for round-trip processing
Parsing ImageJ Results tables and ROI Manager measurements into pandas DataFrames for downstream statistical analysis
Executing existing .ijm macro files as part of a Python workflow without rewriting them
Use scikit-image instead when you need pure Python processing without Fiji plugins — scikit-image is faster to install and avoids JVM overhead
Use napari instead for interactive multi-dimensional image visualization and annotation; PyImageJ does not replace a viewer
Prerequisites
Python packages: pyimagej, scyjava, numpy, pandas
Java: Java 8 or Java 11 (Java 17 is not supported); use conda for reliable Java management
Fiji/ImageJ2: Downloaded automatically on first init, or specify a local Fiji installation path
Environment: conda environment strongly recommended; pip-only installs often have JVM path issues