Question: EBImage / problem in running the code via Rscript
0
gravatar for kevin.nagel
2.6 years ago by
kevin.nagel0 wrote:

Hello,

 

I have tested the following lines of codes in an R interactive session (linux box) successfully

 

library(EBImage)

library(dplyr)

i = readImage("tmp.png")

r = as.vector(channel(i, 'red'))

g = as.vector(channel(i, 'green'))

b = as.vector(channel(i, 'blue'))

. = rgb2hsv(r, g, b) %>% t %>% as.data.frame %>% mutate(dgci=(((h-0.1666667)/0.1666667) + (1-s) + (1-v))/3)

 

But when I use the code in my test.R script I get an error with Rscript:

 

Rscript   test.R

Error in asub.default(x, i, 3) : could not find function "Quote"
Calls: channel -> selectChannel -> asub -> asub.default
Execution halted

 

 

The problem seems to be

 

channel(i, 'red')

 

Can someone explain, and give me an alternate solution to get this run?

 

Thanks

Kevin

 

 

ebimage image processing • 490 views
ADD COMMENTlink modified 2.6 years ago by Martin Morgan ♦♦ 23k • written 2.6 years ago by kevin.nagel0
Answer: EBImage / problem in running the code via Rscript
0
gravatar for Martin Morgan
2.6 years ago by
Martin Morgan ♦♦ 23k
United States
Martin Morgan ♦♦ 23k wrote:

I think a work-around is to add 

library(methods)

to your script. What is the output of sessionInfo() ?

ADD COMMENTlink written 2.6 years ago by Martin Morgan ♦♦ 23k

Thanks Martin, I basically came to similar conclusions.

I was wondering what would be the best way of fixing this on our side. The problem seems to be related to the fact that methods package needs to be attached in order to manipulate S4 objects by abind, as running the following in Rscript also fails.

arraySubclass <- methods::setClass ("arraySubclass", contains = "array")
x <- methods::new("arraySubclass", array(0, c(3,3,3)))

abind::asub(x, 1, 3)

Error in eval(expr, envir, enclos) : could not find function "getGeneric"
Calls: <Anonymous> -> asub.default -> eval -> eval
Execution halted

Adding import("methods") to abind's NAMESPACE seems to fix the issue. Should this be communicated to the maintainer? I think the only other way of fixing this for EBImage would be to add Depends: methods to DESCRIPTION.

 

ADD REPLYlink modified 2.6 years ago • written 2.6 years ago by Andrzej Oleś720

Yes it seems like an upstream issue and the abind maintainer should fix it, rather than trying to come up with work-arounds down-stream.

ADD REPLYlink written 2.6 years ago by Martin Morgan ♦♦ 23k
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: 189 users visited in the last hour