Skip to content

Repository files navigation

Batch Fluorescence Image Intensity Calculator

中文文档: README.zh-CN.md

This tool reads a folder of fluorescence images, calculates grayscale intensity values above a selected threshold, and exports one row per image to Excel.

It provides both a Tkinter desktop UI and a command-line entry point.

Features

  • Batch process .jpg and .jpeg images in one folder
  • Supports image paths containing Chinese characters
  • Applies a grayscale threshold before calculating intensity
  • Exports image name, maximum intensity, total intensity, and average intensity to .xlsx
  • Can be run from source or packaged with PyInstaller

Project Structure

.
├── examples/                         # Input format and command example
├── packaging/                        # PyInstaller spec
├── src/
│   └── fluorescence_intensity_batch_calculator/
│       ├── calculator.py             # Core image processing logic
│       ├── cli.py                    # Command-line entry point
│       └── ui.py                     # Tkinter GUI
├── .gitignore
├── pyproject.toml
└── README.md

Installation

python -m venv .venv
.venv\Scripts\activate
python -m pip install -e .

On macOS/Linux, activate the environment with:

source .venv/bin/activate

Run the GUI

fluorescence-intensity-gui

You can also run it as a module:

python -m fluorescence_intensity_batch_calculator

Run from Command Line

fluorescence-intensity "path/to/image-folder" --threshold 20 --output result.xlsx

If --output is omitted, the Excel file is saved next to the image folder as <folder-name>.xlsx.

Output Columns

  • 图像名称: source image filename without extension
  • 最大值: maximum grayscale value after thresholding
  • 总光强: sum of grayscale values above the threshold
  • 平均光强: total intensity divided by total pixel count

The threshold accepts values from 0 to 255. The average is calculated over the full image, including pixels removed by the threshold.

Tests

python -m pip install -e ".[dev]"
python -m pytest -q

The tests cover threshold calculation, invalid input, Chinese paths, batch ordering, and Excel export.

Build a Windows Executable

Install the build dependencies:

python -m pip install -e ".[build]"

Then run PyInstaller:

pyinstaller packaging/fluorescence-intensity-batch-calculator.spec

About

GUI and CLI tool for batch fluorescence-image intensity analysis and Excel export.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages