diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 5b7ffbf..a688b52 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -39,10 +39,14 @@ jobs: http-user-agent: ${{ matrix.config.http-user-agent }} use-public-rspm: true - - name: Install system dependencies + - name: Install Linux system dependencies if: runner.os == 'Linux' run: sudo apt-get install -y libwebp-dev libzstd-dev + - name: Install MacOS system dependencies + if: runner.os == 'macOS' + run: brew install --cask xquartz + - uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: any::rcmdcheck diff --git a/DESCRIPTION b/DESCRIPTION index fd8aed5..1422b28 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: detrendr Title: Detrend Images -Version: 0.6.16 +Version: 0.6.17 Authors@R: c( person("Rory", "Nolan", , "rorynoolan@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-5239-4043")), @@ -52,6 +52,7 @@ Suggests: knitr, lattice, MASS, + magick, matrixStats, mgcv, pacman, @@ -70,5 +71,5 @@ Config/testthat/parallel: true Encoding: UTF-8 Language: en-US Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.2 SystemRequirements: GNU make diff --git a/NEWS.md b/NEWS.md index 8b2d298..46ed8bb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# `detrendr` 0.6.17 + +## BUG FIXES +* Prep for new `ijtiff::display()`. + + # `detrendr` 0.6.16 ## BUG FIXES diff --git a/R/detrendr.R b/R/detrendr.R index 22e9c14..80de39b 100644 --- a/R/detrendr.R +++ b/R/detrendr.R @@ -20,7 +20,6 @@ if (getRversion() >= "2.15.1") { #' for preprocessing in fluorescence fluctuation and correlation spectroscopy #' (FFS and FCS). #' -#' @docType package #' @name detrendr #' @aliases detrendr-package #' @references Rory Nolan, Luis A. J. Alvarez, Jonathan Elegheert, Maro @@ -28,4 +27,4 @@ if (getRversion() >= "2.15.1") { #' Aricescu, Sergi Padilla-Parra; nandb—number and brightness in R with a #' novel automatic detrending algorithm, Bioinformatics, #' https://doi.org/10.1093/bioinformatics/btx434. -NULL +"_PACKAGE" diff --git a/codemeta.json b/codemeta.json index 6c179fd..8599923 100644 --- a/codemeta.json +++ b/codemeta.json @@ -8,7 +8,7 @@ "codeRepository": "https://github.com/rorynolan/detrendr", "issueTracker": "https://github.com/rorynolan/detrendr/issues", "license": "https://spdx.org/licenses/BSD-3-Clause", - "version": "0.6.16", + "version": "0.6.17", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", @@ -181,6 +181,18 @@ }, "sameAs": "https://CRAN.R-project.org/package=MASS" }, + { + "@type": "SoftwareApplication", + "identifier": "magick", + "name": "magick", + "provider": { + "@id": "https://cran.r-project.org", + "@type": "Organization", + "name": "Comprehensive R Archive Network (CRAN)", + "url": "https://cran.r-project.org" + }, + "sameAs": "https://CRAN.R-project.org/package=magick" + }, { "@type": "SoftwareApplication", "identifier": "matrixStats", @@ -513,7 +525,7 @@ }, "SystemRequirements": "GNU make" }, - "fileSize": "813.008KB", + "fileSize": "10268.038KB", "citation": [ { "@type": "ScholarlyArticle", diff --git a/detrendr.Rproj b/detrendr.Rproj index 270314b..c9e3954 100644 --- a/detrendr.Rproj +++ b/detrendr.Rproj @@ -1,4 +1,5 @@ Version: 1.0 +ProjectId: a7e7ab1f-4608-47c2-861d-78fd6e12dbe3 RestoreWorkspace: Default SaveWorkspace: Default diff --git a/man/detrendr.Rd b/man/detrendr.Rd index d616362..7af8d10 100644 --- a/man/detrendr.Rd +++ b/man/detrendr.Rd @@ -17,3 +17,22 @@ Aricescu, Sergi Padilla-Parra; nandb—number and brightness in R with a novel automatic detrending algorithm, Bioinformatics, https://doi.org/10.1093/bioinformatics/btx434. } +\seealso{ +Useful links: +\itemize{ + \item \url{https://rorynolan.github.io/detrendr/} + \item \url{https://github.com/rorynolan/detrendr#readme} + \item Report bugs at \url{https://github.com/rorynolan/detrendr/issues} +} + +} +\author{ +\strong{Maintainer}: Rory Nolan \email{rorynoolan@gmail.com} (\href{https://orcid.org/0000-0002-5239-4043}{ORCID}) + +Other contributors: +\itemize{ + \item Luis Alvarez \email{lalvarez@well.ox.ac.uk} (\href{https://orcid.org/0000-0003-1316-1906}{ORCID}) [contributor, copyright holder] + \item Sergi Padilla-Parra \email{spadilla@well.ox.ac.uk} (\href{https://orcid.org/0000-0002-8010-9481}{ORCID}) [contributor, thesis advisor, copyright holder] +} + +} diff --git a/vignettes/single-images.Rmd b/vignettes/single-images.Rmd index 5ffe3a5..9c4af4a 100644 --- a/vignettes/single-images.Rmd +++ b/vignettes/single-images.Rmd @@ -14,8 +14,10 @@ In this vignette, we will look at detrending single images interactively in an R ```{r setup, include=FALSE} knitr::opts_chunk$set( echo = TRUE, comment = "#>", - fig.width = 7, fig.height = 6 + fig.width = 7, fig.height = 6, + crop = TRUE ) +knitr::knit_hooks$set(crop = knitr::hook_pdfcrop) pacman::p_load(dplyr, tidyr, MASS, mgcv, ggplot2, gridExtra) set.seed(1) ``` @@ -46,7 +48,7 @@ dim(my_img) Plotting the mean intensities of the frames in the two channels, we can see that the second channel has more obvious bleaching. -```{r plot-mean-profile, echo=FALSE, fig.height=3, message=FALSE} +```{r plot-mean-profile, echo=FALSE, out.width='100%', message=FALSE} plot_tbl <- tibble( frame = seq_len(dim(my_img)[4]), channel1 = apply(autothresholdr::mean_stack_thresh(my_img[, , 1, ], "h"), 4, @@ -92,7 +94,7 @@ display(mean_pillars(my_img[, , 2, ])) You can see here that this is an image of part of a cell, with the edge of the cell across the top left and hence the top left corner of the image is not cell, just background. It's important to _threshold_ away this background part: the detrending routine assumes that all parts of the image are part of the region of interest (the cell), so we need to set the background parts to `NA` beforehand to tell the detrending routine that this area should be excluded. `detrendr` has all of the thresholding functionality of the _ImageJ Auto Threshold_ plugin. You can read more about this at https://imagej.net/plugins/auto-threshold. My favourite method is _Huang_. Let's look at both of these channels with _Huang_ thresholding. -```{r display-thresholded-mean, echo=FALSE, fig.height=4} +```{r display-thresholded-mean, echo=FALSE, out.width='100%'} graphics::par(mfrow = c(1, 2)) display(mean_pillars(autothresholdr::mean_stack_thresh(my_img[, , 1, ], "h"))) display(mean_pillars(autothresholdr::mean_stack_thresh(my_img[, , 2, ], "h"))) @@ -120,7 +122,7 @@ my_detrended_img <- img_detrend_robinhood(my_img_threshed) Let's check out the mean intensity profiles of this detrended image. -```{r plot-detrended-mean-profile, echo=FALSE, fig.height=3, message=FALSE} +```{r plot-detrended-mean-profile, echo=FALSE, out.width='100%', message=FALSE} plot_tbl <- tibble( frame = seq_len(dim(my_detrended_img)[4]), channel1 = apply(my_detrended_img[, , 1, ], 3, mean, na.rm = TRUE),