Skip to content

rvshi/ImageProcessorS18

Repository files navigation

HYPERPIXEL

Corneal Image Segmentation Web Service

Build Status Documentation Status

Team: 59ers

Team Members: Harvey Shi (@rvshi), Edward Liang (@edl11), Michelle Wei (@michellewei04)

Course: Duke BME 590-05 Medical Software Design (Spring 2018)

Try It Here: https://harveyshi.com/ImageProcessorS18/

See A Demo: https://youtu.be/1ffBEW7qsT0

Introduction

Hyperpixel is web service for segmenting corneal images using Otsu's Method.

  • Hyperpixel provides a backend API for user login, uploading, processing, and downloading images.
  • The API is authenticated via JSON web tokens.
  • The backend connects to a database for keeping track of users.
  • The most recently uploaded and processed images are saved on the server.
  • A frontend website is also included, which leverages all the API endpoints.

Under the hood

Backend

  • Consists of a Flask server and MongoDB database running via Docker Compose.
  • Caches the most recent image for each user.
  • Segmentation using Otsu's method is carried out via SciPy.
  • Request validation is handled by jsonschema.

Frontend

Usage

Backend

  • First, install Docker and Docker Compose.
  • Create a file called secret_key.py in the backend/ directory with the following contents (make sure to change the SECRET_KEY variable):
SECRET_KEY = 'exampleKey'
  • The latter file is for the JWT generation process.
  • To add users to the database:
    • Start only the database by running ./run_db.sh.
    • Use the add_user(username, password) function in database.py to add all the users you want.
    • Note: you will need to change the database.py line connect("mongodb://mongo:27017/database") to connect("mongodb://localhost:27017/database") to be able to access the database locally.
  • To run the service for production, run docker-compose up -d in the repo root directory to build both the backend and database containers and to run the service.
    • Type docker ps to check that the backend and database are running.
    • To view logs, look for the backend.log file in the backend folder.

Frontend

  • First, navigate to the frontend/ folder.
    • To test the website locally, run npm run start.
    • Note, you may want to change the baseURL variable in requests.js to point to your backend URL.
  • To build the site for production, run npm run build. The production files will be in the build/ directory.
    • You can then serve the files statically.