Coder Social home page Coder Social logo

fnndsc / ami Goto Github PK

View Code? Open in Web Editor NEW
706.0 68.0 211.0 162.58 MB

AMI Medical Imaging (AMI) JS ToolKit

Home Page: https://fnndsc.github.io/ami/#viewers_upload

License: MIT License

JavaScript 98.54% HTML 0.60% CSS 0.21% TypeScript 0.60% Shell 0.05%
medical javascript threejs ami volume-rendering dicom-images dicom nifti-format nrrd nifti

ami's Introduction

Build Status CDNJS Version NPM Version Slack


Content

  1. Hello AMI
  2. Features
  3. Usage
  4. Developer corner
  5. Change log
  6. Credits
  7. Citations

Hello AMI

lesson00 Lesson 00: Load
Load DICOM Data and get a nice Series/Stack/Frame structure.
lesson01 Lesson 01: Visualize 3D
Look at the data we loaded in 3D.
lesson00 Lesson 02: Mesh
Add a mesh to the scene.
lesson00 Lesson 03: Visualize 2D
Look at the data in 2D.
lesson00 Lesson 04: Labelmap
Overlays on top of you data.
Lesson 05: TRK
TRK - coming soon.
lesson00 Lesson 06: Volume Rendering
Volume Rendering.
Lesson 07: Lookup tables
Lookup Tables - coming soon.
lesson00 Lesson 08: Custom progress bar
Custom progress bars.

(more) Advanced demos

Volume rendering, 2D viewer, arbitrary reslicing and more examples and advanced demos there!

Features

โœ… READY ๐Ÿ”ถ IN PROGRESS OR LIMITED SUPPORT โŒ ON ROADMAP

Capabilities Volumes Meshes Widgets
โœ… 2D Visulization โœ… Dicom โœ… VTK (THREEJS) ๐Ÿ”ถ Handle (2D/3D)
โœ… 3D Visualization โœ… NRRD โœ… STL (THREEJS) ๐Ÿ”ถ Probe (2D/3D)
โœ… Volume Rendering โœ… Nifti โœ… TRK ๐Ÿ”ถ Ruler (2D/3D)
โœ… Lookup Tables โœ… MHD/(Z)RAW โœ… FSM ๐Ÿ”ถ Orientation (2D/3D)
โœ… Label Maps โœ… MGH/MGZ โŒ CURV ๐Ÿ”ถ Angle (2D/3D)
โŒ JPEG

Usage

Pre-requisites

  • ES2015 promises support. (consider using polyfills if needed)
  • Load THREEJS your index.html BEFORE AMI.

<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r81/three.js"></script>

Yarn

$> yarn add ami.js

Note: you might need to include babel transforms in you build process.

// app.js
import * as AMI form 'ami.js';
window.console.log('Ready to rock!!');

ami.js

Check-out the lessons to get started quickly.

New: Use the new factory not to have to include three in index.html.

import * as THREE from 'three';
import {stackHelperFactory} from 'ami.js';

const StackHelper = stackHelperFactory(THREE);
const stackHelper = new StackHelper();

Add AMI in your index.html after THREEJS.

<!-- index.html -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r81/three.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ami.js/0.0.12/ami.min.js"></script>
<script src="app.js"></script>

#app.js
const AMI = AMI;
window.console.log('Ready to rock!!');

Developer corner

Get the source code and related packages.

$> git clone https://github.com/FNNDSC/ami.git
$> cd ami
$> yarn install

To run examples (browserify/babelify/serve the example)

$> yarn example <examples name>

#run the geometries_slice example
$> yarn example geometries_slice

Build standalone library to lib/

$> yarn build:ami

Build minified standalone version run

$> yarn build:ami:prod

Tests

$> yarn test

Documentation

$> yarn doc

Build and deploy dist/ to gh-pages

$> yarn deploy

Find out more about the API.

Credits

AMI would not exist without them:

  • Base components such as Vectors, Matrices and Objects3D.
  • HTML template for example page.
  • Author(s): mrdoob
  • DICOM parsing relies on it.
  • Author(s): chafey
  • Was used to figure out how to use the dicom parser properly.
  • Author(s): chafey
  • Nifti parsing relies on it.
  • Author(s): rii-mango
  • NRRD parsing relies on it.
  • Author(s): jaspervdg
  • JPEG Lossless Decoder for DICOM images
  • Author(s): rii-mango
  • GZ file decompression
  • Author(s): nodeca

Citations

2017

2016

ami's People

Contributors

adefrutoscasado avatar alexnederlof avatar alexswensen avatar andy23512 avatar cancan101 avatar chenkaic4 avatar daron1337 avatar eduardor2k avatar herrvoennchen avatar hurryhuang1007 avatar jbernal0019 avatar jgonzabal avatar jsdelivrbot avatar jsibir avatar marcinlichwala-tomtom avatar meawoppl avatar mtm12 avatar nicolasrannou avatar okrad avatar pjotrsvetachov avatar ptiluky avatar rudolphpienaar avatar rwirz avatar theblindprophet avatar tibetegya avatar tymiao1220 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ami's Issues

add argument to rotate to allow user to decide rotation direction

https://github.com/FNNDSC/ami/blob/master/src/cameras/cameras.orthographic.js

camera.rotate(); // clockwise
camera.rotate(-1); // counter clock-wise

