{"name":"napari-serialcellpose","display_name":"serialcellpose","visibility":"public","icon":"","categories":[],"schema_version":"0.2.1","on_activate":null,"on_deactivate":null,"contributions":{"commands":[{"id":"napari-serialcellpose.make_qwidget","title":"Make example QWidget","python_name":"napari_serialcellpose.serial_widget:SerialWidget","short_title":null,"category":null,"icon":null,"enablement":null}],"readers":null,"writers":null,"widgets":[{"command":"napari-serialcellpose.make_qwidget","display_name":"Serial Widget","autogenerate":false}],"sample_data":null,"themes":null,"menus":{},"submenus":null,"keybindings":null,"configuration":[]},"package_metadata":{"metadata_version":"2.4","name":"napari-serialcellpose","version":"0.5.1","dynamic":["license-file"],"platform":null,"supported_platform":null,"summary":"A simple plugin to batch segment cells with cellpose","description":"# napari-serialcellpose\n\n[![License](https://img.shields.io/pypi/l/napari-serialcellpose.svg?color=green)](https://github.com/guiwitz/napari-serialcellpose/raw/main/LICENSE)\n[![PyPI](https://img.shields.io/pypi/v/napari-serialcellpose.svg?color=green)](https://pypi.org/project/napari-serialcellpose)\n[![Python Version](https://img.shields.io/pypi/pyversions/napari-serialcellpose.svg?color=green)](https://python.org)\n[![tests](https://github.com/guiwitz/napari-serialcellpose/workflows/tests/badge.svg)](https://github.com/guiwitz/napari-serialcellpose/actions)\n[![codecov](https://codecov.io/gh/guiwitz/napari-serialcellpose/branch/main/graph/badge.svg)](https://codecov.io/gh/guiwitz/napari-serialcellpose)\n[![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/napari-serialcellpose)](https://napari-hub.org/plugins/napari-serialcellpose)\n\nThis napari plugin allows you to segment single images or series of images using built-in or custom Cellpose models as well as to analyze the properties of these segmented regions (\"region properties\"). Properties can be visualized for a single image or a complete experiment in the form of histograms that can also be filtered (e.g. based on area size, mean intensity etc.) Thanks to the [napari-skimage-regionprops](https://github.com/haesleinhuepf/napari-skimage-regionprops) plugin, properties of segmented objects can be interactively explored at a single object level.\n\n## Main goal\n\nThe main goal of this plugin is to simplify the classical image processing pipeline of image segmentation followed by region analysis via Cellpose. It allows to quickly get a quantification of a set of images without the need for any scripting.\n\n## Installation\n\nIn order to use this plugin, whe highly recommend to create a specific environment and to install the required software in it. You can create a conda environment using:\n\n    conda create -n serialcellpose python=3.12 napari pyqt -c conda-forge\n\nThen activate it and install the plugin:\n    \n    conda activate serialcellpose\n    pip install napari-serialcellpose\n\nAlternatively, you can install the plugin via the napari plugin manager.\n\n## Note on versions\n\nVersions older than 0.3.0 depend on the aicsimageio importer which is not supported anymore and which will likely lead to errors when trying to run the plugin. Version 0.3.0 moved to the [bioio](https://github.com/bioio-devs/bioio) importer and some improvements were made to the data handling but the core functionality is the same. **Version 0.3.0 is the last version that only supports pre-SAM Cellpose models i.e. Cellpose=4.0**. By default you will get the latest version of the plugin. If you want an earlier version, you can pick versions in the napari plugin manger or directly via pip e.g.:\n\n    pip install napari-serialcellpose==0.3.0 \n\nFor some time, the plugin will support both older Cellpose versions (CP<4.0) and newer versions (CP>=4.0). By default Cellpose4 gets installed with the plugin but you can revert to Cellpose3 if needed:\n\n    pip install cellpose<4\n\nThis might be of interest if you trained specific models or have workflows relying on Cellpose3 models such as cyto2.\n\n### PyTorch and GPU\n\nRecent versions of PyTorch should detect whether a GPU is available or not and install the appropriate version. This includes acceleration on M-series macs via mps. One Linux and Windows, you can force GPU installation in case the above does not work (see below).\n\n### GPU\n\nIn order to use a GPU:\n\n1. Uninstall the PyTorch version that gets installed by default with Cellpose:\n\n        pip uninstall torch\n\n2. Make sure your have up-to-date drivers for your NVIDIA card installed.\n\n3. Re-install a GPU version of PyTorch via conda using:\n\n        conda install pytorch-gpu torchvision -c conda-forge\n\n### Plugin Updates\n\nTo update the plugin, you only need to activate the existing environment and install the new version:\n\n    conda activate serialcellpose\n    pip install napari-serialcellpose -U\n\n## Usage: segmentation\n\nThe main interface is shown below. The sequence of events should be the following:\n\n1. Select a folder containing images. The list of files within that folder will appear in the area above. You can also just drag and drop a folder or an image in that area. When selecting an image, it gets displayed in the viewer. Images are opened via [bioio](https://github.com/bioio-devs/bioio) but not all bioio plugins come pre-installed (only bioio-tifffile and bioio-imageio) so check the [plugin list](https://github.com/bioio-devs/bioio?tab=readme-ov-file#plug-in-registry) to open other file formats. You can use grayscale images, RGB images or multi-channel images. In the latter case, **make sure each channel opens as a separate layer when you open them**.\n2. If you want to save the segmentation and tables with properties, select a folder that will contain the output.\n3. Select the type of cellpose model.\n4. If you use a custom model, select its location.\n5. Run the analysis on the currently selected image or on all files in the folder.\n\n### Options\n\n6. Select if you want to use a GPU or not.\n7. If you are using multi-channel images, you can specify which channel to segment and optionally which to use as \"nuclei\" channel to help cell segmentation.\n8. In case you are using one of the built-in models, you can set the estimated diameter of your objects.\n9. In the Options tab you will find a few more options for segmentation, including the two thresholds ```flow_threshold``` and ```cellprob_threshold```. You can also decide to discard objects touching the border. Using the ```Select options yml file``` you can select a ```.yml``` file which contains a list of additional options to pass to the ```eval``` method of the Cellpose model. **Note that options specified in the yml file will override options set in the GUI**. The file [my_options.yml](https://raw.githubusercontent.com/guiwitz/napari-serialcellpose/main/src/napari_serialcellpose/_tests/my_options.yml) is an example of such a file where for example the ```diameter``` (also available in the GUI) and ```resample``` (not available in the GUI) options are set. \n\n<img src=\"https://github.com/guiwitz/napari-serialcellpose/raw/main/illustrations/napari_serialcellpose_gui1.png\" alt=\"image\" width=\"500\">\n<img src=\"https://github.com/guiwitz/napari-serialcellpose/raw/main/illustrations/napari_serialcellpose_gui1b.png\" alt=\"image\" width=\"500\">\n\n### Properties\n\n10. After segmentation, properties of the objects can automatically be computed. You can select which properties should be computed in the Options tab. Properties are those from the `regionprops_table` function of scikit-image. If you want to measure intensity properties such as mean intensity, you have to specify which channel (```Analysis channel```) you want to perform the measurement on.\n\n### Output\n\nThe results of the analysis are saved in the folder chosen in #2. The segmentation mask is saved with the same name as the original image with the suffix ```_mask.tif```. A table with properties is saved in the subfolder ```tables``` also with the same name as the image with the suffix ```props.csv```. If you run the plugin on multiple files in a folder, a ```summary.csv``` file is also generated which compiles all the data.\n\n## Usage: post-processing\n\nAfter the analysis is done, when you select an image, the corresponding segmentation mask is shown on top of the image as shown below. This also works for saved segmentations: in that case you just select a folder with data and the corresponding output folder.\n\n<img src=\"https://github.com/guiwitz/napari-serialcellpose/raw/main/illustrations/napari_serialcellpose_gui2.png\" alt=\"image\" width=\"500\">\n\n### Properties\n\nIf you head to the **Properties** tab, you will find there two histograms showing the distribution of two properties that you can choose from a list at the top of the window. Below the plot you find the table containing information for each cell (each line is a cell).\n\nAs shown below, if you select the box ```show selected```, you can select items in the properties table and it will highlight the corresponding cell in the viewer. If you select the pipet tool, you can also select a cell and see the corresponding line in the table highlighted.\n\n<img src=\"https://github.com/guiwitz/napari-serialcellpose/raw/main/illustrations/napari_serialcellpose_gui3.png\" alt=\"image\" width=\"500\">\n\n### Summary\n\nFinally if you select the **Summary** tab, and click on ```Load summary```, it will load all data of the current output folder and create histograms of two properties that can be selected. An additional property can be used for filtering the data. Using the sliders, one can set a minimum and maximum threshold on the \"filtering property\", which will create a sub-selection of the data.\n\n<img src=\"https://github.com/guiwitz/napari-serialcellpose/raw/main/illustrations/napari_serialcellpose_gui4.png\" alt=\"image\" width=\"500\">\n\n## Data\n\nSample data were acquired by Fabian Blank at the DBMR, University of Bern.\n\n## License\n\nDistributed under the terms of the [BSD-3] license,\n\"napari-serialcellpose\" 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[Cookiecutter]: https://github.com/audreyr/cookiecutter\n[@napari]: https://github.com/napari\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[cookiecutter-napari-plugin]: https://github.com/napari/cookiecutter-napari-plugin\n\n[file an issue]: https://github.com/guiwitz/napari-serialcellpose/issues\n\n[napari]: https://github.com/napari/napari\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":"https://github.com/guiwitz/napari-serialcellpose","download_url":null,"author":"Guillaume Witz","author_email":"guillaume.witz@unibe.ch","maintainer":null,"maintainer_email":null,"license":"BSD-3-Clause","classifier":["Development Status :: 2 - Pre-Alpha","Intended Audience :: Developers","Framework :: napari","Topic :: Software Development :: Testing","Programming Language :: Python","Programming Language :: Python :: 3","Programming Language :: Python :: 3.10","Programming Language :: Python :: 3.11","Programming Language :: Python :: 3.12","Operating System :: OS Independent","License :: OSI Approved :: BSD License"],"requires_dist":["cellpose","numpy","magicgui","qtpy","matplotlib","bioio","bioio-tifffile","tox; extra == \"testing\"","pytest; extra == \"testing\"","pytest-cov; extra == \"testing\"","pytest-qt; extra == \"testing\"","napari; extra == \"testing\"","pyqt5; extra == \"testing\"","cellpose<4; extra == \"testing\"","bioio-nd2; extra == \"testing\""],"requires_python":">=3.10","requires_external":null,"project_url":["Bug Tracker, https://github.com/guiwitz/napari-serialcellpose/issues","Documentation, https://github.com/guiwitz/napari-serialcellpose#README.md","Source Code, https://github.com/guiwitz/napari-serialcellpose","User Support, https://github.com/guiwitz/napari-serialcellpose/issues"],"provides_extra":["testing"],"provides_dist":null,"obsoletes_dist":null},"npe1_shim":false}