Introduction

Introdução

GraphData 1.0

Freeware

http://www.sgrillo.net

Introduction

Often, in scientific research, the scientist has only available data in graphical form, having to use a ruler and pencil to estimate the numerical value of each point on the graph when needed.

GraphData is designed to automatically extract numeric data from graphs available in the form of image (bmp, gif, jpg, etc.), facilitating the work of extraction the numbers and increasing its accuracy.

After be loaded in the program the chart image, where necessary, may be edited to optimize the extraction of data, using the editor available in the application.

The principles of extraction of data is simple: the program scans the picture, from bottom to top (or vice-versa), measuring the distance from the top (or bottom) until the line of the graph. Through the maximum and minimum values reported for the X and Y axes the program generates the numerical values of each point (X, Y) along the graph's line, corresponding to the scale used in the original figure.

The program finds the graph's line through its color, to be specified by the user in advance. Therefore can not appear in the image other graphics or text that have the same color as the chart's line. Also for this reason it is possible to extract data from different graphics on the same image as long as the color of each line is different.

The data generated can be saved, copied or exported to MS Excel.

Support: ricardo.sgrillo@terra.com.br

Copyright © 2008, Ricardo Sgrillo

This help file has been generated by the freeware version of HelpNDoc


Loading and preparing the image

Carregando a figura

Loading the image

The image with the graphic can be loaded by clicking on the items Open image or Paste image from the File menu.

The image will open or pasted retaining its original size, although it is shown at constant size (760 x 500 pixels) in the application window.

Figure 1. Screen displayed after the image is loaded.

An image as shown in Figure 1 is not suitable for extracting the data because the program would not be able to identify the numerical values of the scales of the graph.

In this case, the chart should be prepared properly, as described below.

The toolbar can be dragged with the mouse to anywhere on the form.

The image may may be dragged with the mouse clicking the right button while Ctrl is pressed.

Preparing the image

The image should be edited considering the comments below. The edition can be done externally, with any image editor (Paint, Corel, etc..) Or using the editor available in the program.

To facilitate the edition is available on the View menu clicking in Zoom Window, a small magnifying glass that can be dragged to any point of the figure.

Figure 1A. Zoom window

To open the image editor click on the Edit menu on Edit image. When the editing is done click on the Edit menu on Extract numbers.

When the editor is open the image is displayed in its original size. The program window can be maximized to contain the entire image, but images larger than the computer screen can not be displayed and edited in its entirety. These images can be edited with an external editor and then pasted in the program.

The toolbar can be dragged with the mouse to anywhere on the form..

The image may may be dragged with the mouse clicking the right button while Ctrl is pressed.

The image editor's toolbar is shown below.

Figure 2. Toolbar in edit mode

a) Cropping the image

The image should be cropped, if necessary, to contain only the area bounded by the lower and upper limits of the axes X and Y.

A

B

Figure 3. A - Original image; B - Image cropped to contain only the area bounded by the lower and upper limits of the axes X and Y.

To crop the picture click the Crop tool (See Figure 2) and then click the top left corner of the area to be cropped, drag the mouse to the bottom right corner and release the button. When the button is released the image will be cropped as shown in Figure 3-B

If necessary, use the Line tool to draw lines marking the area to be cropped. Use a different color from the color of the graph points and lines.

Don't forget to record the maximum and minimum values of X and Y in the appropriate fields on the toolbar so that the data taken are presented in the original scale of the figure.

b) Stained colors in the image

Use the Draw tool or the Line tool to correct flaws in the graph lines.

The line width can be specified with the slider in the toolbar.

Click the color Picker and then on the line of the chart to select the color.

Double click on the Color box to choose any color

b) Additional elements in the image

Graphic elements, such as lines and texts that appear in subtitles, for example, can remain in the area of the chart provided they do not have the same color as the lines of the graph. If they have the same color should be erased with the Eraser toolbar.

Finishing the edition

When you finish editing the picture you click Extract numbers on the Edit menu. This set the changes in the image closing the editing mode. The window for extracting data will then be presented. You can return to the editing mode at any moment.

Copyright © 2008, Ricardo Sgrillo

This help file has been generated by the freeware version of HelpNDoc


Extracting data

Extraindo os dados

Extracting data

If the original image that was loaded is adequate, or if it has already been edited, you can then move to the stage of extracting the data.

Figure 4. Screen in extracting data mode

Figure 5. Toolbar for extracting data

a) Chosen the line color