in cameras.ortho

  rotate( clockwise=1) {
    this.center();

    // Pi/2 rotation if camera is positions at the front of the volume
    // else -Pi/2 rotation
    let invertClock = 1;
    if(this.position.distanceTo(this._back) < this.position.distanceTo(this._front)){
      invertClock = -1;
    }

    // Rotate the up vector around the "zCosine"
    let rotation = new THREE.Matrix4().makeRotationAxis(
      this._zCosine, 
      clockwise * invertClock * Math.PI/2);
    this.up.applyMatrix4(rotation);

    this._updateMatrices();
  }

data texture

create a shader texture which will display target data over an object if location matches.

slice geometry

Create a THREEJS like slice geometry to slice a cube easily.

Re defining mouse inputs

Is it possible to define what each mouse input do ?
For instance, I want to change the index via mouse wheel, change ww/wc via left click instead of having them in stack helpers.
I cannot find it in any example.

EDIT: I guess I spoke too fast.

Create VJS controls

Right now, we are using tweaked THREEJS controls.

We should create medical imaging specific controls.

  • for 2D orthographic camera:
    -> scroll: go through slices
  • for 3D perspective camera:
    -> scroll: zoom

Allow to hook up special behavior, in XTK like way.

allow fine rotation of otho camera

rotate should get the rotation angle as input

this rotation angle should be the angle relative to the current rotation (or relative to the default orientation?)

Layers shader slow *sometimes*

Sometimes it is painfully slow to scroll between slices in lesson 04 or examples label maps or image compare.

Just rebuilding AMI fixes it sometimes...

Remove data from github

Data should be hosted in a proper location and the github repo should only contain source code.

Minimal/(very)small datasets are acceptable for testings.

2D Representation isn't working

Whenever I use a serie to make a 2D representation, following the example, I get almost half the serie that works, then the other half is just noise (like on old tvs).

Here's the view for the images that don't compute

I don't know where it comes from, as it works on the OSIRIX desktop viewer.

It's the same on the example where I load dicom files with those series.
Is there something I'm missing ?

Thanks.

Polymer viewer

Create a simple dicom view element.
Input: data = [image1, image2, image3, etc.]

add filename in frame object

it will also help cleanup the lesson 02, where 2 series are being loaded but it is hard to know which file belong to which series without it.

2 series loaded in lesson 02

we should only load 1 series.

As a result, the stack displayed is not always the one presented in the thumbnail.

DICOM Loader THREEJS friendly

Mimic THREEJS loading/parsing approach for DICOM.

Ideally it create a "ImageHelper" (contains geometries + textures + stackHelpers)

Terminology:
Geometry: -
Texture: -
Helper: Geometry + Texture. It is a ThreeJS Object that can be visualized.

Models and views should be THREEJS like

A THREEJS dev should be confortable with using VJS. Follow same conventions and logic.

VJS allows us to create/update Frame, Stack and Image geometries.
Same for textures.

Might also need helpers such as "ArrowHelper", etc.

SEO lessons

sitemaps, robots.txt, canonical url, etc.

Update README

README is outdated, it should reflect current implementation, logic and goals.

Potential windows bug

examples/viewers_dicom2D/index.html three.min.js:631 THREE.WebGLRenderer 75 models.stack.js:235 do not know how to order the frames... โ€“ Hemanth Anakapalle 10 hours ago

three.min.js:704 THREE.WebGLProgram: shader error: 0 gl.VALIDATE_STATUS false gl.getProgramInfoLog C:\fakepath(167,37-79): error X4002: indefinite logarithm Warning: D3D shader compilation failed with default flags. (ps_3_0) Retrying with avoid flow control C:\fakepath(167,37-79): error X4002: indefinite logarithm Warning: D3D shader compilation failed with avoid flow control flags. (ps_3_0) Retrying with prefer flow control C:\fakepath(167,37-79): error X4002: indefinite logarithm โ€“ Hemanth Anakapalle 10 hours ago

Warning: D3D shader compilation failed with prefer flow control flags. (ps_3_0) Failed to create D3D shaders. โ€“ Hemanth Anakapalle 10 hours ago

WebGL: INVALID_OPERATION: useProgram: program not valid three.min.js:671 WebGL: INVALID_OPERATION: drawArrays: no valid shader program in use 254three.min.js:600 WebGL: INVALID_OPERATION: useProgram: program not valid three.min.js:600 WebGL: too many errors, no more errors will be reported to the console for this context. โ€“ Hemanth Anakapalle 10 hours ago

I am seeing all these errors over browser console. I am trying this over windows, Is it fine ? โ€“

Assets

Store here larger files not to make git source code too big

Black Box when exporting to OBJ Format

I used the Three.js obj exporter https://github.com/mrdoob/three.js/blob/master/examples/js/exporters/OBJExporter.js

and this code to download the file `

var exporter = new THREE.OBJExporter();
var result = exporter.parse(scene);

var link = document.createElement('a');
document.body.appendChild(link); 
save( new Blob( [ result], { type: 'text/plain' } ), 'model.obj' );

function save( blob, filename ) {

    link.href = URL.createObjectURL( blob );
    link.download = filename || 'data.json';
    link.click();

    // URL.revokeObjectURL( url ); breaks Firefox...

}`

and i get a black box

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.