diff --git a/DESCRIPTION b/DESCRIPTION index 6c69984..839f150 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: imager Type: Package Title: Image Processing Library Based on 'CImg' -Version: 0.42.7 +Version: 0.42.10 Author: Simon Barthelme [aut], David Tschumperle [ctb], Jan Wijffels [ctb], Haz Edine Assemlal [ctb], Shota Ochi [cre] Authors@R: c(person("Simon","Barthelme",email="simon.barthelme@gipsa-lab.fr",role=c("aut")), person("David","Tschumperle",role=c("ctb")), @@ -29,5 +29,5 @@ RoxygenNote: 7.1.1 Suggests: knitr, rmarkdown,ggplot2,dplyr,scales, - testthat,OpenMPController,raster,spatstat,magick,Cairo + testthat,OpenMPController,raster,spatstat.geom,magick,Cairo VignetteBuilder: knitr diff --git a/R/conversions.R b/R/conversions.R index 669a4a7..7112448 100755 --- a/R/conversions.R +++ b/R/conversions.R @@ -159,7 +159,7 @@ as.cimg.raster <- function(obj,...) cimg2im <- function(img,W=NULL) { - if (requireNamespace("spatstat",quietly=TRUE)) + if (requireNamespace("spatstat.geom",quietly=TRUE)) { if (depth(img) > 1) { @@ -173,12 +173,12 @@ cimg2im <- function(img,W=NULL) } else { - imrotate(img,90) %>% as.array %>% squeeze %>% spatstat::as.im(W=W) + imrotate(img,90) %>% as.array %>% squeeze %>% spatstat.geom::as.im(W=W) } } else { - stop("The spatstat package is required") + stop("The spatstat.geom package is required") } } @@ -192,13 +192,13 @@ cimg2im <- function(img,W=NULL) ##' @export im2cimg <- function(img) { - if (requireNamespace("spatstat",quietly=TRUE)) + if (requireNamespace("spatstat.geom",quietly=TRUE)) { - spatstat::as.matrix.im(img) %>% as.cimg %>% imrotate(-90) + spatstat.geom::as.matrix.im(img) %>% as.cimg %>% imrotate(-90) } else { - stop("The spatstat package is required") + stop("The spatstat.geom package is required") } } diff --git a/inst/include/CImg.h b/inst/include/CImg.h index 4044e6a..decaaa1 100644 --- a/inst/include/CImg.h +++ b/inst/include/CImg.h @@ -22918,7 +22918,7 @@ namespace cimg_library_suffixed { // Filename specified. CImg ss(siz_arg2 + 1); cimg_forX(ss,i) ss[i] = (char)ptr_arg2[i]; - ss.back() = 0; + if (ss.size() != 0) ss.back() = 0; if (!siz_arg1) return cimg::fdate(ss,(unsigned int)*ptr_arg1); for (unsigned int k = 0; k ss(siz + 1); cimg_forX(ss,i) ss[i] = (char)ptrs[i]; - ss.back() = 0; + if (ss.size() != 0) ss.back() = 0; return (double)cimg::fsize(ss); } @@ -23647,7 +23647,7 @@ namespace cimg_library_suffixed { const ulongT siz = (ulongT)mp.opcode[3]; CImg ss(siz + 1); cimg_forX(ss,i) ss[i] = (char)ptrs[i]; - ss.back() = 0; + if (ss.size() != 0) ss.back() = 0; return (double)cimg::is_directory(ss); } @@ -23672,7 +23672,7 @@ namespace cimg_library_suffixed { const ulongT siz = (ulongT)mp.opcode[3]; CImg ss(siz + 1); cimg_forX(ss,i) ss[i] = (char)ptrs[i]; - ss.back() = 0; + if (ss.size() != 0) ss.back() = 0; return (double)cimg::is_file(ss); } @@ -25561,7 +25561,7 @@ namespace cimg_library_suffixed { cimg::type::string(),w,h,d,s,sizM); CImg ss(siz2 + 1); cimg_for_inX(ss,0,ss.width() - 1,i) ss[i] = (char)ptr2[i]; - ss.back() = 0; + if (ss.size() != 0) ss.back() = 0; CImg img; if (siz1) cimg_mp_func_store(ptr1 + 1, @@ -25584,7 +25584,7 @@ namespace cimg_library_suffixed { CImg ss(siz + 1 - ind); ptrs+=1 + ind; cimg_forX(ss,i) ss[i] = (char)ptrs[i]; - ss.back() = 0; + if (ss.size() != 0) ss.back() = 0; const char *s = ss._data; while (*s && *s<=32) ++s; diff --git a/inst/include/NOTE_CImg b/inst/include/NOTE_CImg index 8507afc..5cddf6c 100644 --- a/inst/include/NOTE_CImg +++ b/inst/include/NOTE_CImg @@ -1 +1,2 @@ I removed the lines that contained #pragma warning() or #pragma GCC diagnostic. +I replaced the lines "ss.back() = 0;" with "if (ss.back() != 0) ss.back = 0;". diff --git a/vignettes/gettingstarted.Rmd b/vignettes/gettingstarted.Rmd index 8e986b2..f6657d0 100755 --- a/vignettes/gettingstarted.Rmd +++ b/vignettes/gettingstarted.Rmd @@ -15,7 +15,7 @@ vignette: > ```{r init,echo=FALSE} knitr::opts_chunk$set(warning=FALSE, message=FALSE, cache=FALSE, - comment=NA, verbose=TRUE, fig.width=5, fig.height=5,dev='jpeg',dev.args=list(quality=50)) + comment=NA, verbose=TRUE, fig.width=5, fig.height=5,dev='jpeg',dev.args=list(quality=25)) ``` **imager** contains a large array of functions for working with image data, with most of these functions coming from the [CImg library](http://www.cimg.eu/) by David Tschumperlé. This vignette is just a short tutorial, you'll find more information and examples on the website. Each function in the package is documented and comes with examples, so have a look at package documentation as well. diff --git a/vignettes/pixsets.Rmd b/vignettes/pixsets.Rmd index 7ea483f..bddfe70 100755 --- a/vignettes/pixsets.Rmd +++ b/vignettes/pixsets.Rmd @@ -15,7 +15,7 @@ vignette: > ```{r init,echo=FALSE} knitr::opts_chunk$set(warning=FALSE, message=FALSE, cache=FALSE, - comment=NA, verbose=TRUE, fig.width=5, fig.height=5,dev='jpeg',dev.args=list(quality=50)) + comment=NA, verbose=TRUE, fig.width=5, fig.height=5,dev='jpeg',dev.args=list(quality=25)) ``` If you've already gone through the "Getting started" vignette, you know about image objects ("cimg" class). This vignette introduces pixsets, which is the other important kind of objects. Pixsets represent sets of pixels, or equivalently binary images, AKA "masks". ```{r}