Multi-Channel Nuclear Analysis
An ImageJ/FIJI plugin for analyzing multi-channel fluorescence images with a focus on nuclear segmentation using StarDist.
Table of Contents
- Introduction
- Installation
- Requirements
- Compatibility Notice
- Usage
- Tutorial and Example Data Analysis with Python
- Plugin for Merging Channels into Multi-Channel TIF Files
- Credits
- Citation
Introduction
Quantitative analysis of fluorescence microscopy images requires multiple steps, from image acquisition, followed by data extraction, visualization and statistical analysis.
This tool allows researchers to easily extract fluorescence and shape based metrics from multi-channel fluorescence microscopy images by combining the power of the StarDist nuclear segmentation algorithm with customizable channel processing parameters. The macro automates routine tasks in image analysis workflows:
- Nuclear segmentation using StarDist
- Multi-channel intensity and shape measurements within segmented regions
- Data organization and export for further analysis
- Batch processing of multiple images
Installation
Download the file “Multi_Channel_Nuclear_Analysis.ijm” using the button at the top of the page. Copy the file into FIJI/ImageJ plugins folder or, within FIJI/ImageJ, go to plugins > install and navigate to the file location. Restart FIJI before using the script.
Requirements
- ImageJ or FIJI (recommended)
- The following plugins installed in ImageJ/FIJI:
- StarDist
- CSBDeep (required for StarDist to function)
- TensorFlow (required for StarDist to function)
To install Stardist, CSBDeep, and TensorFlow plugins in FIJI:
- Open FIJI
- Go to
Help > Update...
- Click on
Manage update sites
- Check the boxes for:
- StarDist
- CSBDeep
- TensorFlow
- Click
Close
- Click
Apply Changes
- Restart FIJI
This will ensure that StarDist and all its dependencies (CSBDeep and TensorFlow) are properly installed.
Compatibility Notice
Important: Java Version Compatibility
This plugin requires FIJI running on Java 8 to function properly. Due to ongoing transitions in the FIJI/ImageJ ecosystem, the latest FIJI releases now use Java 21, which causes compatibility issues with TensorFlow and StarDist plugins that this tool depends on.
How to Check Your FIJI’s Java Version
- Open FIJI
- Go to
Help > About ImageJ...
- Look for the Java version information in the about dialog
- If it shows Java 1.8.x, your FIJI is compatible
- If it shows Java 17.x or 21.x, you need to download the stable version
How to Get a Compatible Version
- Go to the FIJI download page
- Download the stable version (right column) for your operating system
- Choose the JRE (Java Runtime Environment) version, not the JDK version
- The stable versions run on Java 8 and are fully compatible with this plugin
- Avoid the latest versions (left column) which run on Java 21
Compatibility Status
- Windows, macOS, and Linux: Compatible with stable FIJI versions (Java 8)
- All platforms: Not compatible with latest FIJI versions (Java 21)
This compatibility issue is temporary and will be resolved once the TensorFlow and StarDist plugins are updated to support Java 21. We will update this documentation when full compatibility is achieved.
On macOS systems, users may encounter permission-related errors (e.g., “Can’t create an ImageOutputStream” or “Permission denied”) when the plugin attempts to save files. This is due to macOS security restrictions. To resolve this issue, users should:
- Ensure FIJI has permission to access the folder containing the images (avoid using system-protected locations like Desktop or Documents)
- Move the image files to a user-created folder with full permissions (e.g., create a new folder in your home directory)
- If using the Desktop or Documents folders, grant FIJI full disk access in System Preferences > Security & Privacy > Privacy > Full Disk Access
Usage
- Open ImageJ/FIJI
- Run the macro by selecting
Plugins > Multi-Channel Analysis
(bottom of the list) - Follow the step-by-step dialog boxes to configure your analysis
- Choose your input directory containing images
- Review results in the output directory
Input Requirements
- Image Format: Images should be in TIF or CZI format (Zeiss microscope format). If your channels for an image are separated in different files, see “Plugin for merging channels into a single TIF file”.
- Channel Organization: All channels must be stored within the same image file
- Image Structure: The script expects fluorescence images with a nuclear channel for segmentation
Preparation
Before running the script, it’s recommended to:
- Explore Your Images: Open a representative image in ImageJ/FIJI
- Determine Channel Count: Check how many channels your images have (1-4 supported)
- Choose Background Subtraction Method: For each channel, decide whether to use:
- Standard background subtraction: Best for images with uniform background
- Rolling ball background subtraction: Better for images with uneven background illumination
- Set Background Values:
- For standard subtraction: Determine appropriate background values to subtract from each channel
- For rolling ball method: Determine appropriate radius (in pixels) for each channel
- Determine Max Display Values: Find suitable brightness values for optimal visualization of PNG images
- Plan Channel Assignments: Decide which channel will be used for nuclear segmentation
The values you determine in this preparation stage will be used in the configuration dialog boxes when running the script.
Configuration Options
The script offers a user-friendly interface with three main configuration steps:
- Welcome Dialog:
- Select number of channels in your images (1-4)
- Open the ImageJ “Set Measurements” dialog to select which measurements to include
- Channel Configuration:
- For each channel, set:
- Background subtraction value
- Background subtraction method:
- Standard subtraction: Subtracts a fixed value from each pixel
- Rolling ball method: Uses ImageJ’s rolling ball algorithm to remove uneven background (value represents radius in pixels)
- Maximum display value in PNG images
- Color for visualization
- Suffix for naming output files
- For each channel, set:
- Merge and Segmentation Configuration:
- Select which channels to include in merged visualization
- Choose which channel to use for nuclear segmentation
Output Files
The script generates the following outputs in an “analisis” subfolder:
Images
[ImageName]_Channel#.png
: Individual channel images with applied settings[ImageName]_segmentation.png
: Visualization of the segmentation results[ImageName]_merge.png
: Merged multi-channel image (if configured)
Data Files
[ImageName]_Channel#_tabla.csv
: Measurements for each individual channel[ImageName]_allChannels.csv
: Combined measurements for all channels with shape features (Area, Perimeter, etc.) appearing once and intensity features (Mean, StdDev, etc.) for each channelComplete_data.csv
: Concatenation of all _allChannels.csv files for batch analysis[ImageName]RoiSet.zip
: ImageJ ROI file containing the segmented regionsanalysis_parameters.txt
: Record of the analysis parameters used
Data Analysis
The CSV tables are the primary output for further quantitative analysis:
For Users Without Programming Skills
- Use the
[ImageName]_allChannels.csv
files for individual image analysis - Use the
Complete_data.csv
file for analyzing all processed images - Import these files into tools like GraphPad Prism, Excel, or similar software for plotting and statistical analysis
For Users With Basic Programming Skills
- Use the
Complete_data.csv
file with Python (pandas, matplotlib, seaborn) or R to create:- More complex visualizations
- Advanced statistical analyses
- Custom data processing workflows
- Correlations between channels or features
Tips for Best Results
- Run the macro on a representative subset of images first to validate settings
- Ensure your nuclear segmentation works well using Stardist. If you get subnuclear segmentation, try changing the scale of the images (ctrl+E in FIJI)
- For images with uneven background illumination, use the rolling ball method rather than standard subtraction
- Choose an appropriate rolling ball radius: typically 2-3× the size of the largest object that is not part of the background
- When using the rolling ball background subtraction method, the plugin measures and stores the mean fluorescence intensity of the background image in the CSV files (column name: “[ChannelSuffix]_Mean_rolling_background”)
- This measurement serves as a valuable internal control across your experimental conditions
- In comparable samples, the mean background fluorescence should be relatively consistent
- If one condition shows a significantly higher background value, it may indicate a methodological issue
- High cell density can particularly affect rolling ball background calculation, as the algorithm may not be able to properly distinguish background from densely packed cells
- Substantial differences in background measurements might suggest reconsidering the rolling ball radius or switching to a different background subtraction approach for that condition
- Adjust the StarDist parameters if needed for optimal segmentation
- Consider pre-processing images if they have high background or noise
Full tutorial on youtube
Watch the comprehensive tutorial on how to use the Multi-Channel Nuclear Analysis plugin:
Example Data Analysis with Python
To help users get started with data analysis, I provide an example dataset with analysis code in Python. This demonstrates a typical workflow from raw data to visualization.
Example Experiment
This example is based on a real experiment involving mouse embryonic stem cells (mESCs) engineered to inducibly express a fusion protein comprising the transcription factor OCT6 linked to the mCherry fluorescent protein. Expression was induced by doxycycline treatment for 1, 2 or 3 days. An immunofluorescence was then performed against NANOG (alexa fluor 488), and nuclei were stained with DAPI. Channel
Key experimental details:
- Cells: Mouse embryonic stem cells (mESCs)
- Channel 1: DAPI
- Channel 2: NANOG-488
- Channel 3: OCT6-mCherry
- Background subtraction methods:
- mCherry channel: Rolling ball method (to address non-homogeneous background)
- NANOG channel: Fixed background value subtraction
Analysis Files
Download the example data and analysis files: Download Example Dataset (ZIP)
The ZIP file contains:
- Original microscopy images
Interactive Analysis in Google Colab
Explore the analysis interactively using the Google Colab notebook
The notebook demonstrates:
- Loading and exploring the CSV data from the ImageJ plugin
- Data cleaning and transformation
- Basic exploratory data analysis
- Creating publication-quality visualizations
This example shows how different background subtraction methods (fixed value vs. rolling ball) can be applied to different channels based on their characteristics, and how to analyze the resulting data.
Plugin for Merging Channels into Multi-Channel TIF Files
Some microscopes (such as Evos microscopes from ThermoFisher Scientific) save each channel as a separate TIF file instead of combining them into a multi-channel file. For these cases, I provide a companion plugin called Merge_multi_channel_tif.ijm
that merges separate channel files into a single multi-channel TIF file before analysis.
Installation and Usage
- Download the
Merge_multi_channel_tif.ijm
file - Install it in the same way as the main plugin (copy to the FIJI/ImageJ plugins folder or use Plugins > Install)
- Run the plugin through the Plugins menu
- Follow the configuration dialogs to set up the channel merging
File Naming Requirements
For the channel merging plugin to work correctly, your files must follow a consistent naming convention:
- Each set of files must share a common base name
- Each file must have a unique channel suffix at the end of the filename
- Files should use the
.tif
extension
Example:
10X-Image1-DAPI.tif // Base name: "10X-Image1", Suffix: "-DAPI"
10X-Image1-488.tif // Base name: "10X-Image1", Suffix: "-488"
10X-Image1-594.tif // Base name: "10X-Image1", Suffix: "-594"
The plugin will identify files with the same base name, merge them according to the channel configuration you specify, and save the result as a multi-channel TIF file that can be used with the main analysis tool.
Credits
Developed by Ariel Waisman at FLENI, Argentina
This tool utilizes the StarDist algorithm for nuclear segmentation:
Uwe Schmidt, Martin Weigert, Coleman Broaddus, and Gene Myers.
Cell Detection with Star-convex Polygons.
International Conference on Medical Image Computing and Computer-Assisted Intervention (MICCAI), Granada, Spain, September 2018.
Citation
Pending publication
License
MIT License Copyright (c) 2025 Ariel Waisman