{"id":17169462,"url":"https://github.com/smups/rustronomy-watershed","last_synced_at":"2025-08-24T00:08:12.584Z","repository":{"id":65043395,"uuid":"581173625","full_name":"smups/rustronomy-watershed","owner":"smups","description":"Rustronomy-watershed is a pure-rust implementation of the segmenting and merging watershed algorithms","archived":false,"fork":false,"pushed_at":"2024-09-12T14:39:52.000Z","size":50644,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-20T01:51:22.602Z","etag":null,"topics":["algorithm","astronomy","image-processing","image-segmentation","science","watershed"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smups.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-EN.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,"zenodo":null}},"created_at":"2022-12-22T13:19:21.000Z","updated_at":"2024-12-23T04:24:28.000Z","dependencies_parsed_at":"2023-02-15T17:16:10.937Z","dependency_job_id":"8d1787bf-f436-4a58-bd58-00968fd4226a","html_url":"https://github.com/smups/rustronomy-watershed","commit_stats":{"total_commits":98,"total_committers":1,"mean_commits":98.0,"dds":0.0,"last_synced_commit":"76647a8da1b19ed67cad01828f6f6c7420f1d421"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/smups/rustronomy-watershed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smups%2Frustronomy-watershed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smups%2Frustronomy-watershed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smups%2Frustronomy-watershed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smups%2Frustronomy-watershed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smups","download_url":"https://codeload.github.com/smups/rustronomy-watershed/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smups%2Frustronomy-watershed/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271252933,"owners_count":24726916,"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-08-19T02:00:09.176Z","response_time":63,"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":["algorithm","astronomy","image-processing","image-segmentation","science","watershed"],"created_at":"2024-10-14T23:26:19.461Z","updated_at":"2025-08-24T00:08:11.658Z","avatar_url":"https://github.com/smups.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://github.com/smups/rustronomy/blob/main/logos/Rustronomy-watershed_github_banner_dark.png?raw=true#gh-light-mode-only)\n![](https://github.com/smups/rustronomy/blob/main/logos/Rustronomy-watershed_github_banner_light.png#gh-dark-mode-only)\n# The Rustronomy watershed - a pure rust implementation of the segmenting and merging watershed algorithms\n[![License: EUPL v1.2](https://img.shields.io/badge/License-EUPLv1.2-blue.svg)](https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12)\n[![Crates.io](https://img.shields.io/crates/v/rustronomy-watershed)](https://crates.io/crates/rustronomy-watershed)\n![Downloads](https://img.shields.io/crates/d/rustronomy-watershed)\n\u003e[_This crate is part of the Rustronomy Project_](https://github.com/smups/rustronomy)\n\nRustronomy-watershed is a pure-rust implementation of the segmenting and merging\nwatershed algorithms (see Digabel \u0026 Lantuéjoul, 1978[^1]).\n\n## Features [(read the docs)](https://docs.rs/rustronomy-watershed/)\nTwo main versions of the watershed\nalgorithm are included in this crate.\n1. The *merging* watershed algorithm, which is\na void-filling algorithm that can be used to identify connected regions in image.\n2. The *segmenting* watershed algorithm, which is a well-known image segmentation algorithm.\n\nIn addition, `rustronomy-watershed` provides extra functionality which can be\naccessed via cargo feature gates. A list of all additional features [can be found\nbelow](#cargo-feature-gates).\n\n# Gallery\ndata from the Canadian Galactic Plane Survey (CGPS)\n\n*Merging watershed algorithm in action*\n![](./gallery/CGPS_merge.gif)\n\n*Segmenting watershed algorithm in action*\n![](./gallery/CGPS_segment.gif)\n\n# Quickstart\nTo use the latest release of Rustronomy-watershed in a cargo project, add the rustronomy-watershed crate as a dependency to your `Cargo.toml` file:\n```toml\n[dependencies]\nrustronomy-watershed = \"0.3.2\"\n```\nTo use Rustronomy-fits in a Jupyter notebook, execute a cell containing the following code:\n```rust\n:dep rustronomy-watershed = {version = \"0.3.2\"}\n```\n\n\u003e Please do not use any versions before 0.3, as they contain a major bug in the implementation of the merging watershed algorithm\n\nIf you want to use the latest (unstable) development version of `rustronomy-watershed`, you can do so by using the `git` field (which fetches the latest version from the repo) rather than the `version` field (which downloads the latest released version from crates.io). \n```\n{git = \"https://github.com/smups/rustronomy-watershed\"}\n```\n## Short example: computing the Watershed transform of a random field\nIn this example, we compute the watershed transform of a uniform random field.\nThe random field can be generated with the `ndarray_rand` crate. To configure a\nnew watershed transform, one can use the `TransformBuilder` struct which is\nincluded in the `rustronomy_watershed` prelude.\n```rust\nuse ndarray as nd;\nuse rustronomy_watershed::prelude::*;\nuse ndarray_rand::{rand_distr::Uniform, RandomExt};\n\n//Create a random uniform distribution\nlet rf = nd::Array2::\u003cu8\u003e::random((512, 512), Uniform::new(0, 254));\n//Set-up the watershed transform\nlet watershed = TransformBuilder::default().build_segmenting().unwrap();\n//Find minima of the random field (to be used as seeds)\nlet rf_mins = watershed.find_local_minima(rf.view());\n//Execute the watershed transform\nlet output = watershed.transform(rf.view(), \u0026rf_mins);\n```\n# Cargo feature gates\n*By default, all features behind cargo feature gates are **disabled***\n- `jemalloc`: this feature enables the [jemalloc allocator](https://jemalloc.net).\nFrom the jemalloc website: *\"jemalloc is a general purpose `malloc`(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support.\"*. Jemalloc\nis enabled though usage of the `jemalloc` crate, which increases compile times considerably. However, enabling this feature can also greatly improve run-time performance, especially on machines with more (\u003e6 or so) cores. To compile\n`rustronomy-watershed` with the `jemalloc` feature, jemalloc must be installed\non the host system.\n- `plots`: with this feature enabled, `rustronomy-watershed` will generate a plot\nof the watershed-transform each time the water level is increased. See the crate\nlevel docs for details on how to use this feature. Plotting support adds the\n`plotters` crate as a dependency, which increases compile times and requires the\ninstallation of some packages on linux systems, [see the `plotters` documentation\nfor details](https://docs.rs/plotters/).\n- `progress`: this feature enables progress bars for the watershed algorithm.\nEnabling this feature adds the `indicatif` crate as a dependency, which should not\nconsiderably slow down compile times.\n- `debug`: this feature enables debug and performance monitoring output. This\ncan negatively impact performance. Enabling this feature does not add additional\ndependencies.\n\n\n# License\n[![License: EUPL v1.2](https://img.shields.io/badge/License-EUPLv1.2-blue.svg)](https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12)\n\nAll crates in the Rustronomy ecosystem are licensed under the EUPLv1.2 (or higher)\nlicense.\n\u003e**Rustronomy-watershed is explicitly not licensed under the dual\nApache/MIT license common to the Rust ecosystem. Instead it is licensed under\nthe terms of the [European Union Public License v1.2](https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12)**.\n\nRustronomy is a science project and embraces the values of open science and free\nand open software. Closed and paid scientific software suites hinder the\ndevelopment of new technologies and research methods, as well as diverting much-\nneeded public funds away from researchers to large publishing and software\ncompanies.\n\nSee the [LICENSE.md](../LICENSE.md) file for the EUPL text in all 22 official\nlanguages of the EU, and [LICENSE-EN.txt](../LICENSE-EN.txt) for a plain text\nEnglish version of the license.\n\n[^1]: H. Digabel and C. Lantuéjoul. **Iterative algorithms.** *In Actes du Second Symposium Européen d’Analyse Quantitative des Microstructures en Sciences des Matériaux, Biologie et Medécine*, October 1978.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmups%2Frustronomy-watershed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmups%2Frustronomy-watershed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmups%2Frustronomy-watershed/lists"}