Open alfonsosaera opened 9 months ago
Hi Alfonso @alfonsosaera,
thanks for notifying us about this, but it seems related to the magick library, which seems to have a caching limit on the images it loads. And we depend on magick for the image loading in the class.
How big is your image? (WxH and in Mb/Gb?)
Reference topic from the internet: https://processwire.com/talk/topic/25280-width-or-height-exceeds-limit-in-openpixelcache3911/
Thanks for the answer @drighelli
The image is prety big, 2GB (20045 x 18433). Is it possible to increase the limit of the magick library?
Thanks
I really don't know, but maybe this stack overflow thread could help
https://unix.stackexchange.com/questions/329530/increasing-imagemagick-memory-disk-limits
Thanks again for your reply.
I followed the suggestion in the answer of the stackexchange post and modified the limits of the policy.xml file.
$ identify -list resource
Resource limits:
Width: 25KP
Height: 25KP
List length: unlimited
Area: 800MP
Memory: 4GiB
Map: 8GiB
Disk: 4GiB
File: 768
Thread: 80
Throttle: 0
Time: unlimited
However I still get an error when I try to add the image. The error is the wether I try to load the image in Rstudio or in the R terminal. However it is not the same error as before.
Error: rsession: cache resources exhausted `' @ error/cache.c/OpenPixelCache/4095
Now seems to talk about cache but the limits seem enough for me.
I guess it is not an R related issue since I can load the image perfectly using the tiff package.
> library(tiff)
> image <- readTIFF(img.file) # same img.file as in addImg
Any advide is highly appreciated.
Here my session info (before using tiff package)
> sessionInfo()
R version 4.2.2 Patched (2022-11-10 r83330)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.1 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats4 stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggspavis_1.4.0 ggplot2_3.4.4 SpatialExperiment_1.8.1 SingleCellExperiment_1.20.1 SummarizedExperiment_1.28.0 Biobase_2.58.0
[7] GenomicRanges_1.50.2 GenomeInfoDb_1.34.9 IRanges_2.32.0 S4Vectors_0.36.2 BiocGenerics_0.44.0 MatrixGenerics_1.10.0
[13] matrixStats_1.0.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.11 locfit_1.5-9.8 lattice_0.22-5 digest_0.6.33 utf8_1.2.4 R6_2.5.1
[7] evaluate_0.22 pillar_1.9.0 sparseMatrixStats_1.10.0 zlibbioc_1.44.0 rlang_1.1.2 rstudioapi_0.15.0
[13] magick_2.8.1 R.utils_2.12.2 R.oo_1.25.0 Matrix_1.6-1.1 rmarkdown_2.25 BiocParallel_1.32.6
[19] RCurl_1.98-1.12 munsell_0.5.0 beachmat_2.14.2 ggside_0.2.2 DelayedArray_0.24.0 HDF5Array_1.26.0
[25] compiler_4.2.2 xfun_0.40 DropletUtils_1.18.1 pkgconfig_2.0.3 htmltools_0.5.6.1 tidyselect_1.2.0
[31] tibble_3.2.1 GenomeInfoDbData_1.2.9 edgeR_3.40.2 codetools_0.2-19 fansi_1.0.5 withr_2.5.2
[37] dplyr_1.1.4 rhdf5filters_1.10.1 bitops_1.0-7 R.methodsS3_1.8.2 grid_4.2.2 gtable_0.3.4
[43] lifecycle_1.0.4 magrittr_2.0.3 scales_1.2.1 dqrng_0.3.1 cli_3.6.1 scuttle_1.8.4
[49] XVector_0.38.0 limma_3.54.2 generics_0.1.3 DelayedMatrixStats_1.20.0 vctrs_0.6.4 Rhdf5lib_1.20.0
[55] rjson_0.2.21 tools_4.2.2 glue_1.6.2 parallel_4.2.2 fastmap_1.1.1 yaml_2.3.7
[61] colorspace_2.1-0 rhdf5_2.42.1 knitr_1.44
I don't know what else to suggest...
Have you also tried to restart your computer after setting the new limits?
This could be a runtime loading at the system start.
Thanks again for your response, @drighelli.
I am working on a shared server, so restarting is not as straightforward. What I did was reconnecting to the server via SSH and starting a new RStudio session.
In any case, I assume the system 'knows' about the settings change, as I can see them when running identify -list resource
.
I hope someone has an idea on how to solve this.
maybe you can also try to open an issue or write to the imagemagick authors
Hi,
I am trying to add a high resolution image to my spe object as follows
but I get this error
Thanks for your help!
Alfonso