Spaces:
Sleeping
Sleeping
| 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. | |