{"id":13708759,"url":"https://github.com/stardist/stardist","last_synced_at":"2025-10-21T20:56:00.464Z","repository":{"id":38400498,"uuid":"138786192","full_name":"stardist/stardist","owner":"stardist","description":"StarDist - Object Detection with Star-convex Shapes","archived":false,"fork":false,"pushed_at":"2025-05-30T00:24:04.000Z","size":119719,"stargazers_count":1116,"open_issues_count":71,"forks_count":251,"subscribers_count":28,"default_branch":"main","last_synced_at":"2025-10-21T20:55:41.516Z","etag":null,"topics":["bioimage-analysis","cell-segmentation","deep-learning","nuclei-segmentation","object-detection","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stardist.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-26T19:54:45.000Z","updated_at":"2025-10-20T12:16:28.000Z","dependencies_parsed_at":"2023-02-04T06:17:27.847Z","dependency_job_id":"514e389d-f01b-4651-88b1-67ff7b411e75","html_url":"https://github.com/stardist/stardist","commit_stats":{"total_commits":732,"total_committers":20,"mean_commits":36.6,"dds":0.7540983606557377,"last_synced_commit":"c0564459e344b62d5b50db83546de6b478db890c"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/stardist/stardist","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stardist%2Fstardist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stardist%2Fstardist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stardist%2Fstardist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stardist%2Fstardist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stardist","download_url":"https://codeload.github.com/stardist/stardist/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stardist%2Fstardist/sbom","scorecard":{"id":846285,"data":{"date":"2025-08-11","repo":{"name":"github.com/stardist/stardist","commit":"650d3a19bf7380ec0476d672397ff0388687a9d3"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.9,"checks":[{"name":"Maintained","score":1,"reason":"2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/9 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/cibuildwheel.yml:1","Warn: no topLevel permission defined: .github/workflows/tests.yml:1","Warn: no topLevel permission defined: .github/workflows/tests_cron.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 23 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cibuildwheel.yml:88: update your workflow using https://app.stepsecurity.io/secureworkflow/stardist/stardist/cibuildwheel.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cibuildwheel.yml:91: update your workflow using https://app.stepsecurity.io/secureworkflow/stardist/stardist/cibuildwheel.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cibuildwheel.yml:139: update your workflow using https://app.stepsecurity.io/secureworkflow/stardist/stardist/cibuildwheel.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cibuildwheel.yml:159: update your workflow using https://app.stepsecurity.io/secureworkflow/stardist/stardist/cibuildwheel.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cibuildwheel.yml:165: update your workflow using https://app.stepsecurity.io/secureworkflow/stardist/stardist/cibuildwheel.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cibuildwheel.yml:179: update your workflow using https://app.stepsecurity.io/secureworkflow/stardist/stardist/cibuildwheel.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cibuildwheel.yml:190: update your workflow using https://app.stepsecurity.io/secureworkflow/stardist/stardist/cibuildwheel.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cibuildwheel.yml:196: update your workflow using https://app.stepsecurity.io/secureworkflow/stardist/stardist/cibuildwheel.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cibuildwheel.yml:209: update your workflow using https://app.stepsecurity.io/secureworkflow/stardist/stardist/cibuildwheel.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/cibuildwheel.yml:221: update your workflow using https://app.stepsecurity.io/secureworkflow/stardist/stardist/cibuildwheel.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cibuildwheel.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/stardist/stardist/cibuildwheel.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cibuildwheel.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/stardist/stardist/cibuildwheel.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/cibuildwheel.yml:57: update your workflow using https://app.stepsecurity.io/secureworkflow/stardist/stardist/cibuildwheel.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:61: update your workflow using https://app.stepsecurity.io/secureworkflow/stardist/stardist/tests.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests.yml:72: update your workflow using https://app.stepsecurity.io/secureworkflow/stardist/stardist/tests.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests_cron.yml:83: update your workflow using https://app.stepsecurity.io/secureworkflow/stardist/stardist/tests_cron.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests_cron.yml:94: update your workflow using https://app.stepsecurity.io/secureworkflow/stardist/stardist/tests_cron.yml/main?enable=pin","Warn: containerImage not pinned by hash: docker/Dockerfile:1: pin your Docker image by updating tensorflow/tensorflow:2.11.0-gpu-jupyter to tensorflow/tensorflow:2.11.0-gpu-jupyter@sha256:fc519621eb9a54591721e9019f1606688c9abb329b16b00cc7107c23f14a6f24","Warn: pipCommand not pinned by hash: docker/Dockerfile:16","Warn: pipCommand not pinned by hash: docker/Dockerfile:17","Warn: pipCommand not pinned by hash: .github/workflows/cibuildwheel.yml:42","Warn: pipCommand not pinned by hash: .github/workflows/cibuildwheel.yml:97","Warn: pipCommand not pinned by hash: .github/workflows/cibuildwheel.yml:171","Warn: pipCommand not pinned by hash: .github/workflows/cibuildwheel.yml:174","Warn: pipCommand not pinned by hash: .github/workflows/cibuildwheel.yml:177","Warn: pipCommand not pinned by hash: .github/workflows/tests.yml:67","Warn: pipCommand not pinned by hash: .github/workflows/tests.yml:70","Warn: pipCommand not pinned by hash: .github/workflows/tests.yml:87","Warn: pipCommand not pinned by hash: .github/workflows/tests.yml:90","Warn: pipCommand not pinned by hash: .github/workflows/tests_cron.yml:89","Warn: pipCommand not pinned by hash: .github/workflows/tests_cron.yml:92","Warn: pipCommand not pinned by hash: .github/workflows/tests_cron.yml:99","Warn: pipCommand not pinned by hash: .github/workflows/tests_cron.yml:103","Warn: pipCommand not pinned by hash: .github/workflows/tests_cron.yml:107","Warn: pipCommand not pinned by hash: .github/workflows/tests_cron.yml:120","Info:   0 out of  16 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   1 containerImage dependencies pinned","Info:   0 out of  17 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}}]},"last_synced_at":"2025-08-23T21:31:22.422Z","repository_id":38400498,"created_at":"2025-08-23T21:31:22.422Z","updated_at":"2025-08-23T21:31:22.422Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280333500,"owners_count":26312845,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bioimage-analysis","cell-segmentation","deep-learning","nuclei-segmentation","object-detection","python"],"created_at":"2024-08-02T23:00:32.131Z","updated_at":"2025-10-21T20:56:00.458Z","avatar_url":"https://github.com/stardist.png","language":"Python","funding_links":[],"categories":["Software","Image processing and segmentation","🔬 Domain-Specific Applications","Domain-Specific Resources","✂️ Image segmentation"],"sub_categories":["Model","🧬 Biology \u0026 Medicine","Medical \u0026 Biological Imaging","Software tools"],"readme":"[![PyPI version](https://badge.fury.io/py/stardist.svg)](https://pypi.org/project/stardist)\n[![Anaconda-Server Badge](https://anaconda.org/conda-forge/stardist/badges/version.svg)](https://anaconda.org/conda-forge/stardist)\n[![Test](https://github.com/stardist/stardist/workflows/Test/badge.svg)](https://github.com/stardist/stardist/actions?query=workflow%3ATest)\n[![Test (PyPI)](https://github.com/stardist/stardist/workflows/Test%20(PyPI)/badge.svg)](https://github.com/stardist/stardist/actions?query=workflow%3A%22Test+%28PyPI%29%22)\n[![Image.sc forum](https://img.shields.io/badge/dynamic/json.svg?label=forum\u0026url=https%3A%2F%2Fforum.image.sc%2Ftags%2Fstardist.json\u0026query=%24.topic_list.tags.0.topic_count\u0026colorB=brightgreen\u0026suffix=%20topics\u0026logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAABPklEQVR42m3SyyqFURTA8Y2BER0TDyExZ+aSPIKUlPIITFzKeQWXwhBlQrmFgUzMMFLKZeguBu5y+//17dP3nc5vuPdee6299gohUYYaDGOyyACq4JmQVoFujOMR77hNfOAGM+hBOQqB9TjHD36xhAa04RCuuXeKOvwHVWIKL9jCK2bRiV284QgL8MwEjAneeo9VNOEaBhzALGtoRy02cIcWhE34jj5YxgW+E5Z4iTPkMYpPLCNY3hdOYEfNbKYdmNngZ1jyEzw7h7AIb3fRTQ95OAZ6yQpGYHMMtOTgouktYwxuXsHgWLLl+4x++Kx1FJrjLTagA77bTPvYgw1rRqY56e+w7GNYsqX6JfPwi7aR+Y5SA+BXtKIRfkfJAYgj14tpOF6+I46c4/cAM3UhM3JxyKsxiOIhH0IO6SH/A1Kb1WBeUjbkAAAAAElFTkSuQmCC)](https://forum.image.sc/tags/stardist)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/stardist)](https://pypistats.org/packages/stardist)\n\n# *StarDist* - Object Detection with Star-convex Shapes\n\n![](https://github.com/stardist/stardist/raw/main/images/stardist_overview.png)\n\nThis repository contains the Python implementation of star-convex object detection for 2D and 3D images, as described in the papers:\n\n\u003cimg src=\"https://github.com/stardist/stardist/raw/main/images/stardist_logo.jpg\" title=\"siân is the king of the universe\" width=\"25%\" align=\"right\"\u003e\n\n- Uwe Schmidt, Martin Weigert, Coleman Broaddus, and Gene Myers.  \n[*Cell Detection with Star-convex Polygons*](https://arxiv.org/abs/1806.03535).  \nInternational Conference on Medical Image Computing and Computer-Assisted Intervention (MICCAI), Granada, Spain, September 2018.\n\n- Martin Weigert, Uwe Schmidt, Robert Haase, Ko Sugawara, and Gene Myers.  \n[*Star-convex Polyhedra for 3D Object Detection and Segmentation in Microscopy*](http://openaccess.thecvf.com/content_WACV_2020/papers/Weigert_Star-convex_Polyhedra_for_3D_Object_Detection_and_Segmentation_in_Microscopy_WACV_2020_paper.pdf).  \nThe IEEE Winter Conference on Applications of Computer Vision (WACV), Snowmass Village, Colorado, March 2020.\n\n- Martin Weigert and Uwe Schmidt.  \n[*Nuclei Instance Segmentation and Classification in Histopathology Images with Stardist*](https://arxiv.org/abs/2203.02284).  \nThe IEEE International Symposium on Biomedical Imaging Challenges (ISBIC), Kolkata, India, March 2022.\n\nPlease [cite the paper(s)](#how-to-cite) if you are using this code in your research.\n\n\n## Overview\n\nThe following figure illustrates the general approach for 2D images. The training data consists of corresponding pairs of input (i.e. raw) images and fully annotated label images (i.e. every pixel is labeled with a unique object id or 0 for background).\nA model is trained to densely predict the distances (r) to the object boundary along a fixed set of rays and object probabilities (d), which together produce an overcomplete set of candidate polygons for a given input image. The final result is obtained via non-maximum suppression (NMS) of these candidates.\n\n![](https://github.com/stardist/stardist/raw/main/images/overview_2d.png)\n\nThe approach for 3D volumes is similar to the one described for 2D, using pairs of input and fully annotated label volumes as training data.\n\n![](https://github.com/stardist/stardist/raw/main/images/overview_3d.png)\n\n## Webinar/Tutorial\n\nIf you want to know more about the concepts and practical applications of StarDist, please have a look at the following webinar that was given at NEUBIAS Academy @Home 2020:\n\n[![webinar video](http://img.youtube.com/vi/Amn_eHRGX5M/0.jpg)](http://www.youtube.com/watch?v=Amn_eHRGX5M \"Webinar\")\n\n\n## Installation\n\nThis package is compatible with Python 3.6 - 3.12.\n\nIf you only want to use a StarDist plugin for a GUI-based software, please read [this](#plugins-for-other-software).\n\n1. Please first [install TensorFlow](https://www.tensorflow.org/install)\n(either TensorFlow 1 or 2) by following the official instructions.\nFor [GPU support](https://www.tensorflow.org/install/gpu), it is very\nimportant to install the specific versions of CUDA and cuDNN that are\ncompatible with the respective version of TensorFlow. (If you need help and can use `conda`, take a look at [this](https://github.com/CSBDeep/CSBDeep/tree/main/extras#conda-environment).)\n\n2. *StarDist* can then be installed with `pip`:\n\n    - If you installed TensorFlow 2 (version *2.x.x*):\n\n          pip install stardist\n\n    - If you installed TensorFlow 1 (version *1.x.x*):\n\n          pip install \"stardist[tf1]\"\n\n\n#### Notes\n\n- Depending on your Python installation, you may need to use `pip3` instead of `pip`.\n- You can find out which version of TensorFlow is installed via `pip show tensorflow`.\n- We provide pre-compiled binaries (\"wheels\") that should work for most Linux, Windows, and macOS platforms. If you're having problems, please see the [troubleshooting](#installation-1) section below.\n- *(Optional)* You need to install [gputools](https://github.com/maweigert/gputools) if you want to use OpenCL-based computations on the GPU to speed up training.\n- *(Optional)* You might experience improved performance during training if you additionally install the [Multi-Label Anisotropic 3D Euclidean Distance Transform (MLAEDT-3D)](https://github.com/seung-lab/euclidean-distance-transform-3d).\n\n\n## Usage\n\nWe provide example workflows for 2D and 3D via Jupyter [notebooks](https://github.com/stardist/stardist/tree/main/examples) that illustrate how this package can be used.\n\n![](https://github.com/stardist/stardist/raw/main/images/example_steps.png)\n\n### Pretrained Models for 2D\n\nCurrently we provide some pretrained models in 2D that might already be suitable for your images:\n\n\n| key | Modality (Staining) | Image format | Example Image    | Description  |\n| :-- | :-: | :-:| :-:| :-- |\n| `2D_versatile_fluo` `2D_paper_dsb2018`| Fluorescence (nuclear marker) | 2D single channel| \u003cimg src=\"https://github.com/stardist/stardist/raw/main/images/example_fluo.jpg\" title=\"example image fluo\" width=\"120px\" align=\"center\"\u003e       | *Versatile (fluorescent nuclei)* and *DSB 2018 (from StarDist 2D paper)* that were both trained on a [subset of the DSB 2018 nuclei segmentation challenge dataset](https://github.com/stardist/stardist/releases/download/0.1.0/dsb2018.zip). |\n|`2D_versatile_he` | Brightfield (H\u0026E) | 2D RGB  | \u003cimg src=\"https://github.com/stardist/stardist/raw/main/images/example_histo.jpg\" title=\"example image histo\" width=\"120px\" align=\"center\"\u003e       | *Versatile (H\u0026E nuclei)* that was trained on images from the [MoNuSeg 2018 training data](https://monuseg.grand-challenge.org/Data/) and the [TNBC dataset from Naylor et al. (2018)](https://zenodo.org/record/1175282#.X6mwG9so-CN). |\n\n\nYou can access these pretrained models from `stardist.models.StarDist2D`\n\n```python\nfrom stardist.models import StarDist2D\n\n# prints a list of available models\nStarDist2D.from_pretrained()\n\n# creates a pretrained model\nmodel = StarDist2D.from_pretrained('2D_versatile_fluo')\n```\n\nAnd then try it out with a test image:\n\n```python\nfrom stardist.data import test_image_nuclei_2d\nfrom stardist.plot import render_label\nfrom csbdeep.utils import normalize\nimport matplotlib.pyplot as plt\n\nimg = test_image_nuclei_2d()\n\nlabels, _ = model.predict_instances(normalize(img))\n\nplt.subplot(1,2,1)\nplt.imshow(img, cmap=\"gray\")\nplt.axis(\"off\")\nplt.title(\"input image\")\n\nplt.subplot(1,2,2)\nplt.imshow(render_label(labels, img=img))\nplt.axis(\"off\")\nplt.title(\"prediction + input overlay\")\n```\n\n![](images/pretrained_example.png)\n\n\n### Annotating Images\n\nTo train a *StarDist* model you will need some ground-truth annotations: for every raw training image there has to be a corresponding label image where all pixels of a cell region are labeled with a distinct integer (and background pixels are labeled with 0).\nTo create such annotations in 2D, there are several options, among them being [Fiji](http://fiji.sc/), [Labkit](https://imagej.net/Labkit), or [QuPath](https://qupath.github.io). In 3D, there are fewer options: [Labkit](https://github.com/maarzt/imglib2-labkit) and [Paintera](https://github.com/saalfeldlab/paintera) (the latter being very sophisticated but having a steeper learning curve).\n\nAlthough each of these provide decent annotation tools, we currently recommend using Labkit (for 2D or 3D images) or QuPath (for 2D):\n\n#### Annotating with LabKit (2D or 3D)\n\n1. Install [Fiji](https://fiji.sc) and the [Labkit](https://imagej.net/Labkit) plugin\n2. Open the (2D or 3D) image and start Labkit via `Plugins \u003e Labkit \u003e Open Current Image With Labkit`\n3. Successively add a new label and annotate a single cell instance with the brush tool until *all* cells are labeled.  \n   (Always disable `allow overlapping labels` or – in older versions of LabKit – enable the `override` option.) \n4. Export the label image via `Labeling \u003e Save Labeling ...` with `Files of Type \u003e TIF Image` making sure that the file name ends with `.tif` or `.tiff`.\n\n![](https://github.com/stardist/stardist/raw/main/images/labkit_2d_labkit.png)\n\n\nAdditional tips:\n\n* The Labkit viewer uses [BigDataViewer](https://imagej.net/BigDataViewer) and its keybindings (e.g. \u003ckbd\u003es\u003c/kbd\u003e for contrast options, \u003ckbd\u003eCTRL\u003c/kbd\u003e+\u003ckbd\u003eShift\u003c/kbd\u003e+\u003ckbd\u003emouse-wheel\u003c/kbd\u003e for zoom-in/out etc.)\n* For 3D images (XYZ) it is best to first convert it to a (XYT) timeseries (via `Re-Order Hyperstack` and swapping `z` and `t`) and then use \u003ckbd\u003e[\u003c/kbd\u003e and \u003ckbd\u003e]\u003c/kbd\u003e in Labkit to walk through the slices.\n\n#### Annotating with QuPath (2D)\n\n1. Install [QuPath](https://qupath.github.io/)\n2. Create a new project (`File -\u003e Project...-\u003e Create project`) and add your raw images\n3. Annotate nuclei/objects\n4. Run [this script](https://raw.githubusercontent.com/stardist/stardist/main/extras/qupath_export_annotations.groovy) to export the annotations (save the script and drag it on QuPath. Then execute it with `Run for project`). The script will create a `ground_truth` folder within your QuPath project that includes both the `images` and `masks` subfolder that then can directly be used with *StarDist*.\n\nTo see how this could be done, have a look at the following [example QuPath project](https://raw.githubusercontent.com/stardist/stardist/main/extras/qupath_example_project.zip) (data courtesy of Romain Guiet, EPFL).\n\n![](https://github.com/stardist/stardist/raw/main/images/qupath.png)\n\n\n### Multi-class Prediction\n\nStarDist also supports multi-class prediction, i.e. each found object instance can additionally be classified into a fixed number of discrete object classes (e.g. cell types):\n\n![](https://github.com/stardist/stardist/raw/main/images/stardist_multiclass.png)\n\nPlease see the [multi-class example notebook](https://nbviewer.jupyter.org/github/stardist/stardist/blob/main/examples/other2D/multiclass.ipynb) if you're interested in this.\n\n## Instance segmentation metrics\n\nStarDist contains the `stardist.matching` submodule that provides functions to compute common instance segmentation metrics between ground-truth label masks and predictions (not necessarily from StarDist). Currently available metrics are\n\n* `tp`, `fp`, `fn`\n* `precision`, `recall`, `accuracy`, `f1`\n* `panoptic_quality`\n* `mean_true_score`, `mean_matched_score`\n\nwhich are computed by matching ground-truth/prediction objects if their IoU exceeds a threshold (by default 50%). See the documentation of `stardist.matching.matching` for a detailed explanation.\n\nHere is an example how to use it:\n\n```python\n\n# create some example ground-truth and dummy prediction data\nfrom stardist.data import test_image_nuclei_2d\nfrom scipy.ndimage import rotate\n_, y_true = test_image_nuclei_2d(return_mask=True)\ny_pred = rotate(y_true, 2, order=0, reshape=False)\n\n# compute metrics between ground-truth and prediction\nfrom stardist.matching import matching\n\nmetrics =  matching(y_true, y_pred)\n\nprint(metrics)\n```\n```\nMatching(criterion='iou', thresh=0.5, fp=88, tp=37, fn=88, precision=0.296, \n       recall=0.296, accuracy=0.1737, f1=0.296, n_true=125, n_pred=125, \n       mean_true_score=0.19490, mean_matched_score=0.65847, panoptic_quality=0.19490)\n```\n\nIf you want to compare a list of images you can use `stardist.matching.matching_dataset`:\n\n```python\n\nfrom stardist.matching import matching_dataset\n\nmetrics = matching_dataset([y_true, y_true], [y_pred, y_pred])\n\nprint(metrics)\n```\n```\nDatasetMatching(criterion='iou', thresh=0.5, fp=176, tp=74, fn=176, precision=0.296, \n    recall=0.296, accuracy=0.1737, f1=0.296, n_true=250, n_pred=250, \n    mean_true_score=0.19490, mean_matched_score=0.6584, panoptic_quality=0.1949, by_image=False)\n```\n\n\n\n## Troubleshooting \u0026 Support\n\n1. Please first take a look at the [frequently asked questions (FAQ)]( https://stardist.net/docs/faq.html).\n2. If you need further help, please go to the [image.sc forum](https://forum.image.sc) and try to find out if the issue you're having has already been discussed or solved by other people. If not, feel free to create a new topic there and make sure to use the tag `stardist` (we are monitoring all questions with this tag). When opening a new topic, please provide a clear and concise description to understand and ideally reproduce the issue you're having (e.g. including a code snippet, Python script, or Jupyter notebook).\n3. If you have a technical question related to the source code or believe to have found a bug, feel free to [open an issue](https://github.com/stardist/stardist/issues), but please check first if someone already created a similar issue.\n\n### Installation\n\nIf `pip install stardist` fails, it could be because there are no compatible wheels (`.whl`) for your platform ([see list](https://pypi.org/project/stardist/#files)). In this case, `pip` tries to compile a C++ extension that our Python package relies on (see below). While this often works on Linux out of the box, it will likely fail on Windows and macOS without installing a suitable compiler. (Note that you can enforce compilation by installing via `pip install stardist --no-binary :stardist:`.)\n\nInstallation without using wheels requires Python 3.6 (or newer) and a working C++ compiler. We have only tested [GCC](http://gcc.gnu.org) (macOS, Linux), [Clang](https://clang.llvm.org) (macOS), and [Visual Studio](https://visualstudio.microsoft.com) (Windows 10). Please [open an issue](https://github.com/stardist/stardist/issues) if you have problems that are not resolved by the information below.\n\nIf available, the C++ code will make use of [OpenMP](https://en.wikipedia.org/wiki/OpenMP) to exploit multiple CPU cores for substantially reduced runtime on modern CPUs. This can be important to prevent slow model training.\n\n#### macOS\nThe default C/C++ compiler Clang that comes with the macOS command line tools (installed via `xcode-select --install`) does not support OpenMP out of the box, but it can be added. Alternatively, a suitable compiler can be installed from [conda-forge](https://conda-forge.org). Please see this [detailed guide](https://scikit-learn.org/stable/developers/advanced_installation.html#macos)  for more information on both strategies (although written for [scikit-image](https://scikit-learn.org), it also applies here).\n\nA third alternative (and what we did until StarDist 0.8.1) is to install the OpenMP-enabled GCC compiler via [Homebrew](https://brew.sh) with `brew install gcc` (e.g. installing `gcc-12`/`g++-12` or newer). After that, you can build the package like this (adjust compiler names/paths as necessary):\n\n    CC=gcc-12 CXX=g++-12 pip install stardist\n\nIf you use `conda` on macOS and after `import stardist` see errors similar to `Symbol not found: _GOMP_loop_nonmonotonic_dynamic_next`, please see [this issue](https://github.com/stardist/stardist/issues/19#issuecomment-535610758) for a temporary workaround.\n\n##### MacOS OpenMP symbol not found Error \n\nIf you encounter an `ImportError: dlopen(...): symbol not found in flat namespace ...` error on `import stardist`, you may try to install it like so:\n\n```\nbrew install libomp\n\nlibomp_root=$(brew --prefix libomp)\n\nexport CPPFLAGS=\"$CPPFLAGS -Xpreprocessor -fopenmp\"\nexport CFLAGS=\"$CFLAGS -I$libomp_root/include\"\nexport CXXFLAGS=\"$CXXFLAGS -I$libomp_root/include\"\nexport LDFLAGS=\"$LDFLAGS -Wl,-rpath,$libomp_root/lib -L$libomp_root/lib -lomp\"\npip install stardist --no-binary :all:\n```\n##### Apple Silicon\n\nAs of StarDist 0.8.2, we provide `arm64` wheels that should work with [macOS on Apple Silicon](https://support.apple.com/en-us/HT211814) (M1 chip or newer). \nWe recommend setting up an `arm64` `conda` environment with GPU-accelerated TensorFlow following [Apple's instructions](https://developer.apple.com/metal/tensorflow-plugin/) (ensure you are using macOS 12 Monterey or newer) using [conda-forge miniforge3 or mambaforge](https://github.com/conda-forge/miniforge). Then install `stardist` using `pip`.\n```\nconda create -y -n stardist-env python=3.9   \nconda activate stardist-env\nconda install -c apple tensorflow-deps\npip install tensorflow-macos tensorflow-metal\npip install stardist\n```\n\n#### Windows\nPlease install the [Build Tools for Visual Studio 2019](https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2019) (or newer) from Microsoft to compile extensions for Python 3.6+ (see [this](https://wiki.python.org/moin/WindowsCompilers) for further information). During installation, make sure to select the *C++ build tools*. Note that the compiler comes with OpenMP support.\n\n## Plugins for other software\n\n### ImageJ/Fiji\n\nWe currently provide a ImageJ/Fiji plugin that can be used to run pretrained StarDist models on 2D or 2D+time images. Installation and usage instructions can be found at the [plugin page](https://imagej.net/StarDist).\n\n### Napari\n\nWe made a plugin for the Python-based multi-dimensional image viewer [napari](https://napari.org). It directly uses the StarDist Python package and works for 2D and 3D images. Please see the [code repository](https://github.com/stardist/stardist-napari) for further details.\n\n### QuPath\n\nInspired by the Fiji plugin, [Pete Bankhead](https://github.com/petebankhead) made a custom implementation of StarDist 2D for [QuPath](https://qupath.github.io) to use pretrained models. Please see [this page](https://qupath.readthedocs.io/en/latest/docs/deep/stardist.html) for documentation and installation instructions.\n\n### Icy\n\nBased on the Fiji plugin, [Deborah Schmidt](https://github.com/frauzufall) made a StarDist 2D plugin for [Icy](https://github.com/stardist/stardist-icy) to use pretrained models. Please see the [code repository](https://github.com/stardist/stardist-icy) for further details.\n\n### KNIME\n\n[Stefan Helfrich](https://github.com/stelfrich) has modified the Fiji plugin to be compatible with [KNIME](https://www.knime.com). Please see [this page](https://hub.knime.com/stelfrich/spaces/Public/latest/StarDist/StarDist%202D) for further details.\n\n## How to cite\n```bibtex\n@inproceedings{schmidt2018,\n  author    = {Uwe Schmidt and Martin Weigert and Coleman Broaddus and Gene Myers},\n  title     = {Cell Detection with Star-Convex Polygons},\n  booktitle = {Medical Image Computing and Computer Assisted Intervention - {MICCAI} \n  2018 - 21st International Conference, Granada, Spain, September 16-20, 2018, Proceedings, Part {II}},\n  pages     = {265--273},\n  year      = {2018},\n  doi       = {10.1007/978-3-030-00934-2_30}\n}\n\n@inproceedings{weigert2020,\n  author    = {Martin Weigert and Uwe Schmidt and Robert Haase and Ko Sugawara and Gene Myers},\n  title     = {Star-convex Polyhedra for 3D Object Detection and Segmentation in Microscopy},\n  booktitle = {The IEEE Winter Conference on Applications of Computer Vision (WACV)},\n  month     = {March},\n  year      = {2020},\n  doi       = {10.1109/WACV45572.2020.9093435}\n}\n\n@inproceedings{weigert2022,\n  author    = {Martin Weigert and Uwe Schmidt},\n  title     = {Nuclei Instance Segmentation and Classification in Histopathology Images with Stardist},\n  booktitle = {The IEEE International Symposium on Biomedical Imaging Challenges (ISBIC)},\n  year      = {2022},\n  doi       = {10.1109/ISBIC56247.2022.9854534}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstardist%2Fstardist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstardist%2Fstardist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstardist%2Fstardist/lists"}