Skip to content

Commit 69764ab

Browse files
committed
send RBioFormats to Suggests
1 parent 0402f55 commit 69764ab

File tree

4 files changed

+39
-15
lines changed

4 files changed

+39
-15
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ Imports:
2525
rhdf5,
2626
HDF5Array,
2727
Rarr,
28-
RBioFormats,
2928
magick
3029
Suggests:
3130
testthat (>= 3.0.0),
3231
knitr,
3332
ggplot2,
3433
shiny,
34+
RBioFormats,
3535
BiocFileCache,
3636
BiocStyle
3737
Config/testthat/edition: 3

R/BFArray.R

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,25 @@
1212
#'
1313
#' @name BFArray-methods
1414
#' @rdname BFArray-methods
15-
#' @importFrom RBioFormats read.metadata
1615
#'
1716
#' @export
1817
#' @return A BFArray object
1918
#'
2019
#' @examples
2120
#' # get image
21+
#' library(RBioFormats)
2222
#' img.file <- system.file("extdata",
2323
#' "xy_12bit__plant.ome.tiff",
2424
#' package = "ImageArray")
2525
#' bfa <- BFArray(img.file, series = 1, resolution = 2)
2626
#' dim(bfa)
2727
#' type(bfa)
2828
BFArray <- function(image.file, series, resolution) {
29+
30+
# check RBioFormats
31+
if(!requireNamespace("RBioFormats"))
32+
stop("Please install RBioFormats: BiocManager::install('RBioFormats')")
33+
2934
# get metadata
3035
meta <- RBioFormats::read.metadata(
3136
file = image.file,
@@ -108,9 +113,13 @@ setMethod("type", "BFArraySeed", function(x) x@type)
108113
### extract_array()
109114
###
110115

111-
#' @importFrom RBioFormats read.metadata read.image
112116
#' @importFrom EBImage imageData
113117
.extract_array_from_BFArraySeed <- function(x, index) {
118+
119+
# check RBioFormats
120+
if(!requireNamespace("RBioFormats"))
121+
stop("Please install RBioFormats: BiocManager::install('RBioFormats')")
122+
114123
# get metadata
115124
meta <- RBioFormats::read.metadata(
116125
file = x@filepath,

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ vertical flipping and negation.
7373

7474
```r
7575
imgarray <- rotate(imgarray, degrees = 90)
76-
imgarray <- flip(imgarray)
77-
imgarray <- flop(imgarray)
78-
imgarray <- negate(imgarray)
79-
imgarray
8076
```
8177

8278
<br>
@@ -98,9 +94,10 @@ Level 2 (51,51)
9894
<br>
9995

10096
You can also use an existing **OME-TIFF** (or any Bioformats image) to
101-
create an ImageArray object.
97+
create an ImageArray object which we use **RBioFormats** package too.
10298

10399
```r
100+
library(RBioFormats)
104101
ome_file <- system.file("extdata",
105102
"xy_12bit__plant.ome.tiff",
106103
package = "ImageArray")

vignettes/ImageArray.Rmd

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,20 @@ vignette: |
1414
---
1515

1616
```{r load-libs}
17+
library(ImageArray)
1718
library(BiocFileCache)
19+
library(RBioFormats)
1820
library(EBImage)
19-
library(ImageArray)
2021
library(ggplot2)
2122
library(shiny)
2223
```
2324

2425
# Introduction
2526

26-
`r Biocpkg("ImageArray")` is a package for Pyramidal and non-pyramidal
27-
images in `r Biocpkg("DelayedArray")` format.
27+
The *ImageArray* package provides a **unified, memory-efficient** framework for working with both **pyramidal** and **non-pyramidal** images in R, leveraging the DelayedArray infrastructure.
28+
With ImageArray you can store large images on disk (HDF5 or Zarr), treat them as array-like objects, perform lazy/blocked operations (e.g., rotate, flip, crop) across all pyramid levels, and seamlessly integrate with standard R image workflows.
2829

29-
## Installation
30+
# Installation
3031

3132
You can install `r Biocpkg("ImageArray")` from Bioconductor with:
3233

@@ -37,8 +38,20 @@ if (!requireNamespace("BiocManager", quietly = TRUE)) {
3738
BiocManager::install("ImageArray")
3839
```
3940

41+
# Why pyramidal images?
42+
43+
Image pyramids are multi-resolution representations: starting from a full resolution image, you generate a series of down-sampled versions (e.g., half resolution, quarter resolution, etc). These are common in microscopy, digital pathology and large-scale imaging because:
44+
45+
- They allow fast zooming and visualization (you don’t always need full resolution to inspect large images).
46+
- They support scale-aware analysis (you may operate on coarse levels when doing overview tasks, fine levels for detail).
47+
- Storing data in a pyramidal stack often reduces memory footprint and enables on-disk processing.
48+
49+
In our context, an ImageArray object may contain **multiple series** (each a resolution level) internally, and most operations are applied *consistently* across all series.
50+
4051
# Usage
4152

53+
## EBImage
54+
4255
The main usage of the `r Biocpkg("ImageArray")` is to deliver
4356
`r Biocpkg("DelayedArray")` operations for images or a list of images in
4457
Pyramidal format. You can also use
@@ -97,7 +110,7 @@ bfa.raster <- as.raster(imgarray_cropped, max.pixel.size = 300)
97110
plot(bfa.raster)
98111
```
99112

100-
# Using magick
113+
## magick images
101114

102115
```{r read3}
103116
# make random EBImage image
@@ -116,7 +129,7 @@ bfa.raster <- as.raster(imgarray, max.pixel.size = 300)
116129
plot(bfa.raster)
117130
```
118131

119-
# Using OME.TIFF
132+
## OME.TIFF (Bio-Formats) images
120133

121134
You can create `ImageArray` objects from OME.TIFF files with already defined
122135
layers.
@@ -144,12 +157,15 @@ bfa.raster <- as.raster(img, max.pixel.size = 300)
144157
plot(bfa.raster)
145158
dim(bfa.raster)
146159
```
147-
# Using with Shiny
160+
161+
# Use cases
148162

149163
The pyramid scheme introduced by `ImageArray` objects can also be used to
150164
generate scalable plots and interactive Shiny application for visualizing
151165
large images.
152166

167+
## Visualizing H&E images
168+
153169
For this example, we will use a large H&E image used by 10x Genomics,
154170
generated after a Xenium in Situ platform run.
155171

@@ -197,6 +213,8 @@ imgggplot <- ggplot2::ggplot(data.frame(x = 0, y = 0),
197213
imgggplot
198214
```
199215

216+
## Interactive Shiny Applications
217+
200218
Now let us create a shiny application where we can interactively define
201219
subsetting and visualize the image quickly.
202220

0 commit comments

Comments
 (0)