[BioC] EBImage Error in .Call("lib_readImages", as.character(files), as.integer(colormode),
Vladimir Morozov
vmorozov at als.net
Thu Apr 7 18:50:21 CEST 2011
Henrik,
I think you make the right guess.
Anyway the tiff file is
0500101820.0.tif - https://docs.google.com/leaf?id=0B2NLCeM3RRN2ODIxYWVmZjItYzYwNS00YjJjLWE2YjQtYjQwZGUzZTJkOTBi&hl=en
Thanks,
Vlad
-----Original Message-----
From: henrik.bengtsson at gmail.com [mailto:henrik.bengtsson at gmail.com] On Behalf Of Henrik Bengtsson
Sent: Thursday, April 07, 2011 12:46 PM
To: Vladimir Morozov
Cc: Gregoire Pau; bioconductor at stat.math.ethz.ch
Subject: Re: [BioC] EBImage Error in .Call("lib_readImages", as.character(files), as.integer(colormode),
A guess: Your image dimension might be too large. In R, matrices/arrays are stored as vectors with a dimension attribute meaning the number of elements is limited by prod(dim(x)) for an array 'x', not max(dim(x)). Since indices are 32-bit integers in R, you may be hitting the maximum limit:
> .Machine$integer.max
[1] 2147483647
# For your small image that works
> dim <- c(26352,10344,3)
> prod(dim)
[1] 817755264
> (prod(dim) <= .Machine$integer.max)
[1] TRUE
# For the 90/50=1.8 times larger one
> dim <- 1.8*c(26352,10344,3)
> prod(dim)
[1] 4769148700
> (prod(dim) <= .Machine$integer.max)
[1] FALSE
/Henrik
On Thu, Apr 7, 2011 at 9:23 AM, Vladimir Morozov <vmorozov at als.net> wrote:
> Hi Gregory,
>
> It dosen't seem to be multiple version problem:
>
> [rstats:ImageAnal] ldd
> /usr/local/lib64/R/library/EBImage/libs/EBImage.so|grep -i magic
> libMagickCore.so.3 => /usr/lib64/libMagickCore.so.3
> (0x00007f264092f000)
> libMagickWand.so.3 => /usr/lib64/libMagickWand.so.3
> (0x00007f263e62c000) [rstats:ImageAnal] which convert /usr/bin/convert
> [rstats:ImageAnal] ldd /usr/bin/convert
> linux-vdso.so.1 => (0x00007fff09bff000)
> libMagickCore.so.3 => /usr/lib64/libMagickCore.so.3
> (0x00007fdad3f45000)
> libMagickWand.so.3 => /usr/lib64/libMagickWand.so.3
> (0x00007fdad3c26000)
> ....
>
>
> I can resize the tiff image with ImageMagic:
> convert -channel B -resize '50%'
> /data/projects/ImageAnal/tiff/0500101820.0.tif
> /data/projects/ImageAnal/tiff/0500101820.05.png
> And then get it into R :
>> x <- readImage('/data/projects/ImageAnal/tiff/0500101820.05.png')
>> dim(x)
> [1] 26352 10344 3
>
> However bigger resolution images fail:
> convert -channel B -resize '90%'
> /data/projects/ImageAnal/tiff/0500101820.0.tif
> /data/projects/ImageAnal/tiff/0500101820.09.png
>
>> x <- readImage('/data/projects/ImageAnal/tiff/0500101820.09.png')
> Error in .Call("lib_readImages", as.character(files), as.integer(colormode), :
> negative length vectors are not allowed
>
> So it doesn't look as ImageMagic problem. If you still want the tiff
> file, I can post it
>
> Best
> Vlad
>
>
>
>
>
> -----Original Message-----
> From: Gregoire Pau [mailto:gregoire.pau at embl.de]
> Sent: Thursday, April 07, 2011 11:53 AM
> To: Vladimir Morozov
> Cc: 'bioconductor at stat.math.ethz.ch'
> Subject: Re: [BioC] EBImage Error in .Call("lib_readImages",
> as.character(files), as.integer(colormode),
>
> Hello Vladimir,
>
> If ImageMagick is able to read the image, EBImage should be able to do so. Do you have several installed versions of ImageMagick ? To which ImageMagick version EBImage is linked to (try otool or ldd on EBImage.so or EBImage.dll) ?
>
> TIFF is a not a file format but a file container which can contain exotic formats: could you please send me your image for inspection ?
>
> Cheers,
>
> Greg
> ---
> Gregoire Pau
> EMBL Research Officer
> http://www.embl.de/~gpau/
>
> On 07/04/11 16:48, Vladimir Morozov wrote:
>> Hi,
>>
>> I get image reading error:
>>
>>> x<- readImage(
>>
>> "/data/projects/ImageAnal/tiff/0500101820.0.tif"
>>
>> )
>>
>> Error in .Call("lib_readImages", as.character(files), as.integer(colormode), :
>>
>> negative length vectors are not allowed
>>
>>> packageVersion('EBImage')
>>
>> [1] '3.6.0'
>>
>>>
>>
>> ImageMagic can work with this image:
>>
>> convert -channel B -resize '70%'
>> /data/projects/ImageAnal/tiff/0500101820.0.tif
>> /data/projects/ImageAnal/tiff/0500101820.07.jpeg&
>>
>>
>>
>> Tthis image is the bigest image from SVS stack:
>>
>> convert /data/projects/ImageAnal/svs/0500101820.svs
>> /data/projects/ImageAnal/tiff/0500101820.%d.tif
>>
>> [rstats:ImageAnal] ll -h /data/projects/ImageAnal/tiff/0500101820.*
>> -rw-r--r-- 1 vmorozov users 24K 2011-04-06 15:18
>> /data/projects/ImageAnal/tiff/0500101820.1.tif
>> -rw-r--r-- 1 vmorozov users 81M 2011-04-06 15:18
>> /data/projects/ImageAnal/tiff/0500101820.0.tif
>> -rw-r--r-- 1 vmorozov users 155K 2011-04-06 15:18
>> /data/projects/ImageAnal/tiff/0500101820.5.tif
>> -rw-r--r-- 1 vmorozov users 49K 2011-04-06 15:18
>> /data/projects/ImageAnal/tiff/0500101820.4.tif
>> -rw-r--r-- 1 vmorozov users 196K 2011-04-06 15:18
>> /data/projects/ImageAnal/tiff/0500101820.3.tif
>> -rw-r--r-- 1 vmorozov users 3.0M 2011-04-06 15:18
>> /data/projects/ImageAnal/tiff/0500101820.2.tif
>> [rstats:ImageAnal] convert -v
>> Version: ImageMagick 6.6.1-0 2010-07-29 Q16
>> http://www.imagemagick.org
>> Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
>> Features: OpenMP
>> .....
>>
>>
>>
>> I have the same problem with other SVS stacks, i.e readImage fails to
>> read the most quality images. it works fine on smaller images
>>
>>
>>
>> Any suggestions would be apriciated
>>
>> Thanks
>>
>>
>>
>> Vladimir Morozov
>> Sr. Computational Biologist
>> ALS Therapy Development Institute
>> 215 First Street, Cambridge MA, 02142 www.als.net<http://www.als.net>
>> Help End ALS! Click Here<http://als.net/EndALS.aspx> or Text "EndALS" to 20222 to make a $5 donation towards research.
>>
>>
>>
>> *********************************************************************
>> *
>> ***************** The information contained in this electronic
>> message is ...{{dropped:21}}
>>
>> _______________________________________________
>> Bioconductor mailing list
>> Bioconductor at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>> Search the archives:
>> http://news.gmane.org/gmane.science.biology.informatics.conductor
>
>
> **********************************************************************
> ***************** The information contained in this electronic message
> is ...{{dropped:18}}
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>
***************************************************************************************
The information contained in this electronic message is ...{{dropped:18}}
More information about the Bioconductor
mailing list