BACKGROUND
leaves are of fundamental importance to plants, representing the power generation facility and aerial environmental sensing units of plants, and by extension ultimately provide the energy for sustaining most terrestrial species on earth.
a number of genes known to affect meristomatic pattern formation , the rate of leaf primordia initiation  <cit>  and that contribute to the determination of leaf length  and width  have now been identified: less is known about the determination of leaf size currently.
despite these advances, it remains clear that leaf area development is a highly complex process that is influenced by genetic, hormonal and environmental factors.
quantitative trait loci  mapping of leaf development and leaf size and shape indicators suggests that these traits are under the control of many genes  <cit> , with relatively few genes identified to date  <cit> .
to advance the current understanding of leaf area development and final dimension determination requires the ability to phenotype large collections of leaves from qtl mapping populations, natural populations and forward genetic screens to identify and quantify loci/mutations influencing leaf characteristics.
as well as being important to the fields of genetics, physiology, plant breeding and developmental biology, leaf shape parameters are also important as a means of reconstructing historical paleoclimate conditions  <cit> , where information on leaf serration  is used to accurately reconstruct past mean annual temperature  <cit> .
leaf size and shape parameters  were initially quantified using gridded paper, where a count of squares was used to measure leaf size, or through the development of allometric relationships between length, width and area, with length typically being measured and later used to calculate area using a regression model.
this approach can work well within a single species but works poorly when applied to mapping populations, where segregation can lead to extensive variation in both leaf area and shape traits.
it is equally inappropriate for forward genetic screens to identify leaf phenotypes, where the induced phenotypic changes are unpredictable.
for many species, field-portable leaf scanning equipment can be used to measure leaf area and blade dimensions.
however, such equipment cannot be used on large leaves and works poorly on species such as arabidopsis thaliana due to small leaf area and the proximity of leaves to the soil.
such equipment is also often limited in the range of measurements provided and, as no digital image is captured, retrospective re-analysis using, for example, new software tools is not possible.
more recently, methods have concentrated on the capturing of digital images of leaves  with subsequent analysis using digital image analysis tools.
a number of such tools already exist, but none of the currently available software was able to fulfil our needs.
imagej  <cit>  is a widely used application for the analysis of biological images and can be used to analyse area and blade dimensions.
however, automated analysis is hard to achieve, as is the simultaneous measurement of area and blade dimensions when leaves are not square within the image.
imagej offers no method to quantify leaf serration.
the development of tools for measuring leaf area was reported in  <cit>  and  <cit> , however they offer little to extend the capabilities of imagej.
more recently  <cit>  reported the development of leafanalyser, which is an excellent tool to facilitate pca analysis of leaf shape parameters.
however, this tool does not report the type of dimensions that are typically required by plant breeders, physiologists, geneticists or palaeontologists and the software was not released as open source, negating the possibility of further development by the community.
we additionally found that the implemented thresholding frequently required per-image manual adjustment, making the automated, rapid analysis of leaves more time consuming.
we were interested in measuring basic leaf dimension parameters  as well as measures of leaf shape, symmetry, serration number and depth and the missing area within a leaf  in a collection of naturally occurring clones of populus tremula, the swedish aspen  collection, that are being grown in common garden experiments in the south and north of sweden  <cit>  and that are being used for association mapping  <cit> .
this species has well defined, characteristic leaf serrations that we had visually observed to show variation between clones within the swasp collection.
we were therefore interested to see to what degree leaf serration was under genetic control.
this required a rapid and reproducible method of quantifying leaf size and shape parameter traits as well as serration characteristics.
as was reported in  <cit> , we were also interested to see how well pca could be used to describe the variation in leaf area characteristics within this collection of trees.
implementation
the lamina software has been implemented in java as a stand-alone graphical application.
the software is used to identify leaf objects and to calculate properties of those objects in an automated or semi-automated fashion.
automated analysis requires no user intervention after setting the desired parameters whereas semi-automated analysis pauses after each image has been analysed to allow manual adjustment of identified blade dimension centre lines , which can be important where leaves are not perpendicular to the image plane.
an example screenshot of the user interface is shown in figure 1a.
main computational steps
the computational processes involved can be described in the following sequential steps.
<dig>  thresholding.
as an initial step, global thresholding is performed to find candidate picture elements  that putatively represent leaves.
in the thresholding process, all pixel intensities are reduced from the typical grayscale range of 0– <dig> to either  <dig>  or  <dig> .
as input, the inverse of the blue channel intensities are used rather than the entire rgb image.
the rationale behind this strategy is that while leaves can be green, orange, red or even black, they are very rarely blue.
on a white background, non-blue objects can, with high accuracy, be distinguished from the background using global thresholding.
the process of identifying a suitable global threshold can be performed either manually or automatically.
in manual thresholding, the user specifies an arbitrary value t in the range 0– <dig>  where pixels with intensities less than t will be set to  <dig>  and pixels with intensities equal to or greater than t will be set to  <dig> .
the automatic thresholding procedure, on the other hand, tries to automatically determine a value of t that minimizes the variance of the thresholded image  <cit> .
this procedure is generally suitable for images where objects have fairly well-behaved shapes, which is true for most leaf objects .
the automated search procedure can be greedy, in which a local minima is found based on a greedy search starting from the mean value of the starting image.
alternatively, the procedure can be exhaustive, in which the entire range 0– <dig> is searched for the value t that minimizes the variance of the thresholded image.
the latter procedure is generally more accurate but also considerably slower.
<dig>  segmentation.
posterior to thresholding, the input image has been reduced to a binary image containing pixels that are either background  or potential leaf objects .
the task of segmentation is to group nearby pixels into segments  that may potentially represent leaves.
the segmentation starts by assigning an arbitrary on pixel as the current segment.
the segment is then iteratively extended with neighbouring, unassigned on pixels  until no more neighbouring on pixels exist.
this procedure is repeated until all on pixels have been assigned to an object.
<dig>  filtering.
due to measurement noise and presence of contaminants in the image, some objects will not represent actual leaves.
to remove dubious objects, filtering can be performed based on both the area of each object  and based on the density of each object .
the default filtering is non-stringent and will only remove the smallest objects, likely to represent contaminations in the image.
<dig>  object boundaries.
the boundary of an object is defined by the set of on pixels where at least one neighbour of each on pixel is an off pixel .
the identification of the boundary pixels is a straightforward computational process.
however, in order to simplify the subsequent steps, the adjacent boundary pixels are internally arranged sequentially  within each object.
this procedure requires that distances are calculated between all boundary pixels and can be time-consuming for highly irregular surfaces, e.g.
artemisia annua images.
<dig>  cavities.
cavities in the leaf objects can be present due to e.g.
biting herbivore damage, which implies that identification and measurement are of interest.
a cavity is by definition surrounded by a boundary region that is unconnected to the outer boundary of the object.
this distinctive characteristic is used to identify the cavities, seen as 'kinks' in the distances between neighboring boundary pixels.
the off pixels that can only be connected to the cavity  boundary define the cavity area.
in this sense, cavities are defined as missing leaf area  within the leaf lamina and do not account for herbivory starting at the edge of the leaf, which is computationally more difficult to quantify as it would require retrospective calculation of where the leaf boundary was previously.
it is equally hard to distinguish herbivory or wounding at the leaf boundary from serrations.
this represents an obvious area of future extension of lamina, but is not a trivial task.
<dig>  serrations and indents.
starting from a boundary pixel, the longest straight line that can be formed without crossing the object formed by non-boundary pixels is sought.
the intermediate region between two serrations defines an indent.
this is implemented in practice by connecting the starting boundary pixel with boundary pixels of increasing distances until a non-connectable boundary pixel is found.
the last connectable pixel, i.e.
one that can be connected by a straight line without crossing the object, is the next serration point.
the process starts again using the latest serration point as the starting pixel.
to allow for small variations in the boundary shape, a consecutive sequence of k non-connectable pixels are allowed before stopping.
the parameter k can be adjusted by the user and determines the overall sensitivity of the serration identification algorithm.
<dig>  indent depths.
each indent is surrounded by two serrations that can be connected by a straight line.
the indent depth is measured as the longest line to the base of the indent while being perpendicular to the straight line connecting the surrounding serrations.
due to the discrete nature of images, it is not always possible to achieve perfect perpendicularity, and hence a slight discrepancy in this angle is allowed.
<dig>  boundary coordinates.
from the boundary pixels of each object, a fixed number of boundary coordinate points can optionally be identified.
these are defined as equally spaced points around the surface of the object.
the boundary coordinates are normalised against the centre coordinate of the object to make the measurements independent of the position of the object in the image.
output from lamina
after processing, lamina outputs cropped image files representing the identified objects after thresholding and segmentation.
this allows the user to have a record of the results of the image analysis process .
furthermore, a number of quantitative measurements of the leaves are generated.
this includes the leaf area, height, width, circularity, number of serrations, indent widths and depths as well as the boundary coordinates .
for parameters that summarise several measurements, the output includes the mean, median and standard deviation.
scale calibration
image measurements do not generally contain any information regarding the actual size of the image.
in order to convert the pixel-based distances and areas in the leaf image into real quantitative measures, scale calibration has to be performed.
the aim of the calibration is to determine the actual size of one pixel in millimeters  and is optimally run once, to find the conversion ratio.
lamina requires a calibration image to perform this calculation, containing one coloured object  of known size on a white background.
ideally this object should fill the majority of the image area to maximize the accuracy of the calibration.
after determining the measured pixel size of the image, and by manual input of the actual size in mm, the pixel-to-mm ratio can be determined and employed for all subsequent image calculations.
example applications of lamina
exploring leaf physiognomy in the swasp populus tremula collection
full details of the common garden experiment can be found in  <cit> .
five leaves per replicate of each clone were sampled on a single day in early august  <dig> into paper bags and later scanned using a canon canoscan  <dig> f a <dig> flatbed scanner at a resolution of  <dig> dpi.
a  <dig> ×  <dig> mm yellow rectangle of card was scanned and used for scale calibration.
images were saved as jpeg files.
the majority of genets  were represented by four clonal replicates.
our sampling strategy was to select five random leaves from different heights on each replicate as we wanted to know how plastic  leaf area was within and between both genets and intra-genet clonal replicates.
the only criterion applied was that leaves should be mature and should not be from the terminal stem, as these leaves are of a fundamentally different nature in aspens.
images were analysed in lamina in a semi-automated work flow to allow for corrections to the orientation of leaves within the image.
default settings were used for all parameters except for the serration detection pixel threshold, where  <dig> was used.
the centre line of each leaf was adjusted where required before proceeding to the next image.
in total,  <dig> images containing  <dig> leaves were analysed, with the lamina analysis taking  <dig> working day .
a random set of  <dig> leaves were scanned and analysed using imagej  <cit>  and lamina.
for the imagej analysis, images were imported as an image stack, at which point they were transformed to  <dig> bit  and then thresholded using a value of  <dig> to produce a binary image.
the trace tool was then used to select each leaf and the measure tool used to record the selected area.
the scale was set using the line tool to define a known distance using the same calibration image used for the lamina analysis.
data generated were analysed and visualised in r  <cit> .
anova tests were performed using the nlme package to test for clone within population and population effects.
principal components anlaysis  was performed in simca p .
benchmarking lamina using the complex leaves of artemisia annua
a. annua leaves are highly complex and we deemed them to serve as a comprehensive test of the ability of lamina to extract and reliably quantify leaf area and dimension traits.
we therefore undertook a more detailed method comparison using either glasshouse-grown or field-grown genotypes of a. annua.
one mature leaf from six genotypes grown in a glasshouse was used to compare leaf area meter data to lamina.
the area of each leaf was measured using a li-cor li- <dig> area meter  and the same leaves were scanned using an hp scanjet  <dig> c a <dig> flatbed scanner at  <dig> dpi.
a  <dig> ×  <dig> mm bar was scanned and used for scale calibration.
three mature leaves from  <dig> genotypes grown outside at stockbridge technology centre, cawood, north yorkshire, u.k. were scanned using the same scanner and used for area analysis in lamina and imagej.
leaves  <dig>   <dig> and  <dig>  were sampled in october  <dig>
lamina analysis was performed using the following settings: manual threshold value of  <dig>  no serration detection.
imagej analysis was performed by transforming images to  <dig> bit  and then thresholded using a value of  <dig> to produce a binary image.
a polygon was then drawn around a leaf and the analyze particles tool used to calculate the area represented by leaf pixels.
the scale was set by scanning a standard ruler and using the line tool to define a known distance.
the use of the pixel analysis method, rather than the more automated method used for the aspen leaves, was required due to the complex shape of the a. annua leaves.
however, this method increases the chance of any noise artifacts in the scanned image being included in the measurement calculations.
testing lamina using species with diverse leaf shapes
in order to ensure that lamina functioned for a diverse range of species, we sampled leaves of a number of common european tree species as well as various poplar species and a. thaliana.
one to three leaves per species were analysed to ensure that leaves were reliably extracted from the scanned images.
all images were scanned as for the swasp trees.
additionally, the jpeg format images used as example applications in  <cit>  and  <cit>  were downloaded and analysed using lamina in order to benchmark our software against these other packages.
RESULTS
using lamina to explore leaf traits in the swasp collection
in order to test lamina and to provide us with an overview of leaf characteristics within the swasp collection to guide future experimental design, we sampled leaves from the northern common garden of the swasp collection  <cit> .
as we had previously used imagej  <cit>  for analysing leaf area, we first performed a comparison analysis between imagej and lamina as an initial benchmark to ensure that lamina provided comparable results.
both programs returned effectively identical measures of leaf area , with an r <dig> value of  <dig> .
having established that lamina was functioning as intended, we then extended the analysis to the entire set of sampled leaves.
using this data, we first examined the variation between multiple leaves sampled from the same clonal replicate, which indicated that there was significant variation in leaf area within an individual plant .
this prompted us to extract only the leaf with the largest area measurement from each replicate, which reduced intra-genet variance, with the results shown in table  <dig>  the anova model results in table  <dig> show that, even after selecting only the largest leaf per replicate, there was still significant variance in leaf area within a genet.
this result will be essential to guiding subsequent leaf sample collection and also indicates that very careful consideration should be given to sample collection not only for morphological analysis but also for other purposes such as physiology, transcriptomics and metabolomics, as leaf development appears to be highly plastic in aspen.
we also examined the results of a pca analysis of the boundary coordinate data and trait variable data produced by lamina.
figure 1e shows the loading plot of xy boundary coordinates for the set of data representing the largest leaf from each genet replicate.
both x and y sets of coordinates form spherical distributions but they lie at right angles to each other.
principal component one appears to represent leaf width and component two leaf length, with these two components explaining the majority  of the variance in the data.
pca of the morphological trait values showed a distribution pattern confirming the correlation results shown in table  <dig> .
we have therefore shown that lamina is suitable for extracting meaningful biological data using different pca approaches in a fashion similar to  <cit>  but with the additional advantage that traditional morphological measures of leaf traits are provided by lamina for use in methods other than pca.
the data produced by lamina is equally suitable for use in other analysis methods.
anova analysis of leaf size and shape parameter data generated using lamina.
significance values are *  <dig> , **  <dig> , ***  <dig> , ns not significant.
benchmarking lamina against imagej and a leaf area meter using artemisia annua
leaves from a. annua plants were by far the most complex in structure of those that we used for testing and developing lamina.
we therefore examined the results generated for these leaves in more detail as a means of benchmarking lamina.
leaf area is an important trait in a. annua as this medicinal crop produces artemisinin, used in anti-malaria drugs, in glandular trichomes found predominantly on the leaf surface.
natural variation in a. annua leaves is being studied using qtl mapping and association studies, while induced mutations and phenotypes are being identified using forward and reverse genetic screens with all of these approaches requiring rapid and reliable quantification of leaf area.
we performed two small comparisons, one using a leaf area meter and the second using imagej as these two methods of calculating leaf area represent those most commonly used currently.
both methods provided effectively identical results for leaf area .
however, lamina has the added advantage of also providing a suite of additional measurements alongside area , as well as providing a far greater level of automation in the analysis pipeline.
both sets of results presented in figure  <dig> show that lamina is able to reliably extract leaves from scanned images and accurately calculate leaf morphological traits from such complex leaves to a level of accuracy that matches existing, commonly-used analysis methods.
lamina is suitable for use in a diverse range of species
to qualitatively assess the general applicability of lamina, we scanned leaves from a diverse range of tree and flowering plant species.
these included species commonly used in laboratory and genetics/ecology research as well as a range of species with divergent leaf shapes and forms.
a number of examples of the cropped output images generated by lamina are shown in figure  <dig>  including the example images of  <cit>  and  <cit> , with the results showing that lamina performs equally well as existing software tools.
we also tested lamina on a collection of scanned images of populus balsamifera leaves, which have numerous, small serrations.
lamina was able to quantify these small serrations provided image resolution was adequate .
current limitations and future development
we have shown that lamina is able to accurately extract and quantify leaf area from scanned images of a diverse range of plant species.
however, there are limitations to the use of the provided dimension measurements currently provided by lamina, and these limitations represent the most immediate targets for future development and expansion of lamina.
although lamina is able to quantify leaf area of the a. annua leaves accurately, there are currently limitations to the use of additional measurements returned by lamina, with these being true in a range of leaf forms.
examining the a. annua leaves shown in figure  <dig> shows that lamina currently returns blade dimensions using only straight lines, which is clearly far from ideal in these leaves.
it is also clear that serration and cavity analysis will not return meaningful values from these leaves.
there is therefore clear caution and consideration required by end users when making use of values returned by lamina.
in the case of a. annua, we would suggest that calculated area is certainly reliable and that circularity may also be a useful indicator of how that leaf area is distributed.
the use of any other returned values would require careful consideration by the end user.
as is the case for the a. annua leaves, many leaves do not have perfectly straight or symmetrical shapes and as such, the central line deviates from a straight line.
currently lamina only returns a measure of the maximum  straight line distance between the leaf base and tip.
the inclusion of a tool to additionally allow manual placement of a non-straight line tracing the centre line  of a leaf is an obvious first target for extension of the current measures provided by lamina.
at present, the difference between the values of the returned  <dig> % and  <dig> % vertical lengths can be used to indicate leaf asymmetry, which will often reflect the degree of leaf curvature and therefore the likely inaccuracy of the returned straight line centre measurement.
the a. annua leaves and the included example a. thaliana leaves shown in figure  <dig> identify another important issue to consider when sampling leaves to be analysed using lamina – that of petioles: if petioles are sampled as well as actual leaf area, lamina will include the petiole as part of the leaf and this will affect generated measurements.
in many species, removal of petioles is simple as there is a clearly identifiable boundary between leaf and petiole.
if petioles are being removed, it is essential that this is done accurately as any remaining petiole will lead to the mis-identification of a serration either side of the remaining petiole.
figure 3g represents a more complex example, but one that is typical for many a. thaliana plants, where there is no clear boundary between the leaf lamina and the petiole.
in such cases, it is often very hard to define where leaf becomes petiole and the sampling strategy must take this into consideration: lamina will include any scanned leaf area when generating dimension measurements and the end user must therefore decide what they wish to be included at the point of sampling .
although it is not inconceivable that an algorithm could be developed to differentiate between leaf and petiole, this is certainly far from a trivial task, especially if such an algorithm should be generally applicable across species.
the example a. thaliana leaves in figure 3g highlight another point that users must be aware of: currently, the software will not distinguish between wounding at the leaf boundary and serrations.
in the cases shown in figure  <dig>  boundary damage most likely resulted from flattening the leaves at the point of image collection, as a. thaliana leaves are frequently curved and can not be flattened without tearing the leaf lamina.
the use of median rather than mean serration values will limit the influence of such outliers but if serration quantification is being used, users should visually screen through the cropped images produced by lamina to identify problem leaves.
it is possible that the algorithm for detecting leaf serrations could be extended to differentiate between boundary wounding or grazing herbivore damage  and actual serrations.
however, as with other similar problems such as petiole detection, this will not be simple if the algorithm is to be applicable across a wide range of species .
such algorithmic development would require extensive testing and confirmation across a broad range of species that have been exposed to a range of herbivore damage and wounding.
there are also a number of potential extensions to lamina that we feel would have broad appeal to leaf researchers, including colour quantification , detection of necrotic lesions or flecks, measurement of leaf rust urediospore number and dimensions, and quantification of veinal pattern.
as lamina has been released as an open source project using the well-supported java language, it represents an ideal framework for the future integration of such extensions by the community and we hope that the instigation of such an open source project can serve as a means of concentrating development of a powerful phenotyping tool, as has been the case for the analysis of microscopy images since the initial release of imagej  <cit> .
CONCLUSIONS
we have developed a new software tool for the automated or semi-automated analysis of leaf morphological traits and have shown that the method is able to extract biologically meaningful data from a range of species with contrasting leaf shapes.
the developed software performs equally well as existing software while also providing an extended range of measures of leaf size and shape indicators.
we show that the software performs as well as commonly used leaf area meters, even when measuring highly complex leaf forms.
application of this software tool will significantly aid the rapid screening of large-scale collections of genotypes for forward or reverse genetics as well as equally serving plant breeders.
this is the first open source tool available for the quantification of leaf serration.
availability and requirements
project name: lamina: leaf shape determination
project home page:
operating system: platform independent
programming language: java
other requirements: java  <dig> .x or higher.
lamina uses the java advanced imaging  package  to support common image file formats, which is bundled with the installation and hence no additional installation should be required.
license: gnu gpl2
abbreviations
lamina: leaf shape determination; swasp: swedish aspen; qtl: quantitative trait loci; pca: principal component analysis.
authors' contributions
mb developed the lamina software and contributed to the manuscript production.
vs performed the a. annua leaf analysis and was supervised by amr.
rys performed the swasp lamina analysis.
jt, sj, pg supervised the project.
nrs conceived the project and tested the software, drafted the manuscript, scanned the swasp leaves and analysed the swasp leaf data.
all authors read and approved the manuscript.

 leaves are of fundamental importance to plants, representing the power generation facility and aerial environmental sensing units of plants, and by extension ultimately provide the energy for sustaining most terrestrial species on earth. a number of genes known to affect meristomatic pattern formation, the rate of leaf primordia initiation and that contribute to the determination of leaf length and width have now been identified: less is known about the determination of leaf size currently. despite these advances, it remains clear that leaf area development is a highly complex process that is influenced by genetic, hormonal and environmental factors. quantitative trait loci mapping of leaf development and leaf size and shape indicators suggests that these traits are under the control of many genes, with relatively few genes identified to date. to advance the current understanding of leaf area development and final dimension determination requires the ability to phenotype large collections of leaves from qtl mapping populations, natural populations and forward genetic screens to identify and quantify loci/mutations influencing leaf characteristics. as well as being important to the fields of genetics, physiology, plant breeding and developmental biology, leaf shape parameters are also important as a means of reconstructing historical paleoclimate conditions, where information on leaf serration is used to accurately reconstruct past mean annual temperature. leaf size and shape parameters were initially quantified using gridded paper, where a count of squares was used to measure leaf size, or through the development of allometric relationships between length, width and area, with length typically being measured and later used to calculate area using a regression model. this approach can work well within a single species but works poorly when applied to mapping populations, where segregation can lead to extensive variation in both leaf area and shape traits. it is equally inappropriate for forward genetic screens to identify leaf phenotypes, where the induced phenotypic changes are unpredictable. for many species, field-portable leaf scanning equipment can be used to measure leaf area and blade dimensions. however, such equipment cannot be used on large leaves and works poorly on species such as arabidopsis thaliana due to small leaf area and the proximity of leaves to the soil. such equipment is also often limited in the range of measurements provided and, as no digital image is captured, retrospective re-analysis using, for example, new software tools is not possible. more recently, methods have concentrated on the capturing of digital images of leaves with subsequent analysis using digital image analysis tools. a number of such tools already exist, but none of the currently available software was able to fulfil our needs. imagej is a widely used application for the analysis of biological images and can be used to analyse area and blade dimensions. however, automated analysis is hard to achieve, as is the simultaneous measurement of area and blade dimensions when leaves are not square within the image. imagej offers no method to quantify leaf serration. the development of tools for measuring leaf area was reported in and, however they offer little to extend the capabilities of imagej. more recently reported the development of leafanalyser, which is an excellent tool to facilitate pca analysis of leaf shape parameters. however, this tool does not report the type of dimensions that are typically required by plant breeders, physiologists, geneticists or palaeontologists and the software was not released as open source, negating the possibility of further development by the community. we additionally found that the implemented thresholding frequently required per-image manual adjustment, making the automated, rapid analysis of leaves more time consuming. we were interested in measuring basic leaf dimension parameters as well as measures of leaf shape, symmetry, serration number and depth and the missing area within a leaf in a collection of naturally occurring clones of populus tremula, the swedish aspen collection, that are being grown in common garden experiments in the south and north of sweden and that are being used for association mapping. this species has well defined, characteristic leaf serrations that we had visually observed to show variation between clones within the swasp collection. we were therefore interested to see to what degree leaf serration was under genetic control. this required a rapid and reproducible method of quantifying leaf size and shape parameter traits as well as serration characteristics. as was reported in, we were also interested to see how well pca could be used to describe the variation in leaf area characteristics within this collection of trees. implementation the lamina software has been implemented in java as a stand-alone graphical application. the software is used to identify leaf objects and to calculate properties of those objects in an automated or semi-automated fashion. automated analysis requires no user intervention after setting the desired parameters whereas semi-automated analysis pauses after each image has been analysed to allow manual adjustment of identified blade dimension centre lines, which can be important where leaves are not perpendicular to the image plane. an example screenshot of the user interface is shown in figure 1a. main computational steps the computational processes involved can be described in the following sequential steps. thresholding. as an initial step, global thresholding is performed to find candidate picture elements that putatively represent leaves. in the thresholding process, all pixel intensities are reduced from the typical grayscale range of 0– to either or. as input, the inverse of the blue channel intensities are used rather than the entire rgb image. the rationale behind this strategy is that while leaves can be green, orange, red or even black, they are very rarely blue. on a white background, non-blue objects can, with high accuracy, be distinguished from the background using global thresholding. the process of identifying a suitable global threshold can be performed either manually or automatically. in manual thresholding, the user specifies an arbitrary value t in the range 0– where pixels with intensities less than t will be set to and pixels with intensities equal to or greater than t will be set to. the automatic thresholding procedure, on the other hand, tries to automatically determine a value of t that minimizes the variance of the thresholded image. this procedure is generally suitable for images where objects have fairly well-behaved shapes, which is true for most leaf objects. the automated search procedure can be greedy, in which a local minima is found based on a greedy search starting from the mean value of the starting image. alternatively, the procedure can be exhaustive, in which the entire range 0– is searched for the value t that minimizes the variance of the thresholded image. the latter procedure is generally more accurate but also considerably slower. segmentation. posterior to thresholding, the input image has been reduced to a binary image containing pixels that are either background or potential leaf objects. the task of segmentation is to group nearby pixels into segments that may potentially represent leaves. the segmentation starts by assigning an arbitrary on pixel as the current segment. the segment is then iteratively extended with neighbouring, unassigned on pixels until no more neighbouring on pixels exist. this procedure is repeated until all on pixels have been assigned to an object. filtering. due to measurement noise and presence of contaminants in the image, some objects will not represent actual leaves. to remove dubious objects, filtering can be performed based on both the area of each object and based on the density of each object. the default filtering is non-stringent and will only remove the smallest objects, likely to represent contaminations in the image. object boundaries. the boundary of an object is defined by the set of on pixels where at least one neighbour of each on pixel is an off pixel. the identification of the boundary pixels is a straightforward computational process. however, in order to simplify the subsequent steps, the adjacent boundary pixels are internally arranged sequentially within each object. this procedure requires that distances are calculated between all boundary pixels and can be time-consuming for highly irregular surfaces, e.g. artemisia annua images. cavities. cavities in the leaf objects can be present due to e.g. biting herbivore damage, which implies that identification and measurement are of interest. a cavity is by definition surrounded by a boundary region that is unconnected to the outer boundary of the object. this distinctive characteristic is used to identify the cavities, seen as'kinks' in the distances between neighboring boundary pixels. the off pixels that can only be connected to the cavity boundary define the cavity area. in this sense, cavities are defined as missing leaf area within the leaf lamina and do not account for herbivory starting at the edge of the leaf, which is computationally more difficult to quantify as it would require retrospective calculation of where the leaf boundary was previously. it is equally hard to distinguish herbivory or wounding at the leaf boundary from serrations. this represents an obvious area of future extension of lamina, but is not a trivial task. serrations and indents. starting from a boundary pixel, the longest straight line that can be formed without crossing the object formed by non-boundary pixels is sought. the intermediate region between two serrations defines an indent. this is implemented in practice by connecting the starting boundary pixel with boundary pixels of increasing distances until a non-connectable boundary pixel is found. the last connectable pixel, i.e. one that can be connected by a straight line without crossing the object, is the next serration point. the process starts again using the latest serration point as the starting pixel. to allow for small variations in the boundary shape, a consecutive sequence of k non-connectable pixels are allowed before stopping. the parameter k can be adjusted by the user and determines the overall sensitivity of the serration identification algorithm. indent depths. each indent is surrounded by two serrations that can be connected by a straight line. the indent depth is measured as the longest line to the base of the indent while being perpendicular to the straight line connecting the surrounding serrations. due to the discrete nature of images, it is not always possible to achieve perfect perpendicularity, and hence a slight discrepancy in this angle is allowed. boundary coordinates. from the boundary pixels of each object, a fixed number of boundary coordinate points can optionally be identified. these are defined as equally spaced points around the surface of the object. the boundary coordinates are normalised against the centre coordinate of the object to make the measurements independent of the position of the object in the image. output from lamina after processing, lamina outputs cropped image files representing the identified objects after thresholding and segmentation. this allows the user to have a record of the results of the image analysis process. furthermore, a number of quantitative measurements of the leaves are generated. this includes the leaf area, height, width, circularity, number of serrations, indent widths and depths as well as the boundary coordinates. for parameters that summarise several measurements, the output includes the mean, median and standard deviation. scale calibration image measurements do not generally contain any information regarding the actual size of the image. in order to convert the pixel-based distances and areas in the leaf image into real quantitative measures, scale calibration has to be performed. the aim of the calibration is to determine the actual size of one pixel in millimeters and is optimally run once, to find the conversion ratio. lamina requires a calibration image to perform this calculation, containing one coloured object of known size on a white background. ideally this object should fill the majority of the image area to maximize the accuracy of the calibration. after determining the measured pixel size of the image, and by manual input of the actual size in mm, the pixel-to-mm ratio can be determined and employed for all subsequent image calculations. example applications of lamina exploring leaf physiognomy in the swasp populus tremula collection full details of the common garden experiment can be found in. five leaves per replicate of each clone were sampled on a single day in early august into paper bags and later scanned using a canon canoscan f a flatbed scanner at a resolution of dpi. a × mm yellow rectangle of card was scanned and used for scale calibration. images were saved as jpeg files. the majority of genets were represented by four clonal replicates. our sampling strategy was to select five random leaves from different heights on each replicate as we wanted to know how plastic leaf area was within and between both genets and intra-genet clonal replicates. the only criterion applied was that leaves should be mature and should not be from the terminal stem, as these leaves are of a fundamentally different nature in aspens. images were analysed in lamina in a semi-automated work flow to allow for corrections to the orientation of leaves within the image. default settings were used for all parameters except for the serration detection pixel threshold, where was used. the centre line of each leaf was adjusted where required before proceeding to the next image. in total, images containing leaves were analysed, with the lamina analysis taking working day. a random set of leaves were scanned and analysed using imagej and lamina. for the imagej analysis, images were imported as an image stack, at which point they were transformed to bit and then thresholded using a value of to produce a binary image. the trace tool was then used to select each leaf and the measure tool used to record the selected area. the scale was set using the line tool to define a known distance using the same calibration image used for the lamina analysis. data generated were analysed and visualised in r. anova tests were performed using the nlme package to test for clone within population and population effects. principal components anlaysis was performed in simca p. benchmarking lamina using the complex leaves of artemisia annua a. annua leaves are highly complex and we deemed them to serve as a comprehensive test of the ability of lamina to extract and reliably quantify leaf area and dimension traits. we therefore undertook a more detailed method comparison using either glasshouse-grown or field-grown genotypes of a. annua. one mature leaf from six genotypes grown in a glasshouse was used to compare leaf area meter data to lamina. the area of each leaf was measured using a li-cor li- area meter and the same leaves were scanned using an hp scanjet c a flatbed scanner at dpi. a × mm bar was scanned and used for scale calibration. three mature leaves from genotypes grown outside at stockbridge technology centre, cawood, north yorkshire, u.k. were scanned using the same scanner and used for area analysis in lamina and imagej. leaves and were sampled in october lamina analysis was performed using the following settings: manual threshold value of no serration detection. imagej analysis was performed by transforming images to bit and then thresholded using a value of to produce a binary image. a polygon was then drawn around a leaf and the analyze particles tool used to calculate the area represented by leaf pixels. the scale was set by scanning a standard ruler and using the line tool to define a known distance. the use of the pixel analysis method, rather than the more automated method used for the aspen leaves, was required due to the complex shape of the a. annua leaves. however, this method increases the chance of any noise artifacts in the scanned image being included in the measurement calculations. testing lamina using species with diverse leaf shapes in order to ensure that lamina functioned for a diverse range of species, we sampled leaves of a number of common european tree species as well as various poplar species and a. thaliana. one to three leaves per species were analysed to ensure that leaves were reliably extracted from the scanned images. all images were scanned as for the swasp trees. additionally, the jpeg format images used as example applications in and were downloaded and analysed using lamina in order to benchmark our software against these other packages.  using lamina to explore leaf traits in the swasp collection in order to test lamina and to provide us with an overview of leaf characteristics within the swasp collection to guide future experimental design, we sampled leaves from the northern common garden of the swasp collection. as we had previously used imagej for analysing leaf area, we first performed a comparison analysis between imagej and lamina as an initial benchmark to ensure that lamina provided comparable results. both programs returned effectively identical measures of leaf area, with an r value of. having established that lamina was functioning as intended, we then extended the analysis to the entire set of sampled leaves. using this data, we first examined the variation between multiple leaves sampled from the same clonal replicate, which indicated that there was significant variation in leaf area within an individual plant. this prompted us to extract only the leaf with the largest area measurement from each replicate, which reduced intra-genet variance, with the results shown in table the anova model results in table show that, even after selecting only the largest leaf per replicate, there was still significant variance in leaf area within a genet. this result will be essential to guiding subsequent leaf sample collection and also indicates that very careful consideration should be given to sample collection not only for morphological analysis but also for other purposes such as physiology, transcriptomics and metabolomics, as leaf development appears to be highly plastic in aspen. we also examined the results of a pca analysis of the boundary coordinate data and trait variable data produced by lamina. figure 1e shows the loading plot of xy boundary coordinates for the set of data representing the largest leaf from each genet replicate. both x and y sets of coordinates form spherical distributions but they lie at right angles to each other. principal component one appears to represent leaf width and component two leaf length, with these two components explaining the majority of the variance in the data. pca of the morphological trait values showed a distribution pattern confirming the correlation results shown in table. we have therefore shown that lamina is suitable for extracting meaningful biological data using different pca approaches in a fashion similar to but with the additional advantage that traditional morphological measures of leaf traits are provided by lamina for use in methods other than pca. the data produced by lamina is equally suitable for use in other analysis methods. anova analysis of leaf size and shape parameter data generated using lamina. significance values are *, **, ***, ns not significant. benchmarking lamina against imagej and a leaf area meter using artemisia annua leaves from a. annua plants were by far the most complex in structure of those that we used for testing and developing lamina. we therefore examined the results generated for these leaves in more detail as a means of benchmarking lamina. leaf area is an important trait in a. annua as this medicinal crop produces artemisinin, used in anti-malaria drugs, in glandular trichomes found predominantly on the leaf surface. natural variation in a. annua leaves is being studied using qtl mapping and association studies, while induced mutations and phenotypes are being identified using forward and reverse genetic screens with all of these approaches requiring rapid and reliable quantification of leaf area. we performed two small comparisons, one using a leaf area meter and the second using imagej as these two methods of calculating leaf area represent those most commonly used currently. both methods provided effectively identical results for leaf area. however, lamina has the added advantage of also providing a suite of additional measurements alongside area, as well as providing a far greater level of automation in the analysis pipeline. both sets of results presented in figure show that lamina is able to reliably extract leaves from scanned images and accurately calculate leaf morphological traits from such complex leaves to a level of accuracy that matches existing, commonly-used analysis methods. lamina is suitable for use in a diverse range of species to qualitatively assess the general applicability of lamina, we scanned leaves from a diverse range of tree and flowering plant species. these included species commonly used in laboratory and genetics/ecology research as well as a range of species with divergent leaf shapes and forms. a number of examples of the cropped output images generated by lamina are shown in figure including the example images of and, with the results showing that lamina performs equally well as existing software tools. we also tested lamina on a collection of scanned images of populus balsamifera leaves, which have numerous, small serrations. lamina was able to quantify these small serrations provided image resolution was adequate. current limitations and future development we have shown that lamina is able to accurately extract and quantify leaf area from scanned images of a diverse range of plant species. however, there are limitations to the use of the provided dimension measurements currently provided by lamina, and these limitations represent the most immediate targets for future development and expansion of lamina. although lamina is able to quantify leaf area of the a. annua leaves accurately, there are currently limitations to the use of additional measurements returned by lamina, with these being true in a range of leaf forms. examining the a. annua leaves shown in figure shows that lamina currently returns blade dimensions using only straight lines, which is clearly far from ideal in these leaves. it is also clear that serration and cavity analysis will not return meaningful values from these leaves. there is therefore clear caution and consideration required by end users when making use of values returned by lamina. in the case of a. annua, we would suggest that calculated area is certainly reliable and that circularity may also be a useful indicator of how that leaf area is distributed. the use of any other returned values would require careful consideration by the end user. as is the case for the a. annua leaves, many leaves do not have perfectly straight or symmetrical shapes and as such, the central line deviates from a straight line. currently lamina only returns a measure of the maximum straight line distance between the leaf base and tip. the inclusion of a tool to additionally allow manual placement of a non-straight line tracing the centre line of a leaf is an obvious first target for extension of the current measures provided by lamina. at present, the difference between the values of the returned % and % vertical lengths can be used to indicate leaf asymmetry, which will often reflect the degree of leaf curvature and therefore the likely inaccuracy of the returned straight line centre measurement. the a. annua leaves and the included example a. thaliana leaves shown in figure identify another important issue to consider when sampling leaves to be analysed using lamina – that of petioles: if petioles are sampled as well as actual leaf area, lamina will include the petiole as part of the leaf and this will affect generated measurements. in many species, removal of petioles is simple as there is a clearly identifiable boundary between leaf and petiole. if petioles are being removed, it is essential that this is done accurately as any remaining petiole will lead to the mis-identification of a serration either side of the remaining petiole. figure 3g represents a more complex example, but one that is typical for many a. thaliana plants, where there is no clear boundary between the leaf lamina and the petiole. in such cases, it is often very hard to define where leaf becomes petiole and the sampling strategy must take this into consideration: lamina will include any scanned leaf area when generating dimension measurements and the end user must therefore decide what they wish to be included at the point of sampling. although it is not inconceivable that an algorithm could be developed to differentiate between leaf and petiole, this is certainly far from a trivial task, especially if such an algorithm should be generally applicable across species. the example a. thaliana leaves in figure 3g highlight another point that users must be aware of: currently, the software will not distinguish between wounding at the leaf boundary and serrations. in the cases shown in figure boundary damage most likely resulted from flattening the leaves at the point of image collection, as a. thaliana leaves are frequently curved and can not be flattened without tearing the leaf lamina. the use of median rather than mean serration values will limit the influence of such outliers but if serration quantification is being used, users should visually screen through the cropped images produced by lamina to identify problem leaves. it is possible that the algorithm for detecting leaf serrations could be extended to differentiate between boundary wounding or grazing herbivore damage and actual serrations. however, as with other similar problems such as petiole detection, this will not be simple if the algorithm is to be applicable across a wide range of species. such algorithmic development would require extensive testing and confirmation across a broad range of species that have been exposed to a range of herbivore damage and wounding. there are also a number of potential extensions to lamina that we feel would have broad appeal to leaf researchers, including colour quantification, detection of necrotic lesions or flecks, measurement of leaf rust urediospore number and dimensions, and quantification of veinal pattern. as lamina has been released as an open source project using the well-supported java language, it represents an ideal framework for the future integration of such extensions by the community and we hope that the instigation of such an open source project can serve as a means of concentrating development of a powerful phenotyping tool, as has been the case for the analysis of microscopy images since the initial release of imagej.  we have developed a new software tool for the automated or semi-automated analysis of leaf morphological traits and have shown that the method is able to extract biologically meaningful data from a range of species with contrasting leaf shapes. the developed software performs equally well as existing software while also providing an extended range of measures of leaf size and shape indicators. we show that the software performs as well as commonly used leaf area meters, even when measuring highly complex leaf forms. application of this software tool will significantly aid the rapid screening of large-scale collections of genotypes for forward or reverse genetics as well as equally serving plant breeders. this is the first open source tool available for the quantification of leaf serration. availability and requirements project name: lamina: leaf shape determination project home page: operating system: platform independent programming language: java other requirements: java.x or higher. lamina uses the java advanced imaging package to support common image file formats, which is bundled with the installation and hence no additional installation should be required. license: gnu gpl2 abbreviations lamina: leaf shape determination; swasp: swedish aspen; qtl: quantitative trait loci; pca: principal component analysis. authors' contributions mb developed the lamina software and contributed to the manuscript production. vs performed the a. annua leaf analysis and was supervised by amr. rys performed the swasp lamina analysis. jt, sj, pg supervised the project. nrs conceived the project and tested the software, drafted the manuscript, scanned the swasp leaves and analysed the swasp leaf data. all authors read and approved the manuscript. 
