/vega

back server for lyra. Not a medical device or software, educational purposes only, for usage or any info, contact maintainer.

Primary LanguagePython

Back-end Server

This repo is a back-end part the final qualifying project. The main aim of the web application is to parcellate brain voxels into specific regions based on rs-fMRI data. The algorithm is based on the paper: Craddock, R. C.; James, G. A.; Holtzheimer, P. E.; Hu, X. P. & Mayberg, H. S. A whole brain fMRI atlas generated via spatially constrained spectral clustering Human Brain Mapping, 2012, 33, 1914-1928 doi: 10.1002/hbm.21333..

Info about fron-end server can be found here

Table of Content:

General Description

Final qualifing project is a web-based application for fMRI brain research. Back-end server is it's part dedicated to do all heavy workload such as preprocessng, calculations and file storage.

usecase

Default pipeline consisnt of following steps:
  1. Importing data System has intergation with CONN toolbox, but user can also upload NIfTI files from other sources. Main requeirment: data has to be preprocessed (denoising, aligning, etc);
  2. Then user select gray matter mask threshold and start calculationg of correlation matrix for specific subject;
  3. After finishing, status of the project will be "ready" and user can select desired number of ROIs and perform brain parcellation.

Tech Specs

Due to trends of modern applications, it has been decided to develop web-based applicaton with two nodes architecture:

  • GUI server (Lyra) that generates HTML content
    Techologies were used: javascript, vue.js, quasar framework, niivue
  • Backend server which is used to store files and perform computations on GPU
    Techologies were used: python, flask

Vega

Back-end server consist of three files:
server.py handles general functions such as program's entry-point, user's requests, URL's binds.
newProjectHandler.py stores the user data (matlab files, nifti images), manages simple file system (each project is a separate folder with its own files). During the work with the project, new files will appear in the folder as shown below.

To support easy access to data, JSON metafile has been created. After clicking "new project" button in web GUI, server creates new folder and JSON metafile:

{
    "name":"my_project.conn", // project name
    "status":"parcellating", // project status
    "parc":["original file","4","5"], // available parcellarions
    "corrThreshold":0.71, // algorithm specific thresholds
    "maskThreshold":0.02
}

evaluation.py is a interface to interact with Craddock et al., Human Brain Mapp., 33 (9) 2012

Code Improvments

The original Craddock et al., Human Brain Mapp., 33 (9) 2012 code has been modified to meet modern trends:

  • updated to python3+ version
  • added preprocessing filtering
  • added GPU support for effective computing
  • Hardcoded constants have been brough as functions arguments

messaging with front-end server

For communication, servers are using HTTP protocol as shown on figure below: