Skip to content

thinr

0.3.0Package record

Binary Image Thinning Algorithms

0packages depend
1.5Kdownloads / year
100.0%test coverage
13/13flavors OK

Overview

About

Thinning (skeletonization) algorithms for binary raster images. Provides seven algorithms behind a single dispatching function: Zhang-Suen (Zhang and Suen 1984) doi:10.1145/357994.358023, Guo-Hall (Guo and Hall 1989) doi:10.1145/62065.62074, a 2-D adaptation of Lee (Lee, Kashyap, and Chu 1994) doi:10.1006/cgip.1994.1042, K3M (Saeed, Tabedzki, Rybnik, and Adamski 2010) doi:10.2478/v10006-010-0024-4, the parallel form commonly attributed to Hilditch (1969, in 'Machine Intelligence 4'), OPTA / SPTA (Naccache and Shinghal 1984), and Holt and colleagues (1987) doi:10.1145/12527.12531. Also provides the medial axis transform (Blum 1967) and a distance transform implementation following Felzenszwalb and Huttenlocher (2012) doi:10.4086/toc.2012.v008a019. The thin() API selects the algorithm by name, defaulting to Zhang-Suen. Complements the morphology in the 'EBImage' package, which does not provide a thinning operator.

Changes in 0.3.0

Correctness fixes from the figureextract ecosystem review (2026-07-03).

All are boundary conditions the published algorithms assume away; see the

new vignette("correctness-properties") for the guarantees they restore.

  • thin() now skeletonises shapes that touch the matrix border correctly. The kernels inspect an 8-neighbourhood and so never deleted pixels in the outermost row or column, leaving edge-touching shapes two to three pixels thick; thin() now pads the image with a one-pixel background margin and crops it back, so a shape thins identically whether or not it touches the frame. Applies to all seven methods (#F012).
  • thin(method = "opta") now keeps two-pixel-wide strokes connected. The SPTA kernel evaluated all four contour directions against the pre-cycle snapshot and deleted them in one batch, so both sides of a 2px stroke were removed together and the skeleton fragmented (a 2×9 bar collapsed to its four corner pixels). Deletion is now sequential per direction, as Naccache & Shinghal's two-scan formulation requires (#F011).
Show all changes in 0.3.0Hide the rest of the changes in 0.3.0
  • distance_transform(metric = "manhattan" | "chessboard") now returns Inf for a fully-foreground image (no background pixel exists), matching the "euclidean" metric and EBImage::distmap(). The two-pass metrics previously seeded foreground with a finite sentinel that leaked out as a plausible-looking but meaningless finite distance (#F015).
  • thin(), distance_transform(), and medial_axis() now reject NA input with a clear error at the coercion boundary instead of silently turning it into NA_integer_ (INT_MIN) in the C++ kernels (#F016).
  • thin(method = "hilditch") now thins junctions to the published parallel form. The look-ahead conditions 3 and 4 skip deleting a pixel only when a cardinal neighbour has crossing number A == 1 on the current image; the kernel had compared the look-ahead crossing number (computed with the centre already removed) against 1, which is strictly stronger and also spared junction neighbours where A >= 2, leaving a redundant pixel beside the junction. Skeletons are now equal to or thinner than before, never thicker (verified against a reference implementation of the published form over random images) (#F014).
  • Added a connectivity-preservation property test across all seven methods and tightened the Holt straight-line test (#F013).
  • Documented and pinned the isolated-2×2-block behaviour: the default zhang_suen erases an isolated 2×2 block entirely while guo_hall keeps one pixel. See vignette("choosing-a-method") for guidance on small-blob masks (#F017).
  • Removed thinImage(). Use thin() (Zhang-Suen is the default method).

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 3.4 min · r-devel-windows-x86_64
Status changes
  • OK13 OK2026-08-04
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK7 OK2026-05-28
Advisories

none known

Documentation

In release 0.3.0
READMEYes · 520 wordsVignettesYes · 2 · dynamicNEWSYes · 100% structured · mentions 0.3.0Citation fileNoWebsiteYes · pkgdown
Help pages
4 (1 internal)includes a package overview page
Examples that run
100%3 run in a plain check
Exported functions with examples
100%
Documented parameters
100%
Return-value docs
100%
Help pages citing references
50%

Downloads

1.5K
CRAN downloads in the past year
Rank #17,474 · ~4/day · ~124/mo
Daily download trend is not available in this view yet.
20630 days
73790 days
1.5K1 year
Compare downloads with other packages →
Also on83 r2u2 autocran

Repository

0Stars
0Forks
0Open issues
0Open PRs
1Releases
61Commits
1Commit identities
61 commits · Last activity 2026-08-22 · Default branch at 0.3.0.9000, ahead of CRAN 0.3.0 (checked 2026-10-21)
Responsiveness
How these are sampled
PRs merged (all time)
93%
Median days to close, 50 most recently updated closed issues
0
Median days to close, 50 most recently updated closed PRs
0

Releases over time

2026-07-07 · 02026-07-26 · 1
PracticesBeta

8 development-tooling and community-health practices detected across 4 families in the upstream repository

Checks run against github.com/humanpred/thinr on 2026-10-21.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Docs source (3)
pkgdown

GitHub Pages site last deployed 2026-08-22 · The repository has a site deploy workflow

pkgdown site last built 2026-08-22

Coverage (1)
Coverage reporting
Lint, format, editor (2)
lintrLint workflow
How this is detected·Detection ruleset v4 (2026-10-20)
AI coding toolsBeta

This repository shows signs of AI coding tools.

  • Claude Codefirst seen on or before 2026-05-16
    Seen in the repository: CLAUDE.md
    Named in .Rbuildignore: CLAUDE.md
    Named in .gitignore: .claude
    Commits: at least 43 crediting it in the message
Models named in its commits
  • Claude Opus 4.819 commits · Jun to Jul 2026
  • Claude Opus 4.715 commits · May 2026
  • Claude Fable 57 commits · Jul 2026
  • Claude Opus 52 commits · Jul to Aug 2026
Counts are commits, not lines of code. Commits by a tool's accounts count once across all of its accounts. Commits crediting it are the largest count among its credit lines, a minimum.How this is detected·Detection ruleset v4 (updated 2026-09-27)

Dependencies

Declared dependencies
9 external dependencies (excludes base and recommended)

Installing thinr adds 1 package (1 with compiled code, 1.8 MB of source tarballs). Heaviest: Rcpp 1.8 MB.

Depends (1)
R >= 4.2
Imports (1)
LinkingTo (1)
Enhances (0)
none
Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

People & History

People (1)
Author, Maintainer since 0.2.0 (2026)
Human Predictions, LLC
Releases (2)

Pick two releases to compare their code metrics.

  • 0.3.0Latest
    record
    2026-07-26 · current release · diff ↗ ·
    removed 1 export
    thinImage
  • 0.2.0
    record
    2026-05-27
  • R
    R 4.6.0 released · 2026-04-24

Package metadata

First published
2026-05-27
Total releases
2 / 1 yrs
License
LGPL-3 OSI
Minimum R
≥ 4.2
Download size
62 KB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("thinr")
Denney, B. (2026). thinr: Binary Image Thinning Algorithms (Version 0.3.0) [Computer software]. https://doi.org/10.32614/CRAN.package.thinr

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for thinr version 0.3.0 [Data set]. HJJB, LLC. Data release v2026-10-24. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-24, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy