Description Usage Arguments Details Value Examples
A simple wrapper passing project specific setings to \pckgLeafArea and ImageJ.
1 2 | helper.leafarea(set.directory, trim.pixel = 0, check.image = F,
distance.pixel = 1, known.distance = 1, path.imagej = NULL)
|
set.directory |
Set directory that contains leaf images. |
trim.pixel |
Number of pixels removed from edges in the analysis. |
check.image |
Do you want imageJ to open and show you the analysis of each image? |
distance.pixel |
The number of pixels for the 'known.distance' |
known.distance |
The distance for which 'distance.pixel' is known |
path.imagej |
The path where the imageJ executable is found. For Linux this must be stated. |
If ImageJ is installed in one of the default directories, you do not have to specify the path to ImageJ.
/Applications/ImageJ/ <Mac>
C:\Program Files\ImageJ\ <Windows>
If the OS is Linux you do need to specify the path to ImageJ.
For example, path = "~/ImageJ/"
The number of pixels per a known distance should be supplied.
For an A4 sheet scanned at 150 dpi; 58.5 px/cm
Use the option check.image=T
to view the auto-thresholding and particle analyis results in the GUI of ImageJ.
The amount of 'cropping' of the edges of the image is set using trim.pixel
; a value of 250 is suitable for the FAST template. Probelmatic images can be manually cropped without changing the resolution, in which case trim should be adjusted accordingly.
Known bugs:
Sometimes the analysis gives errors if repeated in same session. Solution is to save results and start a new R session before re-running.
Some images cause errors. Check the resolution and dimensions of the images.
A dataframe with filename and calculated 'projected surface area of element' (m2)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # If using Linux define the path to the ImageJ executable,
# if not, comment out; Leaf Area should find it.
# Recommend downloading and extracting the standalone version,
# rather than using a package manager.
# set path (Linux)
path.imagej <- "~/ImageJ"
# set path to test images directory
# A4 scans at 150 dpi, 1 cm = 58.5 px
path.image <- file.path(system.file("images"
, package="FASTLeafArea"),"")
# run analysis on images using ImageJ
area <- helper.leafarea(set.directory=path.image, path.imagej=path.imagej
, trim.pixel=250, distance.pixel=58.5, known.distance=1
, check.image=F)
# write to file in working directory
write.csv(area, paste0(paste(attr(area,"standard.name")
, attr(area,"units"), sep="_", ".csv"))
, quote = T, na = "NA", row.names = F)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.