An interactive FIJI/ImageJ plugin for real-time classification and visualization of fluorescence microscopy ROIs based on intensity thresholds.
This plugin provides an intuitive interface to classify nuclei (or any ROIs) as positive or negative based on mean fluorescence intensity, with color-coded visualization that updates in real-time. It's particularly useful for fluorescence microscopy workflows where you need to visually identify marker-positive cells.
- Real-time threshold adjustment: Interactive slider with fine-tuning buttons
- Multi-channel support: Independent thresholds for each channel
- Color-coded visualization: Customizable colors for positive and negative ROIs
- Automatic bit-depth detection: Works with 8-bit, 12-bit, and 16-bit images
- Channel synchronization: Automatically syncs with the image channel slider
- Log2 transformation display: Shows both linear and log2 threshold values
- Ramping speed control: Hold buttons for progressively faster threshold adjustment
- Customizable ROI appearance: Adjustable stroke width (1-20 pixels)
- Dynamic image/ROI updating: Switch between images or modify ROIs without restarting the plugin
- Real-time statistics: Live display of positive/negative counts and percentages
- Interactive histogram: Visual distribution of ROI intensities with automatic range optimization
- FIJI or ImageJ
- ROI Manager with segmented regions of interest
- A fluorescence image (grayscale or multi-channel)
- Download
ROI_Threshold_Adjuster.pyfrom this repository - Navigate to your FIJI installation directory
- Copy the file to:
Fiji.app/plugins/ - Restart FIJI or go to Help > Refresh Menus
- The plugin will appear in Plugins > ROI Threshold Adjuster
- Open your image in FIJI (works with both single-channel and multi-channel images)
- Segment your regions of interest (nuclei, cells, etc.) and add them to the ROI Manager
- Run the plugin: Go to Plugins > ROI Threshold Adjuster
- Adjust the threshold using the slider or +/- buttons
- ROIs will automatically color-code in real-time:
- Red (default): Positive ROIs (intensity > threshold)
- Blue (default): Negative ROIs (intensity ≤ threshold)
- Monitor the histogram to visualize the intensity distribution and optimize threshold placement
- Check statistics in real-time to see the distribution of positive vs negative ROIs
- Choose which channel to analyze in multi-channel images
- Independent thresholds are maintained for each channel
- Automatically syncs with the image's channel slider
- Positive color: Color for ROIs above threshold
- Negative color: Color for ROIs below threshold
- Available colors: Red, Blue, Cyan, Yellow, Magenta, Green, White, Gray, Dark Gray, Light Gray
- Adjust the thickness of ROI outlines (1-20 pixels)
- Default: 5 pixels
- Slider: Drag for broad adjustments
- + / - Buttons:
- Click for single-step changes (+1)
- Hold for ramping speed (1 → 5 → 10 → 50 → 100 per step)
- Range automatically adjusts based on image bit-depth:
- 8-bit: 0-255
- 12-bit: 0-4095
- 16-bit: 0-65535
- Shows current threshold value
- Displays log2 transformation in parentheses
- Useful for comparing with log-scaled data
- Visual representation of ROI mean intensity distribution
- Automatic range optimization: Displays the 99th percentile range (0.5th-99.5th) to exclude outliers
- Color-coded bars:
- Light red: ROIs above threshold (positive)
- Light blue: ROIs below threshold (negative)
- Threshold indicator: Red vertical line shows current threshold position
- Dynamic updates: Histogram refreshes automatically when:
- Threshold changes
- Channel changes
- Image/ROIs are updated
- Range information: Displays the actual data range at the bottom
- Smart axis scaling: Automatically adjusts to show the relevant intensity range
- Out-of-range indicators: Shows messages if threshold is outside the visible histogram range
- Real-time quantification of ROI classification
- Shows:
- Total number of ROIs
- Positive count and percentage
- Negative count and percentage
- Format:
Total: 68 | Positive: 45 (66.2%) | Negative: 23 (33.8%) - Updates automatically when threshold, channel, or ROIs change
- Displayed in bold for easy visibility
- Useful for:
- Quick assessment of marker expression levels
- Comparing thresholds across channels
- Documenting classification results
- Purpose: Refresh the analysis when switching images or modifying ROIs
- When to use:
- After switching to a different image
- After adding, removing, or modifying ROIs in the ROI Manager
- After changing the active image window
- What it does:
- Detects the currently active image
- Reads all ROIs from the ROI Manager
- Clears cached intensity measurements
- Recalculates thresholds and updates visualization
- Refreshes statistics and histogram displays
- Note: No need to close and restart the plugin when working with multiple images!
- Fine-tuning: Use the +/- buttons for precise threshold adjustments
- Quick navigation: Use the image's channel slider—the plugin will follow automatically
- Multi-channel analysis: Set different thresholds for different markers (e.g., DAPI, EdU, Ki67)
- Visual optimization: Adjust stroke width for better visibility on different image sizes
- Screenshot-ready: Choose high-contrast colors (e.g., Red/Blue or Cyan/Magenta) for publications
- Batch analysis: Keep the plugin open and use the Update button to analyze multiple images sequentially
- Record statistics: Take note of the percentage values for each channel to document your results
- Threshold optimization: Watch the statistics display and histogram while adjusting the threshold to find the optimal cutoff
- Histogram interpretation: Use the histogram to identify bimodal distributions (indicating two distinct populations) or to detect outliers
- Use the histogram: The visual distribution helps identify natural separation points between positive and negative populations
- Segment nuclei with DAPI
- Use EdU or Ki67 channel to identify proliferating cells
- Use histogram to identify the separation between positive and negative populations
- Set threshold to distinguish positive from negative cells
- Record the percentage of proliferating cells (e.g., "35.2% EdU+")
- Segment cells or nuclei
- Analyze expression of fluorescent markers
- Use histogram to visualize expression level distribution
- Quantify marker-positive vs marker-negative populations
- Compare percentages across experimental conditions
- Analyze multiple channels independently
- Each channel maintains its own threshold and histogram
- Easily switch between channels to optimize classification
- Document the percentage positive for each marker
- Use the histogram to identify natural cutoff points in your data
- Observe how threshold changes affect the positive/negative ratio
- Identify outliers that might be affecting your analysis
- Compare intensity distributions across different experimental conditions
- ROI Selection: The plugin reads all ROIs from the ROI Manager
- Intensity Measurement: For each ROI, it calculates the mean fluorescence intensity in the selected channel
- Classification: ROIs are classified as positive (mean > threshold) or negative (mean ≤ threshold)
- Visualization: ROI outlines are colored based on classification
- Statistics Calculation: Counts and percentages are calculated and displayed in real-time
- Histogram Generation: Creates a 100-bin histogram of ROI mean intensities using the 99th percentile range
- Caching: Mean intensities are calculated once per channel and cached for performance
The plugin automatically detects image bit-depth:
- 8-bit images: Direct detection
- 12-bit images: Detected when max pixel value ≤ 4095
- 16-bit images: Detected when max pixel value > 4095
- 32-bit float: Uses 16-bit range as maximum
The histogram automatically focuses on the relevant data range:
- Uses 0.5th and 99.5th percentiles to capture 99% of the data
- Excludes outliers from the displayed range while still counting them in statistics
- Adds a 10% margin on each side for better visualization
- Robust against extreme values that might skew the distribution
- Shows the actual data range at the bottom of the histogram
Problem: "No ROI Manager found" error
- Solution: Make sure you have ROIs loaded in the ROI Manager before running the plugin
Problem: "No image open" error
- Solution: Open an image in FIJI before launching the plugin
Problem: ROIs don't change color
- Solution: Ensure "Show All" is checked in the ROI Manager
Problem: Threshold seems incorrect
- Solution: Verify you're on the correct channel; check the bit-depth of your image
Problem: Can't see ROI outlines
- Solution: Increase stroke width or choose a higher-contrast color
Problem: Plugin shows old image/ROIs after switching
- Solution: Click the "Update Image/ROIs" button to refresh the analysis
Problem: Statistics show 0.0%
- Solution: Verify that ROIs are loaded and the Update button has been clicked
Problem: Histogram looks compressed or shows only a small range
- Solution: This is normal! The histogram automatically zooms to the 99% data range to exclude outliers
Problem: Threshold line not visible in histogram
- Solution: The threshold may be outside the visible range. Check for messages like "Threshold < [value]" or "Threshold > [value]" at the top of the histogram
Ariel Waisman
- Research Associate (Investigador Adjunto), CONICET
- Group Leader, FLENI
- Cardiac Stem Cell Biology & Regenerative Medicine
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
- Added interactive histogram display with automatic range optimization
- Histogram uses percentile-based range (99% of data) to exclude outliers
- Color-coded histogram bars (red for positive, blue for negative)
- Real-time histogram updates with threshold changes
- Added real-time statistics display with counts and percentages
- Enhanced visual feedback for classification results
- Added "Update Image/ROIs" button for dynamic image/ROI switching
- Improved handling of multiple images in the same session
- Initial release
- Multi-channel support with independent thresholds
- Real-time color-coded visualization
- Automatic bit-depth detection
- Ramping speed controls
- Log2 transformation display
- Channel synchronization
For questions, suggestions, or collaboration inquiries, please open an issue on GitHub.