{"name":"napari-segmencolo","display_name":"SegmenColo","visibility":"public","icon":null,"categories":[],"schema_version":"0.2.1","on_activate":null,"on_deactivate":null,"contributions":{"commands":[{"id":"napari-segmencolo.make_widget","title":"Open SegmenColo","python_name":"napari_segmencolo:SegmenColoWidget","short_title":null,"category":null,"icon":null,"enablement":null}],"readers":null,"writers":null,"widgets":[{"command":"napari-segmencolo.make_widget","display_name":"SegmenColo","autogenerate":false}],"sample_data":null,"themes":null,"menus":{},"submenus":null,"keybindings":null,"configuration":[]},"package_metadata":{"metadata_version":"2.4","name":"napari-segmencolo","version":"0.1.4","dynamic":["license-file"],"platform":null,"supported_platform":null,"summary":"A napari plugin for AI-based image segmentation, colocalization and classification","description":"# napari-segmencolo\n\n[![License BSD-3](https://img.shields.io/pypi/l/napari-segmencolo.svg?color=green)](https://github.com/lenaproux-cyber/napari-segmencolo/raw/main/LICENSE)\n[![PyPI](https://img.shields.io/pypi/v/napari-segmencolo.svg?color=green)](https://pypi.org/project/napari-segmencolo)\n[![Python Version](https://img.shields.io/pypi/pyversions/napari-segmencolo.svg?color=green)](https://python.org)\n[![CI](https://github.com/lenaproux-cyber/napari-segmencolo/actions/workflows/test_and_deploy.yml/badge.svg)](https://github.com/lenaproux-cyber/napari-segmencolo/actions/workflows/test_and_deploy.yml)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.21670153.svg)](https://doi.org/10.5281/zenodo.21670153)\n[![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/napari-segmencolo)](https://napari-hub.org/plugins/napari-segmencolo)\n[![npe2](https://img.shields.io/badge/plugin-npe2-blue?link=https://napari.org/stable/plugins/index.html)](https://napari.org/stable/plugins/index.html)\n[![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-purple.json)](https://github.com/copier-org/copier)\n\nA napari plugin for AI-based image segmentation, with multichannel\ncolocalization filtering, classification, and export (TIFF / Excel).\n\n> Developed during an internship in fluorescence imaging at the UCD Conway Institute (Dublin), with the help of AI.\n\n----------------------------------\n\nThis [napari] plugin was generated with [copier] using the [napari-plugin-template].\n\n## Features\n\n| Tab | What it does |\n|---|---|\n| ① Segmentation | StarDist · Cellpose · Ilastik-style pixel classification — 2D & 3D |\n| ② Colocalization | KEEP/EXCLUDE filtering by fluorescence channel |\n| ③ Classification | KMeans (unsupervised) or RandomForest (semi-supervised), with nameable classes |\n| ④ Export | TIFF + object counts (Excel) |\n| ⑤ Batch | Process a whole folder of CZI files automatically → Excel summary |\n\nWorks in 2D and on z-stacks (via MIP projection or slice-by-slice merging).\n\n## Installation\n\nYou can install `napari-segmencolo` via [pip]:\n\n```bash\npip install napari-segmencolo\n```\n\nTo install together with napari and a Qt backend:\n\n```bash\npip install \"napari-segmencolo[all]\"\n```\n\nFor development (from a local clone):\n\n```bash\npip install -e \".[all]\"\n```\n\n## Quick start\n\n### 1. Segmentation\n\n1. Open your image in napari (File > Open, or drag and drop).\n2. In the plugin, **① Segmentation** tab:\n   - Select the layer to segment (e.g. DAPI for nuclei).\n   - Choose **StarDist** (recommended for round nuclei).\n   - Pick a **Z handling** mode — **2D projection (MIP)** is recommended for\n     counting (every nucleus counted once).\n   - Optional: draw a rectangle with the Shapes tool, then tick **ROI**.\n   - Click **▶ Run segmentation**.\n\n### 2. Colocalization filtering\n\nExample: *keep only the green nuclei that do NOT colocalize with the red channel.*\n\n1. **② Colocalization** tab → **Add a rule**.\n2. Select the red channel, mode **EXCLUDE**, threshold = 500, overlap = 0.3.\n3. Click **✔ Apply filtering**.\n\nA new `Filtered_labels` layer appears in napari.\n\n### 3. Classification (e.g. healthy vs apoptotic nuclei)\n\n1. **③ Classification** tab: pick the **labels layer** and a **reference channel**.\n2. Set the **number of classes** and **name them** (e.g. \"Positive\", \"Negative\").\n3. **KMeans**: classes are formed automatically from intensity + morphology.\n   **RandomForest**: annotate a few labels by hand (label 3 → class 1, …), then classify.\n\nThe class names are reused as **column headers** in the Excel export.\n\n### 4. Export / counts\n\n1. **④ Export** tab, select the labels layer to export.\n2. Enter the voxel size (µm) matching your acquisition.\n3. Click **💾 Export as TIFF** (then in Imaris: File > Open > select the .tif).\n4. Click **📊 Export counts (Excel)** to save object counts (total + per class).\n\nTo convert to Surfaces in Imaris:\n`Edit > Surfaces > Add New Surfaces > Detect from Channel`.\n\n### 5. Batch processing\n\n1. **⑤ Batch** tab → **Browse…** to pick a folder of `.czi` files.\n2. Channel names are read from the first file → choose the **nuclei** and\n   **marker** channels by name.\n3. Set the segmentation parameters and (optionally) KMeans classification.\n4. Click **▶ Run batch → Excel** to produce a summary table (one row per image).\n   Tick *Show each image + segmentation in napari* to verify results visually.\n\n## File architecture\n\n```\nsrc/napari_segmencolo/\n├── __init__.py          # Package entry point (OpenMP workaround, exposes the widget)\n├── napari.yaml          # napari manifest (declares the widget)\n├── _widget.py           # Main GUI (the 5 tabs) and orchestration\n├── segmentation.py      # StarDist, Cellpose, Ilastik-style + Z-plane merging\n├── colocalization.py    # Multichannel colocalization filtering\n├── classification.py    # Feature extraction + KMeans / RandomForest\n├── stats.py             # Object counting + Excel export\n├── czi_io.py            # Direct CZI reading (channel names + MIP)\n└── export_imaris.py     # TIFF export\n\ntests/\n└── test_colocalization.py\n```\n\n## Main dependencies\n\n- `napari`, `qtpy` — viewer and GUI\n- `stardist`, `cellpose` — deep-learning segmentation\n- `scikit-image`, `scikit-learn` — image processing and classification\n- `pandas`, `numpy` — data and arrays\n- `tifffile` — TIFF export\n- `openpyxl` — Excel export\n- `pylibCZIrw` — CZI reading (batch mode)\n\nThe Ilastik-style mode is implemented in-house (scikit-image + scikit-learn);\nit does **not** require an Ilastik installation. It is inspired by\n[ilastik](https://www.ilastik.org) (Berg et al., 2019, GPL-2.0), but contains\n**no ilastik code** and does not depend on it — so ilastik's GPL license does not\napply, and this plugin stays BSD-3.\n\n## Author\n\n**Lena PROUX** — Internship at the Imaging Core, UCD Conway Institute (Dublin),\nsupervised by Dr Scholz.\nPlugin developed during the internship, with the help of AI, for image\nsegmentation and analysis.\n\n## Credits and citations\n\nThis plugin builds on several open-source libraries. It **does not redistribute\ntheir source code** — they are used as standard Python dependencies, installed\nvia `pip`, which every license below permits.\n\n### How to cite this plugin\n\nIf you use **SegmenColo** (`napari-segmencolo`) in your work, please cite it and\nacknowledge the imaging facility, for example:\n\n> Proux, L. (2026). *SegmenColo (napari-segmencolo): a napari plugin for AI-based\n> image segmentation, colocalization and classification.* UCD Conway Institute\n> Imaging Core, University College Dublin.\n> https://doi.org/10.5281/zenodo.21670153\n\n**DOI:** [10.5281/zenodo.21670153](https://doi.org/10.5281/zenodo.21670153)\n\nGitHub also shows a **\"Cite this repository\"** button, generated automatically\nfrom the `CITATION.cff` file at the root of the repository.\n\n### Software used\n\n| Library | Role in the plugin | License |\n|---|---|---|\n| [napari](https://napari.org) | Image viewer & plugin framework | BSD-3-Clause |\n| [StarDist](https://github.com/stardist/stardist) | Nucleus segmentation | BSD-3-Clause |\n| [Cellpose](https://cellpose.readthedocs.io) | Cell / nucleus segmentation | BSD-3-Clause |\n| [scikit-image](https://scikit-image.org) | Image processing & object features | BSD-3-Clause |\n| [scikit-learn](https://scikit-learn.org) | KMeans, RandomForest | BSD-3-Clause |\n| [pandas](https://pandas.pydata.org) / [NumPy](https://numpy.org) | Tables & arrays | BSD-3-Clause |\n| [tifffile](https://github.com/cgohlke/tifffile) | TIFF export | BSD-3-Clause |\n| [openpyxl](https://openpyxl.readthedocs.io) | Excel export | MIT |\n| [qtpy](https://github.com/spyder-ide/qtpy) | Qt binding abstraction | MIT |\n| [pylibCZIrw](https://github.com/ZEISS/pylibczirw) | CZI file reading (batch) | **LGPL-3.0** |\n\n> **Note on pylibCZIrw (LGPL-3.0):** it is used as an unmodified, separately\n> installed dependency (no source code is copied into this plugin). The LGPL\n> permits this use within a BSD-licensed project; users remain free to replace\n> or upgrade the library independently.\n\n### Please cite (for scientific use)\n\nIf you use the segmentation models in published work, please cite the original\npapers — this is requested by their authors and is independent of the software\nlicense:\n\n- **StarDist** — Schmidt, U., Weigert, M., Broaddus, C., & Myers, G. (2018).\n  *Cell Detection with Star-Convex Polygons.* MICCAI 2018.\n  https://doi.org/10.1007/978-3-030-00934-2_30\n- **Cellpose** — Stringer, C., Wang, T., Michaelos, M., & Pachitariu, M. (2021).\n  *Cellpose: a generalist algorithm for cellular segmentation.* Nature Methods, 18, 100–106.\n  https://doi.org/10.1038/s41592-020-01018-x\n- **napari** — napari contributors (2019). *napari: a multi-dimensional image viewer for Python.*\n  https://doi.org/10.5281/zenodo.3555620\n- **ilastik** (inspiration for the Ilastik-style mode) — Berg, S., Kutra, D.,\n  Kroeger, T., et al. (2019). *ilastik: interactive machine learning for\n  (bio)image analysis.* Nature Methods, 16, 1226–1232.\n  https://doi.org/10.1038/s41592-019-0582-9\n\n### Pretrained models\n\nThe StarDist and Cellpose **pretrained models** (`2D_versatile_fluo`, `cyto3`, …)\nmay carry their own usage terms. They are suitable for academic research; verify\ntheir conditions before any commercial use.\n\n## Contributing\n\nContributions are very welcome. Tests can be run with [tox]; please ensure the\ncoverage at least stays the same before you submit a pull request.\n\n## License\n\nDistributed under the terms of the [BSD-3] license,\n\"napari-segmencolo\" is free and open source software.\n\n## Issues\n\nIf you encounter any problems, please [file an issue] along with a detailed description.\n\n[napari]: https://github.com/napari/napari\n[copier]: https://copier.readthedocs.io/en/stable/\n[MIT]: http://opensource.org/licenses/MIT\n[BSD-3]: http://opensource.org/licenses/BSD-3-Clause\n[GNU GPL v3.0]: http://www.gnu.org/licenses/gpl-3.0.txt\n[GNU LGPL v3.0]: http://www.gnu.org/licenses/lgpl-3.0.txt\n[Apache Software License 2.0]: http://www.apache.org/licenses/LICENSE-2.0\n[Mozilla Public License 2.0]: https://www.mozilla.org/media/MPL/2.0/index.txt\n[napari-plugin-template]: https://github.com/napari/napari-plugin-template\n[file an issue]: https://github.com/lenaproux-cyber/napari-segmencolo/issues\n[tox]: https://tox.readthedocs.io/en/latest/\n[pip]: https://pypi.org/project/pip/\n[PyPI]: https://pypi.org/\n","description_content_type":"text/markdown","keywords":null,"home_page":null,"download_url":null,"author":null,"author_email":"Lena PROUX <lena.proux@gmail.com>","maintainer":null,"maintainer_email":null,"license":null,"classifier":["Development Status :: 2 - Pre-Alpha","Framework :: napari","Intended Audience :: Developers","Operating System :: OS Independent","Programming Language :: Python","Programming Language :: Python :: 3","Programming Language :: Python :: 3 :: Only","Programming Language :: Python :: 3.10","Programming Language :: Python :: 3.11","Programming Language :: Python :: 3.12","Programming Language :: Python :: 3.13","Programming Language :: Python :: 3.14","Topic :: Scientific/Engineering :: Image Processing"],"requires_dist":["numpy","magicgui","qtpy","scikit-image","napari","stardist","cellpose","scikit-learn","pandas","tifffile","openpyxl","pylibCZIrw","napari[all]; extra == \"all\""],"requires_python":">=3.10","requires_external":null,"project_url":null,"provides_extra":["all"],"provides_dist":null,"obsoletes_dist":null},"npe1_shim":false}