{"id":15554882,"url":"https://github.com/ropensci/mtreering","last_synced_at":"2026-03-16T09:38:57.123Z","repository":{"id":53742838,"uuid":"170800356","full_name":"ropensci/MtreeRing","owner":"ropensci","description":" A tool for measuring tree-ring width","archived":false,"fork":false,"pushed_at":"2024-07-17T15:02:08.000Z","size":105782,"stargazers_count":33,"open_issues_count":9,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T21:04:30.794Z","etag":null,"topics":["dendrochronology","forest","forestry","r","shiny-apps","shinyapp","tree-ring-width","tree-rings"],"latest_commit_sha":null,"homepage":"https://ropensci.github.io/MtreeRing/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ropensci.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-15T04:10:10.000Z","updated_at":"2024-12-23T11:09:42.000Z","dependencies_parsed_at":"2022-09-23T20:03:42.720Z","dependency_job_id":null,"html_url":"https://github.com/ropensci/MtreeRing","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2FMtreeRing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2FMtreeRing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2FMtreeRing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ropensci%2FMtreeRing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ropensci","download_url":"https://codeload.github.com/ropensci/MtreeRing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250506621,"owners_count":21441810,"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","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":["dendrochronology","forest","forestry","r","shiny-apps","shinyapp","tree-ring-width","tree-rings"],"created_at":"2024-10-02T15:04:03.664Z","updated_at":"2026-03-16T09:38:57.069Z","avatar_url":"https://github.com/ropensci.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"\r\nMtreeRing\r\n=======\r\n\r\n\u003c!--require(knitr);require(markdown);knit(\"README.Rmd\")--\u003e\r\n\r\n\r\n**Authors:** [Jingning Shi](https://www.researchgate.net/profile/Jingning-Shi), [Wei Xiang](https://www.researchgate.net/profile/Wei-Xiang-11)\u003cbr/\u003e\r\n**License:** [GPL3](https://cran.r-project.org/web/licenses/GPL-3)\r\n\r\n\u003c!--pkg badges--\u003e\r\n[![TravisCI Build Status](https://api.travis-ci.org/ropensci/MtreeRing.svg?branch=master)](https://api.travis-ci.org/ropensci/MtreeRing.svg?branch=master)\r\n[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/cti7i110hecl8kpf?svg=true)](https://ci.appveyor.com/project/JingningShi/MtreeRing)\r\n[![codecov](https://codecov.io/github/ropensci/MtreeRing/coverage.svg?branch=master)](https://codecov.io/github/ropensci/MtreeRing?branch=master)\r\n[![ropensci](https://badges.ropensci.org/287_status.svg)](https://github.com/ropensci/software-review/issues/287)\r\n[![cran checks](https://cranchecks.info/badges/worst/MtreeRing)](https://cranchecks.info/pkgs/MtreeRing)\r\n[![Downloads](https://cranlogs.r-pkg.org/badges/MtreeRing)](https://CRAN.R-project.org/package=MtreeRing)\r\n\r\n`MtreeRing` is a tool for automatically measuring tree-ring width using image processing techniques.\r\n\r\n## Installation\r\n\r\nInstall the stable version from CRAN\r\n\r\n\r\n```r\r\ninstall.packages(\"MtreeRing\")\r\n```\r\n\r\nor the development version from GitHub\r\n\r\n\r\n```r\r\n# install.packages(\"devtools\")\r\ndevtools::install_github(\"ropensci/MtreeRing\")\r\n```\r\n\r\n## Ring-width measurement\r\n\r\n### 1. Read an image\r\n\r\n\r\n```r\r\nlibrary(MtreeRing)\r\n## Read and plot a tree ring image\r\nimg.name \u003c- system.file(\"001.png\", package = \"MtreeRing\")\r\nt1 \u003c- ring_read(img = img.name, dpi = 1200, plot = TRUE)\r\n```\r\n\r\n`ring_read` supports commonly used image formats, including png, tiff, jpg and bmp.\r\n\r\n### 2. Detect ring borders \r\n\r\nAfter plotting the image, the automatic detection of ring borders can be performed using three alternative methods: (1) watershed algorithm; (2) Canny edge detector; (3) a linear detection algorithm from R package [measuRing](https://CRAN.R-project.org/package=measuRing).\r\n\r\n\r\n```r\r\n## Split a long core sample into 2 pieces to\r\n## get better display performance and use the\r\n## watershed algorithm to detect ring borders:\r\nt2 \u003c- ring_detect(ring.data = t1, seg = 2, method = 'watershed')\r\n```\r\n\r\n\u003ccenter\u003e\u003cimg src=\"inst/README-img001.png\" width = \"65%\" height = \"65%\" /\u003e\u003c/center\u003e\r\n\u003ccenter\u003eFigure 1. The automatic detection of ring borders\u003c/center\u003e\r\n\r\n### 3. Calculate ring-width series \r\n\r\nIf all ring borders are correctly identified, you can generate a ring-width series in data frame format. Use `write.rwl` to export the ring-width series to an rwl file.\r\n\r\n\r\n```r\r\nrw.df \u003c- ring_calculate(ring.data = t2, seriesID = \"940220\")\r\nlibrary(dplR) # A dendrochronological analysis package\r\nfn \u003c- tempfile(fileext=\".rwl\")\r\nwrite.rwl(rwl.df = rw.df, fname = fn, format = \"tucson\")\r\n```\r\n\r\n\r\n## Shiny application\r\n\r\nIf you are not familiar with R and its command line interface, the shiny-based app is a good alternative.\r\n\r\n\r\n```r\r\nMtreeRing::ring_app_launch()\r\n```\r\n\r\nThis command allows to run a Shiny-based application within the system's default web browser. The app provides a beginner-friendly graphical interface and supports more flexible mouse-based interactions, allowing image files to be uploaded up to 150 MB in size.\r\n\r\nThe dashboard has three components: a header, sidebar and body, like this\r\n\r\n\u003cimg src=\"inst/README-img002.png\" width = \"85%\" height = \"85%\" /\u003e\r\n\r\nA workflow for the Shiny app can be found at https://ropensci.github.io/MtreeRing/articles/app-MtreeRing.html. Most steps are demonstrated with a gif to make the workflow more understandable.\r\n\r\n## Ring width correction\r\n\r\nIf an increment borer is used to extract samples, it is well known that the auger sometimes fails to traverse the pith of the sampled tree but passes through one side of the pith at a certain distance. Tangent lines of rings close to the pith are therefore not perpendicular to the horizontal path, which may lead to considerable errors in ring widths.\r\n\r\nUnder such conditions, you can create two paths by setting the argument `incline = TRUE`, or by ticking the checkbox **Inclined tree rings**. See this example.\r\n\r\n\u003cimg src=\"inst/RingCorrection.png\" width = \"80%\" height = \"80%\" /\u003e \r\n\r\nThe line segment connecting two dots on the same ring should match the tangent of a tree ring border. The corrected ring width is estimated from the distance between adjacent rings and orientation of ring borders.\r\n\r\n## Support\r\n\r\nAny feedback, bug reports or suggestions are welcomed. If you have a comment on `MtreeRing`, or you find a bug in the released or beta versions, please submit bugs and/or feature requests at https://github.com/ropensci/MtreeRing/issues. Include the package version, OS, and any command-line required to reproduce the problem.\r\n\r\n## Code of conduct\r\n\r\nI will try to add new features based on user feedback. It is hoped that others will contribute additional useful features. Please note that the 'MtreeRing' project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this project, you agree to abide by its terms.\r\n\r\n[![ropensci_footer](https://ropensci.org/public_images/ropensci_footer.png)](https://ropensci.org)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropensci%2Fmtreering","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fropensci%2Fmtreering","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropensci%2Fmtreering/lists"}