To facilitate the selection of the color it is available, on the View menu clicking in Zoom Window, a small magnifying glass that can be dragged to any point of the figure.

Click on one of the lines or points of the chart (or of the zoom window) to select the corresponding color. The selected color will appear in color box in the toolbar.

In many images, especially in half-tone jpg, the graphics are displayed in pixels with different shades of the same color. In this case may be increased tolerance for the identification of color, sliding the tool Tolerance to the right (see Fig 5.)

In other cases the image may presents multiple charts, with lines of similar color. In this case it may be necessary to reduce the tolerance for identifying the color for which there is no interference between the lines.

b) Scales

The minimum and maximum values for the scales should be chosen according to the area that will be used for the extraction of values.

A B

Figure 6. Choosing the scale. Dotted lines indicate where the picture will be cropped

In Figure 6, for example, to extract numbers keeping the original scale, the minimum and maximum values of X to be chosen would be 1999 and 2005 respectively and Y would be 364 and 376, respectively (points a, b, c, d ).

Additionally must be informed if the maximum scale Y (376 in the case) is the height of the figure, as shown in Figure 6 A, or if the maximum informed corresponds to the maximum value of the line of the graph, as in Figure 6B. In this case the maximum value of the Y scale should be 375 (points a, b).

It can also be informed the desired number of points for reading the line in the axis X. By default the program finds the values of the Y scale for each pixel on the scale X. The existing number of pixels is displayed in the field Existing points X on the toolbar (see fig. 5). In the example shown in Figure 5 there are 795 pixels, which means extraction of 795 pairs of points x, y. If the graphics change smoothly, a smaller number of points can be specified in the field Desired points X.

b) Methods

The user can choose three methods for extracting the data.

In the method UP (up arrow in Figure 5), the program scans the images starting from the basis of the figure and goes up, examining the color of each pixel of the image. When it encounters a pixel with the same color selected (considering the tolerance), the vertical and horizontal coordinates are stored.

In the method DOWN (down arrow in Figure 5), the program scans the images starting from the top of the figure and goes down, examining the color of each pixel of the image. When it encounters a pixel with the same color selected (considering the tolerance), the vertical and horizontal coordinates are stored.

In the average method the program uses the average values of methods UP and DOWN. The central method is especially appropriate when the line of the graph has several pixels thick.

On the toolbar can also be chosen the number of decimal places and scientific notation for the results.

c) Extraction

To extract the data click the Run menu. While the program is extracting data the chart's line is replaced by small circles with a complementary color.

Multiple charts

If the figure is composed of multiple charts that share the same scale, as shown in Figure 4, the process of extraction of all the graphics would be as follows:

1. Inform the data of scale, method, decimals places, etc..

2. Click on one of the lines or points to inform the color

3. Click on the Run menu

The program will mark the line chosen and when it reaches the end it presents a table with the values derived from X and Y

4. On the View menu, click Image to return the picture

5. On the toolbar check the control Add line

6. Click on the next line of the chart to select the color

7. Click on the Run menu

8. Back to the point 4 as needed

Copyright © 2008, Ricardo Sgrillo

This help file has been generated by the freeware version of HelpNDoc


Presenting and checking the results

Verificando os resultados

Presenting and checking the results

After extracting a table with the data is shown, as Figure 7. To return to present the image click on Image in the View menu.

This table can be exported to MS Excel, saved as a text file (separated by comma) or copied to the clipboard, from which can be pasted into other applications. Select the desired option on the File menu.

The table can be resized by clicking on its border and dragging it to the new size.

Figure 7. Table with data from two graphs on the same image (see Fig. 4)

Depending on the quality of the original figure the results might not be satisfactory requiring a more accurate adjust the tolerance of color. The figure may be edited again, also to strengthen lines erased, delete additional graphics and so on.

Figure 8 B shows an example in which the tolerance was specified at a very low value. In this case important points of the plot were not recognized as belonging to the graph line and some peak values, for example, were lost. This problem could be resolved by increasing tolerance or by editing the image and enhancing the color.

In figure 8 C tolerance chosen was very high and points outside the line of the chart were erroneously recognized as belonging to the chart. In this case the solution would be to reduce the tolerance or edit and delete the graphic elements outside the line of the chart.

Figure 8. A-Original-image from where the data was extracted; B-Points (green circles) indicating the coordinates where figures were extracted when the color of tolerance was set at its minimum, C-Points when the color of tolerance was set at its maximum.

Copyright © 2008, Ricardo Sgrillo

This help file has been generated by the freeware version of HelpNDoc