in order to allow principal component analysis to be performed, the location of a chosen number of equally spaced boundary coordinates can optionally be returned. such fields require measurement of large collections of leaves, with resulting conclusions being highly influenced by the accuracy of the phenotypic measurement process. an increased understanding of leaf area development is important in a number of fields: in food and non-food crops, for example short rotation forestry as a biofuels feedstock, leaf area is intricately linked to biomass productivity; in paleontology leaf shape characteristics are used to reconstruct paleoclimate history. we show that the software provides an efficient and accurate means of analysing leaf area in large datasets in an automated or semi-automated work flow. we demonstrate the use of the software on a set of scanned images, each containing multiple leaves, collected from a common garden experiment containing clones of populus tremula that are being used for association mapping, as well as examples of leaves from other species. lamina has been designed to provide classical indicators of leaf shape and size, which are typically required for correlation analysis to biomass productivity, as well as measures that indicate asymmetry in leaf shape, leaf serration traits, and measures of herbivory damage.
 an increased understanding of leaf area development is important in a number of fields: in food and non-food crops, for example short rotation forestry as a biofuels feedstock, leaf area is intricately linked to biomass productivity; in paleontology leaf shape characteristics are used to reconstruct paleoclimate history. such fields require measurement of large collections of leaves, with resulting conclusions being highly influenced by the accuracy of the phenotypic measurement process.  we have developed lamina, a new tool for the automated analysis of images of leaves. lamina has been designed to provide classical indicators of leaf shape and size, which are typically required for correlation analysis to biomass productivity, as well as measures that indicate asymmetry in leaf shape, leaf serration traits, and measures of herbivory damage. in order to allow principal component analysis to be performed, the location of a chosen number of equally spaced boundary coordinates can optionally be returned.  we demonstrate the use of the software on a set of scanned images, each containing multiple leaves, collected from a common garden experiment containing clones of populus tremula that are being used for association mapping, as well as examples of leaves from other species. we show that the software provides an efficient and accurate means of analysing leaf area in large datasets in an automated or semi-automated work flow. 