GithubHelp home page GithubHelp logo

nigelwilson / diamondh5weblib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dmitrie-ai/diamondh5weblib

0.0 0.0 0.0 211 KB

Diamond Light Source Summer Internship

HTML 1.28% CSS 5.98% TypeScript 21.24% Python 71.50%

diamondh5weblib's Introduction

Image Series Prototype

Diamond Light Source Summer Internship.
This prototype was created with h5web/lib(https://www.npmjs.com/package/@h5web/lib) and React.
image

Server

Simple REST server made with flask that returns JSON responses.
Made specifically for sending images from an image stack. Option is available to downsample and/or compress(using gzip) the response via the variables at the top of main.py. Downsampling block size can also be set via the variable at the top of main.py

HTTP GET Request

Requests are of the form http://localhost:8081/location-of-image-stack-relative-to-server-folder[image-number]?downsample=true where the URL encoded parameter downsample indicates whether to request a downsampled image or not.
Example request: http://localhost:8081/demo_data[3]?downsample=true \

JSON Response

Properties:

  • downsampled : The downsampling ratio. 0 if no downsampling has been done. E.g. If ratio is 4 then the block size is 16
  • item-type : The type of item received. In our case, it will always be "time-series"
  • object-type : "h5_object"
  • path : Path to the particular image received relative to the server folder. E.g. "demo_data/tomo.h5/2-AstraReconCpu/data[0]"
  • shape : Shape of the image series from which the received image is from. E.g. [768,576,768]
  • values : Array of data values.

Starting server

Run python main.py in the server folder.

Client

This project was bootstrapped with Create React App.

Starting Client

  1. Run npm install in the main directory to install the dependencies.
  2. Open src/App.tsx and modify dataFolder to point toward the folder where the hdf5 file is located relative to the server directory. Example: dataFolder="demo_data"
  3. Modify dataPath to point towards the image stack. Example: dataPath="tomo.h5/2-AstraReconCpu/data"
  4. Modify port to the port where the local server is running(will be shown in console when you start the server).
  5. Modify enableDownsampling to indicate whether you want the downsampling feature enabled.
  6. Modify decompress to indicate whether you want the responses to be decompressed(gzip).
  7. Run npm start in the main directory to run the app.
  8. Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

diamondh5weblib's People

Contributors

dmitrie-ai 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.