Spaces:
Sleeping
Sleeping
File size: 1,968 Bytes
061a92d b2945a5 061a92d ead795a 061a92d b2945a5 061a92d b2945a5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | ---
title: Cell Fluorescence Quantification
emoji: π¬
colorFrom: red
colorTo: blue
sdk: gradio
sdk_version: 5.50.0
app_file: app.py
pinned: false
license: mit
---
# Cell Fluorescence Quantification
Automatic detection and quantification of cytoplasmic fluorescence in
RGB fluorescence microscopy images.
## How it works
Each input image is assumed to be a two-channel fluorescence image stored as RGB:
- **Blue channel** β nuclei stain (e.g. DAPI)
- **Red channel** β cytoplasmic marker whose intensity we want to quantify
The pipeline is:
1. **Segment nuclei** from the blue channel using Gaussian smoothing β
Otsu thresholding β morphological cleaning β watershed splitting on the
distance transform (to separate touching nuclei).
2. **Expand each nucleus** outward by a fixed pixel radius to define the
*whole cell* (nucleus + cytoplasm ring). Background pixels are assigned to
their nearest nucleus, with a Voronoi-style constraint so cells never
overlap.
3. **Select representative cells** β non-border, well-formed, spread out, with
above-median cytoplasm intensity (avoids picking dim background regions).
4. **Measure** in the red channel:
```
Cytoplasm Area = Cell Area - Nucleus Area
Cytoplasm IntDen = Cell IntDen - Nucleus IntDen
Mean Cytoplasm = Cytoplasm IntDen / Cytoplasm Area
```
## Outputs
- Annotated image with two concentric outlines per cell (outer = cell,
inner = nucleus) and a numbered label.
- A per-cell data table with all measurements.
- A downloadable CSV of the table.
## Local usage
```bash
pip install -r requirements.txt
python app.py
```
Then open the local URL printed in the console.
## Parameters
- **Cells per image** β how many cells to report per image (default 5).
- **Cytoplasm ring thickness** β pixel radius used to expand each nucleus
into the surrounding cytoplasm (default 12 px). Increase if your cells
have a thicker cytoplasm ring.
|