@@ -412,7 +412,7 @@ getDivergeRange <- function(values, diverge_center = 0) {
412
412
413
413
# ' @importFrom sf st_as_sfc st_bbox st_intersection
414
414
.bbox_sample <- function (df , bbox ) {
415
- if (is (df , " sf" )) {
415
+ if (inherits (df , " sf" )) {
416
416
# Only for one sample
417
417
bbox_use <- st_as_sfc(st_bbox(bbox ))
418
418
suppressWarnings(df <- st_intersection(df , bbox_use ))
@@ -659,7 +659,7 @@ getDivergeRange <- function(values, diverge_center = 0) {
659
659
# the bbox is a large part of the image that also needs to be written to
660
660
# disk
661
661
imgs <- lapply(imgs , function (x ) {
662
- if (is (x , " SpatRasterImage" )) {
662
+ if (inherits (x , " SpatRasterImage" )) {
663
663
tot_area <- ext(x ) | > st_bbox() | > st_as_sfc() | > st_area()
664
664
bb_area <- bbox | > st_bbox() | > st_as_sfc() | > st_area()
665
665
bb_prop <- bb_area / tot_area
@@ -684,10 +684,10 @@ getDivergeRange <- function(values, diverge_center = 0) {
684
684
}
685
685
# All convert to SpatRaster
686
686
imgs <- lapply(imgs , function (img ) {
687
- if (is (img , " BioFormatsImage" )) {
687
+ if (inherits (img , " BioFormatsImage" )) {
688
688
res_use <- .find_res(img , maxcell )
689
689
spi <- toSpatRasterImage(img , resolution = res_use , save_geotiff = FALSE )
690
- } else if (is (img , " ExtImage" )) {
690
+ } else if (inherits (img , " ExtImage" )) {
691
691
spi <- toSpatRasterImage(img , save_geotiff = FALSE )
692
692
} else spi <- img
693
693
spi | > resample_spat(maxcell )
@@ -772,7 +772,7 @@ getDivergeRange <- function(values, diverge_center = 0) {
772
772
img_df <- .get_img_df(sfe , sample_id , image_id , channel , bbox , maxcell ,
773
773
normalize_channels )
774
774
} else img_df <- NULL
775
- if (is (img_df , " DataFrame" ) && ! nrow(img_df )) img_df <- NULL
775
+ if (inherits (img_df , " DataFrame" ) && ! nrow(img_df )) img_df <- NULL
776
776
.wrap_spatial_plots(
777
777
df , annot_df , img_df , channel , type_annot , values , aes_use ,
778
778
annot_aes , annot_fixed , tx_fixed , size , shape , linewidth , linetype , alpha ,
0 commit comments