Skip to content

Commit 4b0ecd2

Browse files
committed
small changes to documentation
1 parent 601d171 commit 4b0ecd2

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,20 @@ plot(imgraster)
7171

7272
<br>
7373

74+
By using the `max.pixel.size`, we can request `r Biocpkg("ImageArray")` to
75+
return a pyramid level whose both width (`X`) and height (`Y`) are lower than
76+
some pixel size, e.g. 400.
77+
78+
```{r visualize_read2}
79+
# visualize
80+
bfa.raster <- as.raster(imgarray, max.pixel.size = 400)
81+
dim(bfa.raster)
82+
```
83+
84+
```
85+
(256,384)
86+
```
87+
7488
A number of memory-efficient (delayed or lazy) operations are available
7589
for pyramid images, including rotation (0, 90, 180, 270), horizontal or
7690
vertical flipping and negation.

vignettes/ImageArray.Rmd

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ that use `r Biocpkg("ImageArray")` can rasterize images by defining thresholds
104104
for the pixel dimensions of the levels that are realized to the memory.
105105

106106
Here, by using the `max.pixel.size`, we request `r Biocpkg("ImageArray")` to
107-
return a pyramid level whose both width (`X`) and height (`Y`) are lower than
108-
300.
107+
return a pyramid level whose both width (`X`) and height (`Y`) are lower than,
108+
for example, 400.
109109

110110
```{r visualize_read2}
111111
# visualize
112-
bfa.raster <- as.raster(imgarray, max.pixel.size = 300)
112+
bfa.raster <- as.raster(imgarray, max.pixel.size = 400)
113113
dim(bfa.raster)
114114
```
115115

@@ -122,7 +122,7 @@ imgarray_rotated <- rotate(imgarray, degrees = 90)
122122
imgarray_rotated
123123
124124
# visualize
125-
bfa.raster <- as.raster(imgarray_rotated, max.pixel.size = 300)
125+
bfa.raster <- as.raster(imgarray_rotated, max.pixel.size = 400)
126126
plot(bfa.raster)
127127
```
128128

@@ -133,15 +133,11 @@ imgarray_cropped <- imgarray[300:500, 200:300]
133133
imgarray_cropped
134134
135135
# visualize
136-
bfa.raster <- as.raster(imgarray_cropped, max.pixel.size = 300)
136+
bfa.raster <- as.raster(imgarray_cropped, max.pixel.size = 120)
137137
plot(bfa.raster)
138138
139139
imgarray_cropped <- crop(imgarray, ind = list(300:500, 200:300))
140140
imgarray_cropped
141-
142-
# visualize
143-
bfa.raster <- as.raster(imgarray_cropped, max.pixel.size = 300)
144-
plot(bfa.raster)
145141
```
146142

147143
## magick images
@@ -188,11 +184,11 @@ You can again use either `max.pixel.size` or `min.pixel.size` to control
188184
the output or level.
189185

190186
```{r ometiffvis2, out.width="50%"}
191-
bfa.raster <- as.raster(img, max.pixel.size = 300)
187+
bfa.raster <- as.raster(imgarray, max.pixel.size = 300)
192188
plot(bfa.raster)
193189
dim(bfa.raster)
194190
195-
bfa.raster <- as.raster(img, level = 1)
191+
bfa.raster <- as.raster(imgarray, level = 1)
196192
plot(bfa.raster)
197193
dim(bfa.raster)
198194
```
@@ -241,6 +237,7 @@ imgarray_sub <- crop(imgarray, ind = list(16000:19000, 7000:10000))
241237
242238
# convert to raster
243239
img_raster <- as.raster(imgarray_sub, max.pixel.size = 800)
240+
dim(img_raster)
244241
245242
# plot with ggplot
246243
ggplot2::ggplot(data.frame(x = 0, y = 0),

0 commit comments

Comments
 (0)