Last data update: 2014.03.03

R: Finding the average area in pixels for objects
pixAreaR Documentation

Finding the average area in pixels for objects

Description

Even not required, the average value area in pixels for the objects analyzed is a parameter of interest when the objects to be analyzed are particularly small such as seeds or extremely small fruits. Therefore, the use of this function provides a plot of the are in pixels for all the objects in the picture for a given cutoff value provided. Once the value has determined this can be provided to the scanCRAN function in the argument 'minArea' to make the function perform faster.

Usage

pixArea(folder, cutoffvalue = 0.5, cores = 1, square = 10, fact = 0.25)

Arguments

folder

A path where the pictures are located

cutoffvalue

A scalar value where the fruits are distinguishable from the background in the color scale handled by R which is 0-1

cores

A scalar value indicating the number of cores that you want to use for parallelizing the function

square

size of the square to brush smaller objects from the picture

fact

a scalar value between 0-1 indicating at what extent the picture should be reduced in size in order to make computations faster, by default the pictures are sized at the 25 percent of their original size. If no reduction is required the user should set the argument to 1.

Value

If parameters are indicated correctly the function returns:

$plot

a plot showing the size of different objects in the picture in number of pixels.

References

We have spent valuable time developing this package, please cite it in your publication:

Diaz-Garcia L, Covarrubias-Pazaran G, Schlautman B, Zalapa J. GiNA: A flexible high throughput phenotyping tool. http://horticulture.wisc.edu/cggl/ZalapaLab/People.html. 2015.

Examples

library(GiNA)
data(GINA.sample) # RUN
display(GINA.sample)
writeImage(GINA.sample, "gina_cran.JPG") # RUN
folder <- getwd() # RUN
area <- pixArea(folder,cutoffvalue=0.5,cores=1) # RUN!!!

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
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.

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(GiNA)
Loading required package: EBImage
Loading required package: png
Loading required package: parallel
Loading required package: doParallel
Loading required package: foreach
Loading required package: iterators
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GiNA/pixArea.Rd_%03d_medium.png", width=480, height=480)
> ### Name: pixArea
> ### Title: Finding the average area in pixels for objects
> ### Aliases: pixArea
> 
> ### ** Examples
> 
> library(GiNA)
> data(GINA.sample) # RUN
> display(GINA.sample)
> writeImage(GINA.sample, "gina_cran.JPG") # RUN
> folder <- getwd() # RUN
> area <- pixArea(folder,cutoffvalue=0.5,cores=1) # RUN!!!

You are using 1 core(s) out of 4 available

Minimum values were found at 52 pixels (see the plot). 

Please use an approximate value as a minimum area when using the scancran function.

> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>