pyimagej-fiji-bridge
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.
npx skills add BioTender-max/awesome-bio-agent-skills --skill pyimagej-fiji-bridge --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
The skill provides a Python interface to ImageJ2/Fiji, allowing headless automation and data exchange between Python (NumPy) and ImageJ data structures (ImagePlus/ImgLib2). It can run Fiji plugins (Bio-Formats, TrackMate, Analyze Particles), execute macros (.ijm) or macro strings, and use ImageJ Ops. It enables converting between NumPy arrays and ImageJ representations, and supports optional GUI mode. It also supports reading ImageJ Results tables into Python and interacting with the ROI Manager.
How it works
The skill shows usage patterns through modules:
- Initialization: call imagej.init with different modes (headless, gui, or local Fiji path). It loads Fiji/ImageJ2 and can download on first init. It prints the ImageJ version and headless state.
- Image I/O: open images via ij.io().open and convert between NumPy arrays and ImageJ formats using ij.py.to_imageplus / ij.py.from_imageplus. It supports multi-format inputs via Bio-Formats and saving via ij.io().save.
- Macro Execution: run inline macros with ij.macro.run, supply options strings, or execute macro files with ij.macro.runMacroFile. Macros run inside ImageJ and can return values.
- ImageJ Ops: apply image processing via ij.op().filter().gauss and other Ops, converting results back to NumPy when needed.
- Plugin and Command Calls: invoke SciJava commands via ij.command().run with parameters, including opening files through Bio-Formats or analyzing particles with specific settings.
- Results and ROI: access the Results Table (getResultsTable) after measurements and extract data to a Python DataFrame; access the ROI Manager via the IJ Java class to enumerate ROIs.
- Workflows: includes example workflows for automated fluorescence quantification and batch macro processing, including loading images, applying processing, running analyses, and exporting results to CSV.
When to use it
- You need to run Fiji plugins or macros from Python without manual GUI interaction (headless scripting).
- You want to exchange data between NumPy arrays and ImageJ data structures for preprocessing, analysis, and results export.
- You require batch processing of images or macro-based pipelines, with results collected in Python (pandas DataFrames or CSV).
- You prefer using ImageJ Ops and existing Fiji plugins alongside Python workflows, with optional visualization via napari.
What it can touch
- Tools and components explicitly used:
pyimagej,scyjava, NumPy, pandas, and Java-backed ImageJ components. It demonstrates interactions with ImageJ modules, macros, commands, and the ROI Manager, as well as converting between NumPy arrays and ImageJ data types.
Caveats
- Fiji/ImageJ downloads may occur on first init and can require substantial disk space (~500 MB in example).
- Java/JVM considerations apply (Java 8 or 11 recommended; Java 17 not supported in prerequisites).
- The skill emphasizes headless operation for scripting; GUI mode is supported but not detailed in every flow.
- The license provided is Apache-2.0; no explicit third-party license notes are stated beyond that.
# 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
- Overview
- When to Use
- Prerequisites
- Quick Start
- Core API
- Module 1: Initialization
- Module 2: Image I/O
- Module 3: Macro Execution
- Module 4: ImageJ Ops
- Module 5: Plugin and Command Calls
- Module 6: Results Table and ROI Analysis
- Common Workflows
- Workflow 1: Automated Fluorescence Quantification
- Workflow 2: Batch Fiji Macro Processing
conda create -n pyimagej -c conda-forge pyimagej openjdk=11
conda activate pyimagej
Install additional dependencies
pip install pandas tifffile
Verify
python -c "import imagej; ij = imagej.init('sc.fiji:fiji', mode='headless'); print(ij.getVersion())"What does the pyimagej-fiji-bridge skill do?
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.
How do I install it?
Run `npx skills add BioTender-max/awesome-bio-agent-skills --skill pyimagej-fiji-bridge --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From BioTender-max/awesome-bio-agent-skills, a repository with 144 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
