[BioC] EBImage: alpha plane in grey scale

Samuel GRANJEAUD - IR/ICIM granjeau at tagc.univ-mrs.fr
Fri Feb 25 19:37:06 CET 2011


Hello,

I am using EBImage to convert matrix to tiff grey scale. And I would 
like to read them directly in ImageJ. Unfortunately such image contains 
an extra plane that is not needed and not supported by ImageJ. This 
alpha plane seems to be automatically added at the creation of the image 
in the C code (I guess). In ImageMagick API, this is referred as "matte" 
http://www.imagemagick.org/api/magick-image.php#MagickSetImageMatte

If I am not wrong, it would be nice if this alpha plane could be removed 
in next release.

Regards,
Samuel

~$ R --vanilla

R version 2.12.1 (2010-12-16)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

 > library(EBImage)
Loading required package: abind
 > a <- matrix(10,20,20)
 > b <- Image(a)
 > b
Image
  colormode: Grayscale
  storage.mode: double
  dim: 20 20
  nb.total.frames: 1
  nb.render.frames: 1

imageData(object)[1:5,1:6]:
     [,1] [,2] [,3] [,4] [,5] [,6]
[1,]   10   10   10   10   10   10
[2,]   10   10   10   10   10   10
[3,]   10   10   10   10   10   10
[4,]   10   10   10   10   10   10
[5,]   10   10   10   10   10   10

 > writeImage(b,"b.tif")
 > system("tiffinfo b.tif")
TIFF Directory at offset 0x6c (108)
  Image Width: 20 Image Length: 20
  Resolution: 72, 72 pixels/inch
  Bits/Sample: 1
  Compression Scheme: None
  Photometric Interpretation: min-is-black
  Extra Samples: 1<unassoc-alpha>
  FillOrder: msb-to-lsb
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 2
  Rows/Strip: 1638
  Planar Configuration: single image plane
  DocumentName: b.tif
  Software: ImageMagick 6.3.7 12/02/10 Q16 http://www.imagemagick.org
 > system("convert b.tif +matte c.tif")
 > system("tiffinfo c.tif")
TIFF Directory at offset 0x44 (68)
  Image Width: 20 Image Length: 20
  Resolution: 72, 72 pixels/inch
  Bits/Sample: 1
  Compression Scheme: None
  Photometric Interpretation: min-is-black
  FillOrder: msb-to-lsb
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 1
  Rows/Strip: 2730
  Planar Configuration: single image plane
  DocumentName: c.tif
  Software: ImageMagick 6.3.7 12/02/10 Q16 http://www.imagemagick.org
 > sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_GB.utf8       LC_NUMERIC=C            
 [3] LC_TIME=en_GB.utf8        LC_COLLATE=en_GB.utf8   
 [5] LC_MONETARY=C             LC_MESSAGES=en_GB.utf8  
 [7] LC_PAPER=en_GB.utf8       LC_NAME=C               
 [9] LC_ADDRESS=C              LC_TELEPHONE=C          
[11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C     

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

other attached packages:
[1] EBImage_3.6.0 abind_1.1-0



More information about the Bioconductor mailing list