--- 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.