Skip to content

Commit bc80de4

Browse files
committed
update documentation
1 parent 4116f97 commit bc80de4

File tree

2 files changed

+41
-30
lines changed

2 files changed

+41
-30
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
**ImageArray** provides a unified, memory‑efficient way to work with pyramidal and non‑pyramidal images using the `DelayedArray` package in Bioconductor.
44
It stores large images in memory or on disk (as **HDF5** or **Zarr**), allows array‑like manipulations, and applies common image operations
5-
consistently across all pyramid levels without loading arrays to memory.
5+
consistently across all pyramid levels without loading arrays in memory.
66

77
- **Pyramids:** multi‑resolution stacks of, e.g., from HDF5, Zarr or OME‑TIFF (Bio-formats) images as a single object.
88
- **Interoperability:** plays nicely with image classes across R/Bioconductor, such as **EBImage** or **magick**.
9-
- **Delayed operations:** rotate/flip/flop/negate, cropping and slicing – performed lazily (without loading to memory) via `DelayedArray`.
9+
- **Delayed operations:** rotate/flip/flop/negate, cropping and slicing – performed lazily (without loading in memory) via `DelayedArray`.
1010
- **Backends:** HDF5 and Zarr on‑disk storage using **HDF5Array** and **Rarr** packages.
1111

1212
## What are image pyramids?
@@ -102,7 +102,7 @@ Level 2 (256,384)
102102
```
103103

104104
We can crop or slice images via lazy/delayed indexing again without loading the
105-
image to the memory.
105+
image in the memory.
106106

107107
```r
108108
# crop or slice via indexing

vignettes/ImageArray.Rmd

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ library(shiny)
2626

2727
The `r Biocpkg("ImageArray")` package provides a **unified, memory-efficient**
2828
framework for working with both **pyramidal** and **non-pyramidal** images in R
29-
by leveraging the `r Biocpkg("DelayedArray")` infrastructure. With
30-
`r Biocpkg("ImageArray")` you can store large images on disk (HDF5 or Zarr),
29+
by leveraging the `r Biocpkg("DelayedArray")` package. With
30+
`r Biocpkg("ImageArray")` you can store large images on disk (as HDF5 or Zarr),
3131
treat them as array-like objects, perform delayed/lazy operations (e.g.,
3232
rotate, flip, crop) across all pyramid levels, and seamlessly integrate with
33-
standard R image workflows.
33+
other R package and workflows that use large bioimages.
3434

3535
# Installation
3636

@@ -45,8 +45,8 @@ BiocManager::install("ImageArray")
4545

4646
# Why pyramidal images?
4747

48-
Image pyramids are multi-resolution representations: starting from a full
49-
resolution image, you generate a series of down-sampled versions (e.g., half
48+
Image pyramids are multi-resolution representations that start with a full
49+
resolution image followed by a series of down-sampled levels (e.g., half
5050
resolutions). These are common in microscopy, digital pathology and large-scale
5151
imaging because:
5252

@@ -57,9 +57,9 @@ doing overview tasks, fine levels for detail).
5757
- Storing data in a pyramidal stack often reduces memory footprint and
5858
enables on-disk processing.
5959

60-
In our context, an ImageArray object may contain **multiple series**
61-
(each a resolution level) internally, and most operations are applied
62-
lazily across all series.
60+
In our context, an `r Biocpkg("ImageArray")` object typically contain
61+
**multiple levels** (each a resolution level) internally, and most operations
62+
are applied lazily (or delayed) across all levels.
6363

6464
# Usage
6565

