Skip to main content
PatchKori Logo

PatchKori

Bioinformatics Patch Kits Hub for Gigapixel Biological Image Datasets

Out-of-core, memory-safe pyramidal tile extraction & analysis platform (OME-TIFF, QPTIFF, Pyramidal TIFF)


🔬 What is PatchKori?

Whole-slide biological and multiplexed fluorescence images (OME-TIFF, QPTIFF, Pyramidal TIFF, SVS, OME-Zarr) frequently exceed 10 GB to 100+ GB per image. Standard web tools and image viewers crash trying to load gigapixel planes into memory.

PatchKori solves this with a zero-copy, out-of-core streaming architecture:

  • Instant Header Inspection (<50ms): Reads multi-resolution pyramid levels ($L_0 \dots L_N$) and channels without reading image pixels into RAM.
  • Interactive Low-Res Preview Canvas: Displays an eye-soothing, colorblind-safe thumbnail preview. Draw an ROI box with your cursor or enter exact coordinates.
  • Direct-to-Disk Chunk Slicing: Uses Zarr-backed tifffile tile streaming to extract only the compressed tiles you need directly to your local drive without memory spikes.
  • Extensible Hub Architecture: Easily drop in future bioinformatics tools (e.g. segmentation, stain normalization) as self-contained plugins.

🚀 Quickstart: How to Use PatchKori

1. Installation

Clone and install PatchKori locally (Python 3.10+):

git clone git@github.com:jubayer98/PatchKori.git
cd PatchKori
pip install -e ".[dev]"

2. Launch the Web Interface

Start the local web application with one command:

patchkori launch

Your default browser will open automatically to http://127.0.0.1:7860.


🖥️ How to Use the Web Interface (Step-by-Step)

┌─────────────────────────────────┬─────────────────────────────────┬─────────────────────────────────┐
│ 1. Configuration & Tiling       │ 2. Interactive Canvas           │ 3. Execution & Gallery          │
│ • Local File Path               │ • [📐 Full Level ROI]           │ • Output Directory              │
│ • Optional markerlist.txt       │ • [✏️ Apply Hand-Drawn Box]     │ • Format (ome.tif / png / zarr) │
│ • [🧪 Load Sample Dataset]      │ • Thumbnail Preview             │ • [✂️ Run Out-of-Core Crop]     │
│ • Crop / Grid Tile Parameters   │ • Pyramid Level Table (L0..LN)  │ • Live Progress Feedback        │
│ • Target Level & Channels       │ • Full Channel Name Badges      │ • Instant Preview Gallery       │
└─────────────────────────────────┴─────────────────────────────────┴─────────────────────────────────┘
  1. Load Your Image:
    • Enter your Local File Path (e.g. /path/to/my_slide.qptiff or .ome.tif).
    • (Optional) Provide a markerlist.txt file (one channel name per line) to automatically name multiplex channels. If omitted, channel names are read from OME-XML or fallback to index numbers [0] Channel 0, [1] Channel 1...
    • Click 🔍 Inspect Pyramid (or click 🧪 Load Sample Dataset to test with the built-in 4-level pyramidal image).
  2. Select Region of Interest (ROI):
    • Hand-Drawn Box: Select the brush on the preview canvas, draw over your desired region, and click ✏️ Apply Hand-Drawn Box.
    • Full Slide: Click 📐 Full Level ROI to select the entire slide.
    • Numeric Tuning: Fine-tune X, Y, Width, and Height on the left.
  3. Choose Target Level & Channels:
    • Target Level: Choose from $L_0$ (highest resolution, 1.0×) down to $L_N$ (lowest resolution).
    • Channels Dropdown: Pick any subset of markers (e.g. [0] DAPI, [2] PanCK). Leaving it empty extracts all channels.
  4. Choose Crop Mode:
    • Single Bounding-Box ROI: Extracts a single cropped patch of the chosen region.
    • Sliding-Window Tile Grid: Slices the ROI into regular tiles (e.g. $256 \times 256$ or $512 \times 512$ with customizable overlap) for deep learning training datasets.
  5. Run Crop:
    • Click ✂️ Run Out-of-Core Crop.
    • Crops are written directly to your chosen local folder (outputs/crops) with instant visual previews in the gallery.

⚡ Headless CLI Usage (For HPC, Clusters & Pipelines)

You can run PatchKori headless without opening the browser:

# Slicing an ROI directly from the terminal
patchkori crop /data/wsi/sample.qptiff \
    --level 0 \
    --x 1024 --y 2048 --width 512 --height 512 \
    --format ome.tif \
    --output-dir ./results

# Sliding-window tiling for ML datasets
patchkori crop /data/wsi/sample.qptiff \
    --level 1 \
    --x 0 --y 0 --width 4096 --height 4096 \
    --mode tile_grid --tile-size 512 --overlap 64 \
    --format png \
    --output-dir ./training_tiles

🔌 Adding Future Bioinformatics Tools

Adding a 2nd or 3rd bioinformatics tool requires zero modifications to existing core code:

  1. Add pure algorithmic logic to src/patchkori/core/<my_tool>/.
  2. Create src/patchkori/ui/tools/<my_tool>.py:
import gradio as gr
from patchkori.ui.registry import BaseBioTool, ToolRegistry

@ToolRegistry.register
class MyBioTool(BaseBioTool):
    tool_id = "my-tool"
    title = "My Bio Tool"
    icon = "🔬"
    description = "Self-contained bioinformatics tool plugin."
    order = 20

    def build_ui(self, is_demo_mode: bool = False) -> None:
        gr.Markdown("### Custom Tool Workspace")
  1. Import it in src/patchkori/ui/tools/__init__.py. It automatically appears as a new tab in the Hub!

🛡️ License

MIT License. Developed for open-source biological imaging and computational pathology research.

Metadata

Release files for patchkori 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for patchkori 0.1.0
File Size Uploaded Provenance Actions
patchkori-0.1.0.tar.gz 8.1 MB With provenance Details for patchkori-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for patchkori 0.1.0
File Interpreter ABI Platform Actions
patchkori-0.1.0-py3-none-any.whl Python 3 none any Details for patchkori-0.1.0-py3-none-any.whl

Total release size: 8.2 MB

Release files / patchkori-0.1.0.tar.gz

Download URL patchkori-0.1.0.tar.gz
Size 8.1 MB
Tags Source
SHA-256 checksum
How to use checksums
ad6bc163256836432c6b4235837b5e09f39d38e1d186063cfb2e47b16c629513
BLAKE2b-256 checksum
How to use checksums
b33558fd905f5a629ff78c9a1f5eb256b28f1ecce07818770dbfea9a8c76b625
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / patchkori-0.1.0-py3-none-any.whl

Download URL patchkori-0.1.0-py3-none-any.whl
Size 28.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad38e7b6ef5f972957d764ee623a54958505e09b1878a95f8488ebbc201a98a0
BLAKE2b-256 checksum
How to use checksums
cadf03466d175ce3f0cc1427253503d707287a119646d7c878b5064c187a160c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for patchkori 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for patchkori-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page