It's running out of memory. In 32-bit R, only 3GB of memory in total can be allocated.
Perhaps the EBImage author can take a look at it and fix it.
In the meantime, can you run 64-bit R? It looks from your sessionInfo() like your computer is capable of running the 64-bit sub-architecture. So please try it, double click on the 64-bit R shortcut/icon, or from the command line, do:
R --arch x64
64-bit R should actually be the default R that's run on systems that are capable of it, not sure why that's not the case for you.
When I run readImage() on this file in 64-bit R on windows, it works fine.
Tried 64 bit, see session info below, same thing. I don't think it just runs out of memory, I don't get a nice error message as you did. Machine hangs to the point that I can't restart it using Ctrl-Alt-Del and have to physically turn it off. Can it be something with my EBImage installation?
Thank you
> sessionInfo()
R version 3.2.5 (2016-04-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] EBImage_4.12.2
loaded via a namespace (and not attached):
[1] parallel_3.2.5 fftwtools_0.9-7 abind_1.4-3
[4] jpeg_0.1-8 grid_3.2.5 locfit_1.5-9.1
[7] tiff_0.1-5 BiocGenerics_0.16.1 png_0.1-7
[10] lattice_0.20-33
I installed EBImage couple of weeks ago and had to upgrade R at this point. And actually I have Windows 7 with service pack 1, don't know if it matters.
I tried loading your image but could not reproduce the described behavior. I tried this on a Windows 7 x64 machine with 8GB RAM running R 3.2.5 with the same package versions installed as you are using. Things work fine under 64-bit R, while under 32-bit R I get the same error message as Dan.
How much memory does your machine have? You might be running out of memory, but even then this should result in an error message rather than an unresponsive system.
Once loaded into R, your image data takes up 1.1GB of RAM. This is also the size of the list returned by readTIFF which is called internally by readImage. However, before assigning this list to the data slot of the Image object some additional transformations are necessary: conversion into an array and transposition of the spatial dimensions. Unfortunately, these intermediate steps introduce temporary data copies increasing the total memory consumption. I'm not sure whether the memory footprint of readImage could be significantly improved, but even if, you will most probably run into similar issues as soon as you try to do some computations on the object.
To circumvent the problem, I suggest you either try running your script on a more powerful machine equipped with more memory, or subset the image stack. For example, have a look at RBioFormats (https://github.com/aoles/RBioFormats) which offers functionality to load a subset of frames from multi-frame images.
I have a similar problem under 32-bit R on windows:
> system.time({x = readImage("DAPI_Mask.tif", type="tif", all=TRUE)})
Error: cannot allocate vector of size 1.1 Gb
Timing stopped at: 4.79 0.63 5.46
It's running out of memory. In 32-bit R, only 3GB of memory in total can be allocated.
Perhaps the EBImage author can take a look at it and fix it.
In the meantime, can you run 64-bit R? It looks from your
sessionInfo()
like your computer is capable of running the 64-bit sub-architecture. So please try it, double click on the 64-bit R shortcut/icon, or from the command line, do:R --arch x64
64-bit R should actually be the default R that's run on systems that are capable of it, not sure why that's not the case for you.
When I run
readImage()
on this file in 64-bit R on windows, it works fine.Tried 64 bit, see session info below, same thing. I don't think it just runs out of memory, I don't get a nice error message as you did. Machine hangs to the point that I can't restart it using Ctrl-Alt-Del and have to physically turn it off. Can it be something with my EBImage installation?
Thank you
> sessionInfo()
R version 3.2.5 (2016-04-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] EBImage_4.12.2
loaded via a namespace (and not attached):
[1] parallel_3.2.5 fftwtools_0.9-7 abind_1.4-3
[4] jpeg_0.1-8 grid_3.2.5 locfit_1.5-9.1
[7] tiff_0.1-5 BiocGenerics_0.16.1 png_0.1-7
[10] lattice_0.20-33
I don't know. BTW, I was using R-3.3.0 and Bioconductor 3.3. So perhaps try upgrading?