@@ -90,7 +90,7 @@ imgarray <- writeImageArray(img,
9090
imgarray
9191
```
9292

93-
Each level of a pyramid can be rasterized at any time.
93+
Each level of a pyramid can be rasterized at any time, and thus plotted.
9494

9595
```{r visualize_read}
9696
# visualize
@@ -99,13 +99,18 @@ plot(bfa.raster)
9999
```
100100

101101
However, the true functionality of `r Biocpkg("ImageArray")` is to pick
102-
pyramid levels in a memory-efficient level. Thus, packages and applications
103-
that use `r Biocpkg("ImageArray")` can rasterize images by defining thresholds
104-
for the pixel dimensions of the levels that are realized to the memory.
102+
pyramid levels in a memory-efficient manner. Packages, applications and
103+
workflows that use `r Biocpkg("ImageArray")` can rasterize images by defining
104+
thresholds for pixel dimensions across all levels.
105105

106106
Here, by using the `max.pixel.size`, we request `r Biocpkg("ImageArray")` to
107107
return a pyramid level whose both width (`X`) and height (`Y`) are lower than,
108-
for example, 400.
108+
for example, 400. This approach is particularly useful when visualizing:
109+
110+
- (i) the entire image
111+
- (ii) a subset of the image with higher resolution
112+
113+
with minimal memory footprint.
109114

110115
```{r visualize_read2}
111116
# visualize
@@ -114,7 +119,7 @@ dim(bfa.raster)
114119
```
115120

116121
Operations such as rotate, flip, flop or negate will be
117-
conducted on all levels (without loading the image on the memory)
122+
conducted on all levels (without loading the image in the memory)
118123
which then can be rasterized and plotted.
119124

120125
```{r rotate}
@@ -158,6 +163,7 @@ imgarray <- writeImageArray(img,
158163
format = "HDF5ImageArray",
159164
output = output_h5,
160165
replace = TRUE)
166+
imgarray
161167
162168
# plot
163169
bfa.raster <- as.raster(imgarray, level = 2)
@@ -166,28 +172,31 @@ plot(bfa.raster)
166172

167173
## OME.TIFF (Bio-Formats) images
168174

169-
You can create `ImageArray` objects from OME-TIFF files (or image formats that
170-
are compatible with Bio-formats, see `r Biocpkg("RBioFormats")`) with
171-
already defined layers.
175+
You can create `ImageArray` objects from OME-TIFF files (or any file compatible
176+
with Bio-formats, see `r Biocpkg("RBioFormats")`) with already defined layers.
172177

173178
```{r ometiff}
174179
ome.tiff.file <- system.file("extdata", "xy_12bit__plant.ome.tiff",
175180
package = "ImageArray")
176-
RBioFormats::read.metadata(ome.tiff.file)
181+
read.metadata(ome.tiff.file)
177182
178183
# define ImageArray object
179184
imgarray <- createImageArray(ome.tiff.file, series = 1, resolution = 1:2)
180185
imgarray
181186
```
182187

183188
You can again use either `max.pixel.size` or `min.pixel.size` to control
184-
the output or level.
189+
the size of the image that loaded into the memory.
185190

186191
```{r ometiffvis2, out.width="50%"}
187192
bfa.raster <- as.raster(imgarray, max.pixel.size = 300)
188193
plot(bfa.raster)
189194
dim(bfa.raster)
190195
196+
bfa.raster <- as.raster(imgarray, min.pixel.size = 300)
197+
plot(bfa.raster)
198+
dim(bfa.raster)
199+
191200
bfa.raster <- as.raster(imgarray, level = 1)
192201
plot(bfa.raster)
193202
dim(bfa.raster)
@@ -227,9 +236,10 @@ imgarray
227236
```
228237

229238
You can visualize subsets of large images really quickly using `crop` and
230-
`as.raster`. Again, here we use `max.pixel.size` to regularize the resolution
239+
`as.raster`. Again, here we use `max.pixel.size` to optimize the level
231240
parsed from the pyramid; that is, as defined below, only resolutions whose
232-
width and height are both under size 800 would be returned.
241+
width and height are both under size 800 would be returned, whether it is
242+
the entire image, or a subset.
233243

234244
```{r speedy_vis, out.width="70%"}
235245
# crop image
@@ -251,13 +261,14 @@ ggplot2::ggplot(data.frame(x = 0, y = 0),
251261

252262
## Interactive Shiny Applications
253263

254-
Now let us create a shiny application where we can interactively define
255-
subsetting and visualize the OME-TIFF image quickly.
264+
Now let us create a shiny application where we can interactively
265+
subset and visualize the OME-TIFF image quickly.
266+
267+
The Shiny application lets the user to define image subsets (or slices)
268+
before visualizing without loading large images in memory.
256269

257-
The Shiny application will react quickly to regardless of the size of the
258-
image subset. This is because `as.raster` determines the layer that has the
259-
highest resolution without exceeding the threshold (`max.pixel.size`)
260-
automatically.
270+
This is because `as.raster` determines the layer with the pixel dimensions of
271+
he specified subset not exceeding the defined threshold (`max.pixel.size`).
261272

262273
```{r speedy_vis_shiny}
263274
if(interactive()){

0 commit comments

Comments
 (0)