Abstract
Measuring leaf area is essential to quantifying other leaf functional traits. This paper introduces a new R package, LeafArea, which allows one to conveniently run ImageJ (http://imagej.nih.gov/ij/) within R. The functions in this package analyze multiple scanned leaf images in the target directory, generate multiple output files containing the leaf area of each leaf image, and then process and combine these files into a single file in a format that is convenient for subsequent analyses. Leaf area data from multiple images from the same sample can be combined automatically. This function allows users to cut large leaves into several pieces during scanning. The package provides a user-friendly, automated tool for measuring leaf area from scanned images.
Similar content being viewed by others
Avoid common mistakes on your manuscript.
Introduction
Leaf functional traits have received considerable attention in efforts to characterize the functional differences among species in ecophysiology, community ecology and ecosystem ecology (Wright et al. 2004; McGill et al. 2005; Díaz et al. 2007). These traits include maximum rate of net photosynthesis, dark respiration rate, nitrogen content and phosphorus content, which are typically normalized by leaf area (or mass) to account for leaf size when comparing trait values (Osnas et al. 2013). Therefore, measuring leaf area is essential in quantifying other leaf functional traits.
Measuring leaf area from digital images captured by a scanner involves several steps: (1) processing leaf images to separate the leaf from the image background, (2) setting the scale using a known distance in the image, (3) estimating leaf area from leaf pixel counts and the calibration scale, (4) outputting the leaf area data of each image to data files, and (5) combining the estimated leaf area into a single data file in a format that is convenient for subsequent analyses. Image analysis software, such as ImageJ (National Institutes of Health, Bethesda, MD, USA), GIMP (GNU Image Manipulation Program, http://www.gimp.org) and Photoshop CS (Adobe Systems Incorporated, San José, CA, USA), provide a straightforward way of measuring leaf area from digital images. These software require manual interaction by the user, making the task labor intensive when there are many leaves. In recent community ecology studies, leaf area was measured in hundreds to thousands of samples (Kraft et al. 2008; Fortunel et al. 2012; Katabuchi et al. 2012). There are, however, several software packages that automate the extraction of leaves from the image background and the estimation of leaf area using leaf pixel counts (Bylesjö et al. 2008; Weight et al. 2008; Maloof et al. 2013; Varma and Osuri 2013). Nonetheless, these software cannot combine the leaf area data from several images of the same sample. This limitation prevents the automated processing of large leaves that must be cut into pieces small enough to be scanned by a portable scanner.
This paper introduces a new, open-source software package, LeafArea, which provides an automated method to calculate leaf area data from multiple scanned leaf images in R (R Core Team 2015), the preferred analytical environment for contemporary ecological research. LeafArea allows one to conveniently run ImageJ (http://imagej.nih.gov/ij/) within R; ImageJ is written in Java and thus runs on all computer platforms. The LeafArea package can be downloaded and installed from the Comprehensive R Archive Network, CRAN (http://cran.r-project.org/web/packages/LeafArea/index.html). A development version of LeafArea is also available on GitHub (https://github.com/mattocci27/LeafArea).
Description
The function analyzes multiple leaf images captured by a scanner at a fixed resolution from a target directory (Fig. 1). It returns the results in a single data frame, which is a convenient format for subsequent analysis. The workflow is as follows.
Image capture
Capture leaf images with a scanner and save them as jpeg or tiff files. Image resolution must be the same in all image files because the function estimates leaf area from pixel. The function does not support images from digital cameras in which the scale of images depends on the distance of the camera to the object. Some very thick leaves may cast shadows on the background, which affects the subsequent image analysis. For better results and especially to avoid errors due to leaf shadows on the background, users could scan thick petioles separately. Similarly, leaves with thick mid ribs could be cut and the mid rib processed separately.
The function combines the leaf area of all images that share the same filename prefix, which is defined as the part of the filename preceding the first hyphen (-) or period (.). For example, the areas of leaf images named A123-1.jpeg, A123-2.jpeg and A123-3.jpeg would be combined into the single total leaf area A123 (see Fig. 2). This feature allows the user to treat multiple images as belonging to a single sample. Note that the functions in the package do not count the number of leaves in each image. For example, when two large leaves from one individual (i.e., one sample) are cut into seven pieces and scanned in four images, if the user requires the number of leaves per image, the user must record these values.
Run the main function in R
Multiple leaf images captured by a scanner to a target directory can be analyzed (Fig. 1). To run the main function, the user needs to specify the path to the target directory. In this example, the function specifies the path to the leaf images in the R temporary directory, then, the function analyzes the leaf area(s):
The above command returns a single data frame object containing sample names in the first column and total leaf area (cm2) of the sample in the second column. To run the function, the path to the target directory that contains the leaf images must be specified. For example, when the target directory named “leaf data” is on the desktop in an Apple Macintosh or Linux system, the path can be specified by:
For Microsoft Windows, this would be:
There are several settings available, according to the leaf image format. When leaf images are captured in A4 image size at 100 ppi, the pixel density is approximately 826 pixels per 21 cm. In this case, the calibration scale can be specified by:
The analyzed images can be saved in the directory for error checking:
The above options can be specified in a single command:
There are other options available, displayed by the command in R, which are also summarized in Appendix S1.
When ImageJ is not installed in the common install directory, the path to ImageJ needs to be specified in ; this depends on the operating system being used (Windows, Linux and Mac are supported). For example, when ImageJ is installed in a directory named “ImageJ” on the desktop in Mac or Linux, the path can be specified by typing:
In Windows this would be:
Manual measurements by ImageJ (optional)
Users can skip this step if ImageJ succeeds in analyzing the leaf images. If ImageJ fails to recognize leaf images (Fig. S4), however, users can manually guide the image analysis for particular images through the ImageJ graphical user interface (see the ImageJ user guide, Ferreira and Rasband 2012). As long as the names of the output text files have the same prefixes as those of the image files (e.g., A123-1.txt, A123-2.txt, A123-3.txt), the results for these manually analyzed images will still be handled by the file management function . Multiple tab-delimited text files with a leaf area value (one text file per original JPEG image file) generated by ImageJ can be merged into a single data frame. For example, when the text files are on the desktop of a Mac, the files can be merged:
The above command returns a single data frame that contains sample names in the first column and total leaf area (cm2) of the sample in the second column. The option “prefix” is also available. See R command for a more detailed description.
Conclusions
The package LeafArea is a powerful tool to automate leaf area measurements of digital images, which will facilitate research involving leaf functional traits. It offers several novel contributions. First, unlike other leaf image analysis software, LeafArea is called within R, a flexible and open-source computing environment, which facilitates subsequent analyses. Second, the file management function that combines leaf area data across images of the same plant individual is useful for large leaves and compound leaves. Third, the image analysis function implemented in ImageJ is fast because it is written in Java, a compiled language. For example, can analyze 100 images in approximately 15 s (Mac 10.10.3, Intel Core i7 2 GHz and 8 GB RAM). One limitation is that ImageJ sometimes does not recognize leaves correctly. Nonetheless, the failure rate was very low in the tests performed when developing the automated system. All of the 100 images that were analyzed were successfully recognized by ImageJ (Fig. S5). The LeafArea package can greatly reduce the time and labor needed for leaf area measurement.
References
Bylesjö M, Segura V, Soolanayakanahally RY, Rae AM, Trygg J, Gustafsson P, Jansson S, Street NR (2008) LAMINA: a tool for rapid quantification of leaf size and shape parameters. BMC Plant Biol 8:82–89. doi:10.1186/1471-2229-8-82
Díaz S, Lavorel S, de Bello F, Quetier F, Grigulis K, Robson M (2007) Incorporating plant functional diversity effects in ecosystem service assessments. Proc Natl Acad Sci USA 104:20684–20689. doi:10.1073/pnas.0704716104
Ferreira T, Rasband WS (2012) ImageJ User Guide—IJ 1.46. http://imagej.nih.gov/ij/docs/guide/. Accesed 24 August 2015
Fortunel C, Fine PV, Baraloto C (2012) Leaf, stem and root tissue strategies across 758 neotropical tree species. Funct Ecol 26:1153–1161. doi:10.1111/j.1365-2435.2012.02020.x
Katabuchi M, Kurokawa H, Davies SJ, Tan S, Nakashizuka T (2012) Soil resource availability shapes community trait structure in a species-rich dipterocarp forest. J Ecol 100:643–651. doi:10.1111/j.1365-2745.2011.01937.x
Kraft NJB, Valencia R, Ackerly DD (2008) Functional traits and niche-based tree community assembly in an Amazonian forest. Science 322:580–582. doi:10.1126/science.1160662
Maloof JN, Nozue K, Mumbach MR, Palmer CM (2013) LeafJ: an ImageJ plugin for semi-automated leaf shape measurement. JoVE. doi:10.3791/50028
McGill BJ, Hadly E, Maurer B (2005) Community inertia of quaternary small mammal assemblages in North America. Proc Natl Acad Sci USA 102:16701–16706. doi:10.1073/pnas.0504225102
Osnas JLD, Lichstein JW, Reich PB, Pacala SW (2013) Global leaf trait relationships: mass, area, and the leaf economics spectrum. Science 340:741–744. doi:10.1126/science.1231574
R Core Team (2015) R: a language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. http://www.R-project.org/. Accessed 24 August 2015
Varma V, Osuri AM (2013) Black Spot: a platform for automated and rapid estimation of leaf area from scanned images. Plant Ecol 214:1529–1534. doi:10.1007/s11258-013-0273-z
Weight C, Parnham D, Waites R (2008) LeafAnalyser: a computational method for rapid and large-scale analyses of leaf shape variation. Plant J 53:578–586. doi:10.1111/j.1365-313X.2007.03330.x
Wright IJ, Reich PB, Westoby M, Ackerly DD, Baruch Z, Bongers F, Cavender-Bares J, Chapin T, Cornelissen J, Diemer M, Flexas J, Garnier E, Groom PK, Gulias J, Hikosaka K, Lamont BB, Lee T, Lee W, Lusk C, Midgley JJ, Navas ML, Niinemets U, Oleksyn J, Osada N, Poorter H, Poot P, Prior L, Pyankov VI, Roumet C, Thomas SC, Tjoelker MG, Veneklaas EJ, Villar R (2004) The worldwide leaf economics spectrum. Nature 428:821–827. doi:10.1038/nature02403
Acknowledgments
I thank M. Aiba for assistance with the R script. I also thank J. Lichstein, S. Rifai, Y. Onoda and the two anonymous referees for helpful comments on the manuscript. MK was supported by a Postdoctoral Fellowship for Research Abroad from the Japan Society for the Promotion of Science.
Author information
Authors and Affiliations
Corresponding author
Electronic supplementary material
Below is the link to the electronic supplementary material.
About this article
Cite this article
Katabuchi, M. LeafArea: an R package for rapid digital image analysis of leaf area. Ecol Res 30, 1073–1077 (2015). https://doi.org/10.1007/s11284-015-1307-x
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s11284-015-1307-x