Question: Bug Report for R Package "EBImage": log(image, base=2) is same as log(*) (natural log) instead of log2 (base 2).
2
gravatar for feimingc
3.4 years ago by
feimingc20
United States
feimingc20 wrote:

Following code shows that "log(imageData, base=2)" is broken.  Could it be fixed?  Thanks!!

 

> library(EBImage)

> image.data
Image 
  colorMode    : Grayscale 
  storage.mode : double 
  dim          : 28 380 
  frames.total : 1 
  frames.render: 1 

imageData(object)[1:5,1:6]
     [,1] [,2] [,3] [,4] [,5] [,6]
[1,]  187  186  188  192  185  185
[2,]  184  181  183  190  186  190
[3,]  184  189  183  179  186  180
[4,]  186  186  185  187  187  186
[5,]  184  185  186  196  179  182

> log(image.data, base=2)
Image 
  colorMode    : Grayscale 
  storage.mode : double 
  dim          : 28 380 
  frames.total : 1 
  frames.render: 1 

imageData(object)[1:5,1:6]
       [,1]   [,2]   [,3]   [,4]   [,5]   [,6]
[1,] 5.2311 5.2257 5.2364 5.2575 5.2204 5.2204
[2,] 5.2149 5.1985 5.2095 5.2470 5.2257 5.2470
[3,] 5.2149 5.2417 5.2095 5.1874 5.2257 5.1930
[4,] 5.2257 5.2257 5.2204 5.2311 5.2311 5.2257
[5,] 5.2149 5.2204 5.2257 5.2781 5.1874 5.2040

> log2(image.data)
Image 
  colorMode    : Grayscale 
  storage.mode : double 
  dim          : 28 380 
  frames.total : 1 
  frames.render: 1 

imageData(object)[1:5,1:6]
       [,1]   [,2]   [,3]   [,4]   [,5]   [,6]
[1,] 7.5469 7.5392 7.5546 7.5850 7.5314 7.5314
[2,] 7.5236 7.4998 7.5157 7.5699 7.5392 7.5699
[3,] 7.5236 7.5622 7.5157 7.4838 7.5392 7.4919
[4,] 7.5392 7.5392 7.5314 7.5469 7.5469 7.5392
[5,] 7.5236 7.5314 7.5392 7.6147 7.4838 7.5078

> save(image.data, file="image.data.RData")

> log(187)
[1] 5.2311
> log(187, base=2)
[1] 7.5469
> log2(187)
[1] 7.5469

> library(help=EBImage)

        Information on package ‘EBImage’

Description:

Package:       EBImage
Version:       4.8.3
Title:         Image processing and analysis toolbox for R
Author:        Andrzej Oles, Gregoire Pau, Mike Smith, Oleg Sklyar, Wolfgang Huber, with contributions from Joseph Barry and Philip A. Marais
Maintainer:    Andrzej Oles <andrzej.oles@embl.de>
Depends:       
Imports:       BiocGenerics (>= 0.7.1), methods, graphics, grDevices, stats, abind, tiff, jpeg, png, locfit
Suggests:      BiocStyle
Description:   EBImage is an R package which provides general purpose functionality for the reading, writing, processing and analysis of images.
               Furthermore, in the context of microscopy based cellular assays, EBImage offers tools to transform the images, segment cells and extract
               quantitative cellular descriptors.
License:       LGPL
LazyLoad:      true
biocViews:     Visualization
Packaged:      2015-03-24 00:38:44 UTC; biocbuild
Built:         R 3.1.1; i686-pc-linux-gnu; 2015-11-05 20:45:53 UTC; unix

ebimage bug • 474 views
ADD COMMENTlink modified 3.4 years ago by Andrzej Oleś720 • written 3.4 years ago by feimingc20
Answer: Bug Report for R Package "EBImage": log(image, base=2) is same as log(*) (natur
0
gravatar for Andrzej Oleś
3.4 years ago by
Andrzej Oleś720
Heidelberg, Germany
Andrzej Oleś720 wrote:

Thank you for reporting the issue!

The observed behaviour was caused by a missing definition of the log method for Image objects.  Unlike the rest of Math group generics, log has an extra formal argument which makes such specific definition necessary in order to capture the base argument.

This is now fixed in release, EBImage version 4.12.1.

Cheers,

Andrzej

ADD COMMENTlink modified 3.4 years ago • written 3.4 years ago by Andrzej Oleś720
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 205 users visited in the last hour