The file imcalc.zip contains six files: imcalc.m, padul654.bmp, padule.dep, padule.out paduquer.dat, and this file. imcalc.m is the Matlab m-file to read in a bitmap file, convert it to a binary image and calculate the graph values. All files padu*.* are sample data files  to check the way it works. 

First a word of warning. This routine was written for stratigraphic data in which the independant axis is vertical (the depth) and the dependant axis (here fossil pollen percentages) is horizontal. If you are going to use this for normally plotted data you will need to re-jig certain parts of the code.

To run the file, type imcalc at the command prompt. You will be prompted for the filename. The graph is read in and displayed, then you are asked to supply certain details. These are maximum and minimum depth (max/min y-axis), maximum percentage (max x-axis), taxa number (this isn't essential, just extra information) and line width. The line width is the number of pixels to subtract to eliminate the y-axis line, so that zero values really are zero. 

The program works by converting each row in the image matrix into binary (O if black (data), 1 otherwise (notdata)). Each row is summed to give the number of pixels in the row that represent data to give a data vector. The min/max depths are used to produce a vector of depths. These two vectors provide the data values for the graph. I then use an input file containing certain depths, and interpolate data values at each depth using these two vectors. 

The main advantage of this process over using a mouse, is the resolution that can be obtained, i.e. 400 dpi is impossible using a mouse. However, there is a certain amount of preparation that needs to be done. The graph should be solid (see padul654.bmp), not a line graph, also all extraneous lines and marks must be erased. Generally, this can be done in a few minutes in any modern graphics package using fill and erase. Presumably the values of a line graph could be calculated using an edge detection routine, but I have not done this. Also, try to ensure that the axes of the graph are as straight as possible. 

Please send me all queries, bugs, improvements and suggestions. I think there are other uses for this kind of routine. For example, I am trying to use a similar routine to obtain vegetation coverage data from a map. I would be interested to hear of any other uses or suggested uses, so let me know if I can help. Thanks.

03/05/99 Simon Brewer EPD 13200 Arles France - simon.brewer@wanadoo.fr

