Coder Social home page Coder Social logo

ab20cs / handdrawngraphauc Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 27 KB

An innovative solution for finding the area under the curve for hand-drawn graphs

Python 100.00%
solutions data-analysis hand-drawn-graphs digitize area-under-curve productivity imagej graphs

handdrawngraphauc's Introduction

Area Under the Curve (AUC) of Hand-Drawn Graphs

Area Under the Curve (AUC) of a graph is an important statistical measure with many applications. Often times, the AUC of a hand-drawn graph must be measured, but there is too much "noise" on the page for it be fed through an OCR software. Hence, a common alternative is to tediously record the coordinates of each individual point in a spreadsheet. This new solution reduces the hassle of having to parse through each individual data point and can exponentially speed up the time required to process larger amounts of data.

Solution

For the purposes of this demonstration, I will use a plot of blood pressures (similar to a record an anesthesiologist may keep during surgery). AUC of blood pressure readings is often a key measurement used to diagnose patients with hypotension/hypertension in clinical research.

Step 1

Download ImageJ distributed by the National Institutes of Health (NIH).

Step 2

Save the hand-drawn graph in .PNG format. Below is the graph to be used in this demonstration: image

Step 3

Open ImageJ and navigate to Files > Open and choose the .PNG file saved from Step 2.

Step 4

Click on the Polygon selections tool in the toolbar and draw a polygon on the opened image around the region whose area you wish to determine. Then, click Analyze > Measure. image

Step 5

Click on the Straight*, segmented or freehand lines tool and draw a horizontal line across the width of the graph. Then, click Analyze > Measure. image

Step 6

Navigate to the Results window and press Ctrl+S on your keyboard and save the measurements as a CSV file. If there are multiple graphs, repeat Steps 2 to 6 and save the measurements for each subsequent graph in the same location. After all graph measurements have been saved, download calculate_area.py from this repository and save it in the same location as the saved CSV files.

Step 7

In the same way as the previous steps, take the following measurements:

  • Area of a single unit square on the grid
  • Length of a single unit square on the grid These measurements will be used in Step 8.
Step 8

Run calculate_area.py via the terminal or the IDE of your choice and you will be prompted to enter the following parameters in the Console:

  • Pixels per unit square: the area of a single unit square on the grid (measured in Step 7)
  • Area per unit square: the area of each square in the units of the given context
    • In our example, the area per unit square is 5*10=50 since each unit width represents 5 minutes and each unit height represents 10 mm Hg.
  • Value represented by each unit length: the value of each unit length in the given context.
    • In our example, this parameter is equal to 5.
  • Number of pixels per unit length: the length of a single unit square on the grid (measured in Step 7)
  • Starting value on the y-axis: the y-value at the x-axis
    • In our example, this value is 50. After inputting the parameters, the rest of the program should run and the AUC value will be found in the CSV file with the name inputted by the user.

handdrawngraphauc's People

Contributors

ab20cs avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.