[BioC] EBImage: Negative pixel intensities?!?

Wolfgang Huber whuber at embl.de
Tue Mar 6 22:06:38 CET 2012


Hi Henrik

you are right; the software (and documentation) is intentionally 
non-prescriptive about the range of the values in the images, to allow 
for flexibility. Restrictions may be imposed on the level of specific 
functions, e.g. by 'display'.

The behaviour of EBImage's display depends on the behaviour of the 
external library function that it calls, and this can either be from 
GTK+ or ImageMagick. The GTK+ code seems to do something like 
function(x) ifelse(x<0, 0, ifelse(x>1, 1, x)), see the below code example.

	Best wishes
	Wolfgang

library("EBImage")

x = seq(0, 2*pi, length=300)
y = seq(-1, 2, length=length(x))
img = Image(outer(x, y, function(x, y) sin(x)*y))
display(img)
display(abs(img))
display(img-10)
display(img*10)


sessionInfo()
R Under development (unstable) (2012-03-06 r58616)
Platform: x86_64-apple-darwin10.8.0/x86_64 (64-bit)

locale:
[1] C/UTF-8/C/C/C/C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] EBImage_3.11.2 abind_1.4-0    fortunes_1.4-2

loaded via a namespace (and not attached):
[1] tools_2.16.0



Mar/6/12 5:42 PM, Henrik Bengtsson scripsit::
> [Package maintainer cc:ed]
>
> Hi,
>
> in EBImage (3.11.2), an Image object can take intensities outside
> [0,1] including negative ones.  What are they/how are they mapped when
> rendered?  Here are some examples adopted from example("Image") and
> example("readImage"):
>
> # (a) Image object with intensities in [0,1]
>> x<- readImage(system.file("images", "lena-color.png", package="EBImage"));
>> range(x)
> [1] 0.01176471 1.00000000
>
> # (b) Image object with intensities in [0,1]
>> y<- readImage(system.file('images', 'nuclei.tif', package='EBImage'))
>> range(y)
> [1] 0 1
>
> # (c) Image object with large negative and positive intensities
>> z<- Image(rnorm(300*300*3),dim=c(300,300,3), colormode='Color')
>> range(z)
> [1] -4.661843  4.353772
>
> All three Image:s can be displayed using display().
>
> I assume the colors in 'z' are rescaled/renormalized to (R,G,B) \in
> [0,1]x[0,1]x[0,1], but how?
>
> BTW, I went through the EBImage docs, but I cannot find any
> information on what range the intensities should have.  I only
> inferred from the examples that [0,1] seems to be the scale, but the
> above 'z' puzzles me.
>
> Thanks,
>
> Henrik
>
>> library(EBImage)
> Loading required package: abind
> Warning message:
> package 'EBImage' was built under R version 2.15.0
>> sessionInfo()
> R version 2.14.2 Patched (2012-02-29 r58590)
> Platform: x86_64-pc-mingw32/x64 (64-bit)
>
> 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_3.11.2 abind_1.4-0
>
> _______________________________________________
> 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


-- 
Best wishes
	Wolfgang

Wolfgang Huber
EMBL
http://www.embl.de/research/units/genome_biology/huber



More information about the Bioconductor mailing list