Skip to main content

General keypoint annotation GUI for 2D/3D/time microscopy, with a phage preset

Project description

Phage Annotator

PyPI
License
Python

IMPORTANT NOTICE — PLEASE READ

This codebase is NOT open for reuse, modification, redistribution, or integration in any project without my explicit written permission.
If you wish to reuse or extend any part of this software (code or GUI), please contact me directly for authorization.

Email: chandrasekarnarayana@gmail.com

The repository contains my original research software and full workflow implementation.
Unauthorized copying or reusing any portion of this code is strictly prohibited.


Phage Annotator

Phage Annotator is an interactive, publication-grade keypoint annotation tool for fluorescence microscopy.
Built with Matplotlib + Qt (no Tkinter, no Napari), it supports precise annotation of particles in 2D / 3D / time TIFF and OME-TIFF datasets.

It is designed for single-molecule and phage imaging, but can be used for any keypoint-based microscopy annotation workflow.


Key Features

  • Five synchronized panels
    Frame, Mean projection, Composite/GT, Support (secondary modality), Standard deviation map
    — all with shared zoom, shared ROI, and shared navigation.

  • TIFF / OME-TIFF loading with automatic axis standardization to (T, Z, Y, X)
    and manual override for ambiguous stacks.

  • Lazy, on-demand image loading
    (load folders without loading all images into memory).

  • Display crop vs. ROI — fully independent
    Crop (X, Y, W, H) for viewing; ROI (X, Y, W, H) or circle for annotation constraints.

  • Annotation system

    • Add/remove with click radius
    • Per-panel visibility
    • Annotate on Frame / Mean / Composite / Support
    • Editable annotation table
    • Import legacy x/y CSV or structured CSV/JSON
    • Save CSV / JSON
    • Quick-save with s
  • Intensity controls
    vmin/vmax, colormap switcher, histogram, stats, linked playback-safe zoom.

  • Analysis tools

    • Line profile (raw/corrected)
    • ROI mean over frames with bleaching fit
    • ROI mean table for all files with CSV export
  • Playback engine
    Time or depth slider, auto-play with FPS, optional loop
    — zoom preserved during playback.


Architecture


src/phage_annotator/
├── io.py              # TIFF loader, metadata, axis normalizer
├── annotations.py     # Keypoint models, CSV/JSON serializers
├── gui_mpl.py         # Full Qt + Matplotlib GUI
├── cli.py             # CLI entry point
└── config.py          # App defaults


Installation

Install from PyPI

pip install phage-annotator

From source

python -m venv .venv-phage
source .venv-phage/bin/activate
pip install .

System Requirements

  • Python 3.9+
  • PyQt5 (auto-installed)
  • Linux / macOS / Windows with GUI support

Usage

Basic launch

phage-annotator -i image1.tif image2.ome.tif

Folder-based workflow

Use File → Open folder… to populate the FOV list (lazy loading).

Highlights

  • Five synchronized views with shared ROI
  • Crop view independently of ROI
  • Annotate across frames / all frames
  • Edit annotation table directly
  • Histogram + stats + line profile
  • Playback with zoom lock
  • Multi-modality visualization (Primary + Support)

GUI Walkthrough

Navigation

  • FOV list
  • Prev / Next
  • Primary / Support selector

Playback

  • Time slider (T)
  • Depth slider (Z)
  • FPS + Loop

Intensity + Colormap

  • vmin/vmax sliders
  • Gray / Viridis / Magma / Plasma / Cividis

Annotation

  • Add: click
  • Remove: click near point
  • Choose label (phage/artifact/other)
  • Marker size vs. click radius (separate controls)
  • Show/hide annotation per panel

Export

  • Save CSV
  • Save JSON
  • Quick-save (s)

Keyboard Shortcuts

Key Action
r Reset zoom
c Cycle colormap
s Save CSV

Annotation Data Format

CSV

image_id, image_name, t, z, y, x, label

JSON example

{
  "image_name_1": [
    {"image_id": 0, "image_name": "image_name_1", "t": 0, "z": 0, "y": 10.5, "x": 20.1, "label": "phage"}
  ]
}

Supported Image Types

  • .tif, .tiff, .ome.tif, .ome.tiff

  • Automatically interpreted as:

    • 2D → (1,1,Y,X)
    • Z-stack → (1,Z,Y,X)
    • Time-stack → (T,1,Y,X)
    • Full TZ stack → (T,Z,Y,X)

Troubleshooting

  • Qt errors → ensure system has a display or use Xvfb
  • Very large TIFFs → use lazy load and crop view
  • Wrong axis interpretation → override using the “Interpret 3D axis as” control

Roadmap

  • Multi-channel support
  • Undo/redo
  • Polygon ROI
  • Batch annotation presets
  • Fully dockable GUI layout

Contribution Policy

At this time, the project does not accept external code contributions. You may file issues, but code modifications or forks are NOT permitted without my written permission.


Custom License Notice

Although the repository includes an MIT license file for packaging compatibility, actual reuse rights are restricted.

No part of this codebase may be reused, modified, cloned, forked, or integrated into any other software — commercial or academic — without explicit written permission from the author.


Citation

If you use this tool in research, please cite (Will be updated soon):

“Phage Annotator — Chandrasekar Subramani Narayana (2025)”

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phage_annotator-1.0.1.tar.gz (38.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

phage_annotator-1.0.1-py3-none-any.whl (37.3 kB view details)

Uploaded Python 3

File details

Details for the file phage_annotator-1.0.1.tar.gz.

File metadata

  • Download URL: phage_annotator-1.0.1.tar.gz
  • Upload date:
  • Size: 38.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for phage_annotator-1.0.1.tar.gz
Algorithm Hash digest
SHA256 994615e79a40461dc51130c38bb47760c43f4f383e1533dda62c3496b5302fd1
MD5 3d5e539a4c274091b47e06d3ad471d5f
BLAKE2b-256 f2ddb008e533041da898df0f5d3da49195a6d592bcd0459f61963a9a81715254

See more details on using hashes here.

File details

Details for the file phage_annotator-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for phage_annotator-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 76633fc0bbbc6f0a0ce929960e7179f197740678a144b15446f39665c9f96b0b
MD5 dbcc2839546d37c0bdb7c76093c6a8e4
BLAKE2b-256 239fda72a9af5c81cbe7b209e61839ac90f77c9a323fe1f82b17bf2d016f3c89

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page