Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
^fit_spatial_mask\.R$
^demo_fit_spatial_mask\.R$
^demo_holes_and_scale\.R$
^vignette_fit_spatial_mask\.Rmd$
^vignette_fit_spatial_mask\.html$
^vignette_fit_spatial_mask_cache$
^vignette_fit_spatial_mask_files$
^_pkgdown\.yml$
^pkgdown$
^\.github$
^.*\.Rproj$
^\.Rproj\.user$
^README\.Rmd$
^LICENSE\.md$
52 changes: 52 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# R CMD check workflow
# Runs on every push and pull request to main/master.
# Tests on Ubuntu (release + devel), macOS (release), and Windows (release).

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual", "--compact-vignettes=gs+qpdf")'
args: 'c("--no-manual", "--as-cran")'
52 changes: 52 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# pkgdown site deployment
# Builds and deploys the pkgdown site to GitHub Pages on every push to main.
# Requires GitHub Pages to be enabled with "Source: Deploy from a branch"
# set to "gh-pages / (root)" in repository Settings > Pages.

on:
push:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown

concurrency:
group: pkgdown-${{ github.event_name }}
cancel-in-progress: true

jobs:
pkgdown:
runs-on: ubuntu-latest

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

permissions:
contents: write

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages
uses: JamesIves/github-pages-deploy-action@v4
with:
clean: false
branch: gh-pages
folder: docs
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ vignettes/*.pdf
.Renviron

# pkgdown site
docs/
# docs/

# translation temp files
po/*~
Expand Down
37 changes: 37 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Package: TissueMask
Type: Package
Title: Spatial Boundary Mask Fitting for Point Coordinate Data
Version: 0.1.0
Authors@R: person("Raredon Laboratory", role = c("aut", "cre"),
email = "raredonlab@yale.edu")
Description: Fits polygon spatial masks to XY point coordinates such as
cell centroids or transcript locations from spatial transcriptomics
and spatial proteomics experiments. Supports four methods of
increasing topological complexity: convex hull, concave hull, kernel
density estimation (KDE), and a raster-based Gaussian smoothing
approach that naturally handles internal voids (vessel lumens,
necrotic cores, tissue tears) and disconnected tissue islands via
GEOS polygon dissolve.
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.3
Depends:
R (>= 4.1.0)
Imports:
sf (>= 1.0-0),
stats,
parallel
Suggests:
concaveman,
MASS,
isoband,
ggplot2,
testthat (>= 3.0.0),
knitr,
rmarkdown,
patchwork
VignetteBuilder: knitr
URL: https://raredonlab.github.io/TissueMask/, https://github.com/RaredonLab/TissueMask
BugReports: https://github.com/RaredonLab/TissueMask/issues
Config/testthat/edition: 3
23 changes: 2 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,2 @@
MIT License

Copyright (c) 2026 Raredon Lab

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
YEAR: 2026
COPYRIGHT HOLDER: Raredon Laboratory
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2026 Raredon Laboratory

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
23 changes: 23 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by roxygen2: do not edit by hand

export(fit_spatial_mask)
importFrom(parallel,mclapply)
importFrom(sf,"st_crs<-")
importFrom(sf,NA_crs_)
importFrom(sf,st_area)
importFrom(sf,st_as_sf)
importFrom(sf,st_bbox)
importFrom(sf,st_buffer)
importFrom(sf,st_convex_hull)
importFrom(sf,st_covered_by)
importFrom(sf,st_difference)
importFrom(sf,st_distance)
importFrom(sf,st_geometry)
importFrom(sf,st_make_valid)
importFrom(sf,st_polygon)
importFrom(sf,st_sf)
importFrom(sf,st_sfc)
importFrom(sf,st_simplify)
importFrom(sf,st_union)
importFrom(sf,st_within)
importFrom(stats,filter)
32 changes: 32 additions & 0 deletions R/TissueMask-package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#' TissueMask: Spatial Boundary Mask Fitting for Point Coordinate Data
#'
#' @description
#' TissueMask provides [`fit_spatial_mask()`], which fits polygon spatial masks
#' to XY point coordinate data such as cell centroids or transcript locations
#' from spatial transcriptomics and spatial proteomics experiments.
#'
#' Four masking methods are available, supporting geometries of increasing
#' topological complexity — from simple convex hulls to multi-polygon masks
#' with internal voids and disconnected islands:
#'
#' | Method | Holes/Islands | Speed | Recommended for |
#' |---|---|---|---|
#' | `"convex"` | No | Instant | Sanity checks |
#' | `"concave"` | No | Fast | Simple non-convex shapes |
#' | `"kde"` | Yes | Moderate | Dense, smooth datasets |
#' | `"raster"` | Yes | Fast | Most use cases (default) |
#'
#' @section Part of TissueSuite:
#' TissueMask is the first component of the **TissueSuite** package family
#' developed at the Raredon Laboratory, Yale School of Medicine. The companion
#' package **TissueField** uses TissueMask output to estimate steady-state
#' molecular concentration fields via a diffusion–clearance PDE.
#'
#' @seealso [`fit_spatial_mask()`]
#'
#' @keywords internal
"_PACKAGE"

# Suppress R CMD check NOTE: "no visible binding for global variable 'x'/'y'"
# These are ggplot2 aesthetic mappings in fit_spatial_mask(plot = TRUE).
utils::globalVariables(c("x", "y"))
Loading
Loading