# CSM Software

MATLAB Code for Continuous Symmetry Measures (CSM) of Leaves and Other Objects

We use LAMINA to automatically place n equidistant points around the perimeter of each leaf, generating the x,y-coordinates of an n-sided object. LAMINA is Leaf Shape Determination software (Bylesjö et al. 2008). It can handle batch processing, which makes it particularly worthwhile. It automatically measures surface area, shape, perimeter, leaf serration, herbivory damage (missing leaf area), and several other useful variables, including leaf symmetry.

To estimate leaf asymmetry ds as efficiently as possible, we combine all of the LAMINA output into an Excel data file. Then we create a subfile from the last 2n columns of the data file; these contain the x,y-coordinates of the n points of the object. In MATLAB, we use xlsread to read the Excel subfile of x– and y-coordinates. We then used two scripts (GenericRows and genericApplyToRows) to apply the functions NormalizePoints_mod.m andc sm_Mirror_closedBoundary_mod.m to every row in the vector of x,y-coordinates. We use xlswrite to convert the MATLAB output back into Excel, and combine it with the original data file for further statistical analysis. See Graham et al. (in review) for discussion and application to real leaves.

normalizePoints_mod

NormalizePoints.m is a MATLAB function that translates the object to a centroid of (0,0) and scales it to average centroid size.

csm_Mirror_closedBoundary_mod

The function csm_Mirror_closedBoundary_mod.m first converts each row (a 1 x 2n vector) into a 2 x n matrix and then calculates cval (ds), ncoor (new coordinates), and theta (θ, the angle that the axis of symmetry makes with the

y-axis).

GenericRows

GenericRows.m is a MATLAB script that we use together with the built-in MATLAB script genericApplyToRows.m. GenericRows applies a function to each row in an array, returning either scalar values or a series of

vectors. Scalars are returned as a column vector, with one row for each row in the input array. Vectors are returned as a matrix that can be written to an Excel file.

Script to run csm analysis

This is the MATLAB script to run a csm analysis on a large datafile in Excel, without eqsamp (see below). Before running, you will need to change the file names in the xlsread and xlswrite statements.

function npoints

eqsAmp.m is a MATLAB function that calculates the length of the contour and samples points at equal distances, starting with the first point. LAMINA already does this, so it is unnecessary to use this function if you

are using the output from LAMINA for your x- and y-coordinates.

Users of the code should site the paper: Zabrodsky, H., S. Peleg and D. Avnir. 1995. Symmetry as a Continuous Feature. IEEE Trans. Pattern Analysis and Machine Intelligence, Vol 17, no 12, pp. 1154-1166.

References

Bylesjö, M., V. Segura, R.Y. Soolanayakanahally, A.M. Rae, J. Trygg, P. Gustafsson, S. Jansson, and N.R.Street. 2008. Lamina: A tool for rapid quantification of leaf size and shape parameters. BMC Plant Biology 8: 82, doi:10.1186/1471-2229-8-82

Graham, J. H., M. J. Whitesell, M. Fleming, H. Hel-Or, E. Nevo, and S. Raz. Fluctuating asymmetry of plant leaves: batch processing with LAMINA and continuous symmetry measures. Symmetry (in review)

Zabrodsky, H., S. Peleg, and D. Avnir. 1995. Symmetry as a continuous feature. IEEE Trans. Pattern Analysis and Machine Intelligence 17 (12): 1154-1166.