Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Imager 0 42 10 #153

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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="[email protected]",role=c("aut")),
person("David","Tschumperle",role=c("ctb")),
Expand Down Expand Up @@ -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
12 changes: 6 additions & 6 deletions R/conversions.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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")
}
}

Expand All @@ -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")
}
}

Expand Down
12 changes: 6 additions & 6 deletions inst/include/CImg.h
Original file line number Diff line number Diff line change
Expand Up @@ -22918,7 +22918,7 @@ namespace cimg_library_suffixed {
// Filename specified.
CImg<charT> 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<siz_out; ++k) ptr_out[k] = ptr_arg1[k];
cimg::fdate(ss,ptr_out,siz_out);
Expand Down Expand Up @@ -23360,7 +23360,7 @@ namespace cimg_library_suffixed {
const ulongT siz = (ulongT)mp.opcode[3];
CImg<charT> 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);
}

Expand Down Expand Up @@ -23647,7 +23647,7 @@ namespace cimg_library_suffixed {
const ulongT siz = (ulongT)mp.opcode[3];
CImg<charT> 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);
}

Expand All @@ -23672,7 +23672,7 @@ namespace cimg_library_suffixed {
const ulongT siz = (ulongT)mp.opcode[3];
CImg<charT> 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);
}

Expand Down Expand Up @@ -25561,7 +25561,7 @@ namespace cimg_library_suffixed {
cimg::type<T>::string(),w,h,d,s,sizM);
CImg<charT> 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<doubleT> img;
if (siz1) cimg_mp_func_store(ptr1 + 1,
Expand All @@ -25584,7 +25584,7 @@ namespace cimg_library_suffixed {
CImg<charT> 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;
Expand Down
1 change: 1 addition & 0 deletions inst/include/NOTE_CImg
Original file line number Diff line number Diff line change
@@ -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;".
2 changes: 1 addition & 1 deletion vignettes/gettingstarted.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion vignettes/pixsets.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down