inst/doc/thresholding-images.R

## ----setup, include=FALSE-----------------------------------------------------
if (utils::packageVersion("knitr") >= "1.20.15") {
  knitr::opts_chunk$set(
    collapse = TRUE,
    comment = "#>",
    fig.width = 7, fig.height = 6,
    tidy = "styler"
  )
} else {
  knitr::opts_chunk$set(
    collapse = TRUE,
    comment = "#>",
    fig.width = 7, fig.height = 6
  )
}

## ----load libraries, results='hide'-------------------------------------------
library(autothresholdr)

## ----the image----------------------------------------------------------------
img <- ijtiff::read_tif(system.file("extdata", "fiji_eg.tif",
  package = "autothresholdr"
))
dim(img)
ijtiff::display(img) # displays first channel, first frame

## ----guess twenty-------------------------------------------------------------
ijtiff::display(img[, , 1, 1] > 20)

## ----thresh mask apply--------------------------------------------------------
auto_thresh(img, "tri")
ijtiff::display(mask(img, "tri"))
ijtiff::display(apply_mask(img, "tri"))

Try the autothresholdr package in your browser

Any scripts or data that you put into this service are public.

autothresholdr documentation built on Feb. 16, 2023, 6:12 p.m.