Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Universal Z-Stack Focus Profiler & Slice Evaluator

Fiji Language License: MIT

An automated, modular Fiji/ImageJ macro for batch Z-stack focus profiling and optimal slice range selection across multi-channel 3D microscopy datasets. Supports all major vendor formats (.oif, .nd2, .czi, .tif, .lif, etc.) and handles any number of image channels ($N$ channels) dynamically.


Requirements & Prerequisites

To run this macro, you will need:

  • Fiji (ImageJ) (version 1.54 or later recommended).
  • Bio-Formats Plugin: Required to open proprietary microscopy stack formats (.oif, .nd2, .czi, .lif, etc.).

Features & Modularity

  • Multi-Format Support: Select specific proprietary file extensions (.oif, .nd2, .czi, .tif, .lif, .lsm) or process all supported formats in a folder.

  • Dynamic $N$-Channel Processing: Automatically detects channel count (1, 2, 3, 4+ channels) and appends individual metrics per channel to the final report.

  • Dual Analysis Modes:

    1. Dynamic Threshold Mode: Calculates signal bounds based on a relative threshold above background noise: $$\text{Threshold} = \text{Min} + \text{Cutoff} \times (\text{Max} - \text{Min})$$
    2. Fixed Sliding Window Mode: Identifies the optimal subset of $N$ contiguous slices maximizing cumulative edge focus score.
  • Interactive GUI Dialog: Configure parameters (extensions, threshold %, window size, padding, CSV auto-save) at launch without editing code.

    Z-Stack Profiler GUI

  • Headless Memory Optimization: Auto-clears buffer images to ensure crash-free execution on large batch datasets.


How to Use

  1. Open Fiji/ImageJ.
  2. Drag and drop Universal_Z_Stack_Profiler.ijm into Fiji, or add it at the end of the Fiji.app/macros/StartupMacros.fiji.ijm file.
  3. Click Run.
  4. Configure your analysis parameters in the setup dialog.
  5. Select the directory containing your 3D stack images.

Outputs

Upon execution, the macro generates:

  1. Results Table & Auto-Saved CSV: An interactive ImageJ table (and .csv file if enabled) listing peak Z-slices ($Z_{peak}$) and optimal slice counts for every channel of each file.
  2. Frequency Distribution Histograms: A standalone bar chart per channel (C1, C2, ..., Cn) visualizing the distribution of optimal slice counts across the entire batch.
  3. Global Summary Statistics: The ideal mean number of slices printed to the Log window per channel with total batch counts.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

An automated, modular Fiji/ImageJ macro for batch Z-stack focus profiling and optimal slice range selection across multi-channel 3D microscopy datasets.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages