@niivue/niivue 0.22.2 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -23
- package/dist/niivue.es.js +108187 -10401
- package/dist/niivue.umd.js +506 -94
- package/package.json +11 -2
- package/src/cmaps/index.js +1 -0
- package/src/cmaps/turbo.json +9 -0
- package/src/colortables.js +79 -0
- package/src/index.html +45 -27
- package/src/indexDraw.html +191 -0
- package/src/logger.js +5 -0
- package/src/meshes.html +161 -0
- package/src/niivue-object3D.js +243 -29
- package/src/niivue-shader3D.js +6 -0
- package/src/niivue.js +2577 -648
- package/src/nvimage.js +1821 -153
- package/src/nvmesh.js +3351 -0
- package/src/shader-srcs.js +565 -11
- package/src/shader.js +11 -2
- package/src/AIL.nii.gz +0 -0
- package/src/hippo.nii.gz +0 -0
- package/src/mni152.nii.gz +0 -0
package/README.md
CHANGED
|
@@ -2,12 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
NiiVue is a WebGL 2.0 medical image viewer. This repository contains the **core NiiVue package**. We have additional projects under development that will demonstrate a [web-based user interface implementation](https://github.com/niivue/niivue-ui), and a [desktop application](https://github.com/niivue/niivue-desktop) built using web technologies.
|
|
4
4
|
|
|
5
|
-
The NiiVue package is intented to be used by individuals developing interactive web pages related to showing [nifti](https://nifti.nimh.nih.gov)
|
|
5
|
+
The NiiVue package is intented to be used by individuals developing interactive web pages related to showing [nifti](https://nifti.nimh.nih.gov) and other formats popular in neuroimaging. NiiVue includes many mouse and keyboard interactions that enable browsing and manipulating images displayed in the canvas. This core package does not include a comprehensive user interface outside of the canvas (e.g. buttons, and other widgets). However, developers who wish to build custom user interfaces around the NiiVue canvas can manipulate the rendered images and change settings via the API. Our [web-based user interface implementation](https://github.com/niivue/niivue-ui) (under development) will demonstrate how to integrate NiiVue into a more comprehensive [VueJS](https://vuejs.org/) UI.
|
|
6
6
|
|
|
7
7
|
# Getting started Docs and References
|
|
8
8
|
|
|
9
9
|
[click here to go to the docs web page](https://niivue.github.io/niivue/devdocs/)
|
|
10
10
|
|
|
11
|
+
### Install NiiVue using npm
|
|
12
|
+
|
|
13
|
+
Installs without the bloat of the development dependencies or testing frameworks
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
npm install --only=prod @niivue/niivue
|
|
17
|
+
```
|
|
18
|
+
|
|
11
19
|
# Active Projects
|
|
12
20
|
|
|
13
21
|
[See our active projects here](https://github.com/orgs/niivue/projects)
|
|
@@ -38,7 +46,7 @@ We host many NiiVue examples via github pages. These are updated and deployed au
|
|
|
38
46
|
|
|
39
47
|
## existing html page
|
|
40
48
|
```html
|
|
41
|
-
<script src="https://unpkg.com/@niivue/niivue@0.
|
|
49
|
+
<script src="https://unpkg.com/@niivue/niivue@0.24.0/dist/niivue.umd.js"></script>
|
|
42
50
|
|
|
43
51
|
<canvas id="gl" height=480 width=640></canvas>
|
|
44
52
|
|
|
@@ -47,11 +55,6 @@ We host many NiiVue examples via github pages. These are updated and deployed au
|
|
|
47
55
|
// first object in array is background image
|
|
48
56
|
{
|
|
49
57
|
url: "./some_image.nii.gz",
|
|
50
|
-
volume: {hdr: null, img: null},
|
|
51
|
-
name: "some_image",
|
|
52
|
-
colorMap: "gray",
|
|
53
|
-
opacity: 1,
|
|
54
|
-
visible: true,
|
|
55
58
|
}
|
|
56
59
|
]
|
|
57
60
|
|
|
@@ -84,10 +87,6 @@ export default {
|
|
|
84
87
|
volumeList: [
|
|
85
88
|
{
|
|
86
89
|
url: "./mni152.nii.gz",
|
|
87
|
-
volume: {hdr: null, img: null},
|
|
88
|
-
colorMap: "gray",
|
|
89
|
-
opacity: 1,
|
|
90
|
-
visible: true,
|
|
91
90
|
}
|
|
92
91
|
]
|
|
93
92
|
|
|
@@ -125,10 +124,6 @@ const NiiVue = ({ imageUrl }) => {
|
|
|
125
124
|
const volumeList = [
|
|
126
125
|
{
|
|
127
126
|
url: imageUrl,
|
|
128
|
-
volume: { hdr: null, img: null },
|
|
129
|
-
colorMap: 'gray',
|
|
130
|
-
opacity: 1,
|
|
131
|
-
visible: true,
|
|
132
127
|
},
|
|
133
128
|
]
|
|
134
129
|
const nv = new Niivue()
|
|
@@ -143,10 +138,45 @@ const NiiVue = ({ imageUrl }) => {
|
|
|
143
138
|
|
|
144
139
|
// use as: <NiiVue imageUrl={someUrl}> </NiiVue>
|
|
145
140
|
```
|
|
141
|
+
## Angular example
|
|
142
|
+
Check our [Angular TypeScript development notes](docs/development-notes/angular-typescript.md) for instructions on building an Angular App with Niivue.
|
|
143
|
+
|
|
144
|
+
install: `npm i @niivue/niivue`
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
import { Component, OnInit, ViewChild} from '@angular/core';
|
|
148
|
+
|
|
149
|
+
import {Niivue} from '@niivue/niivue';
|
|
150
|
+
|
|
151
|
+
@Component({
|
|
152
|
+
selector: 'app-niivue-view',
|
|
153
|
+
templateUrl: './niivue-view.component.html',
|
|
154
|
+
styleUrls: ['./niivue-view.component.sass']
|
|
155
|
+
})
|
|
156
|
+
export class NiivueViewComponent implements OnInit {
|
|
157
|
+
@ViewChild('gl') canvas:HTMLCanvasElement|undefined;
|
|
158
|
+
|
|
159
|
+
constructor() { }
|
|
160
|
+
|
|
161
|
+
ngOnInit(): void {
|
|
162
|
+
const url = '/assets/mni152.nii.gz';
|
|
163
|
+
const volumeList = [
|
|
164
|
+
{
|
|
165
|
+
url,
|
|
166
|
+
},
|
|
167
|
+
]
|
|
168
|
+
const niivue = new Niivue();
|
|
169
|
+
niivue.attachTo('gl');
|
|
170
|
+
niivue.loadVolumes(volumeList);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
}
|
|
174
|
+
```
|
|
146
175
|
|
|
147
176
|
# Core Libraries
|
|
148
177
|
|
|
149
178
|
- [shader.js source](https://github.com/Twinklebear/webgl-util)
|
|
179
|
+
- [Daikon](https://github.com/rii-mango/Daikon)
|
|
150
180
|
- [NIFTI-Reader-JS source](https://github.com/rii-mango/NIFTI-Reader-JS)
|
|
151
181
|
- [glMatrix](https://glmatrix.net/)
|
|
152
182
|
|
|
@@ -155,22 +185,31 @@ const NiiVue = ({ imageUrl }) => {
|
|
|
155
185
|
- 2021-2022
|
|
156
186
|
- P50 DC014664/DC/NIDCD NIH HHS/United States
|
|
157
187
|
|
|
188
|
+
# Supported Formats
|
|
189
|
+
|
|
190
|
+
NiiVue can open several formats popular with brain imaging:
|
|
191
|
+
|
|
192
|
+
- Voxel-based formats: [NIfTI](https://brainder.org/2012/09/23/the-nifti-file-format/), [NRRD](http://teem.sourceforge.net/nrrd/format.html), [MRtrix MIF](https://mrtrix.readthedocs.io/en/latest/getting_started/image_data.html#mrtrix-image-formats), [AFNI HEAD/BRIK](https://afni.nimh.nih.gov/pub/dist/doc/program_help/README.attributes.html), [MGH/MGZ](https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/MghFormat), [ITK MHD](https://itk.org/Wiki/ITK/MetaIO/Documentation#Reading_a_Brick-of-Bytes_.28an_N-Dimensional_volume_in_a_single_file.29), [ECAT7](https://github.com/openneuropet/PET2BIDS/tree/28aae3fab22309047d36d867c624cd629c921ca6/ecat_validation/ecat_info).
|
|
193
|
+
- Mesh-based formats: [GIfTI](https://www.nitrc.org/projects/gifti/), [ASC](http://www.grahamwideman.com/gw/brain/fs/surfacefileformats.htm), [BrainSuite DFS](http://brainsuite.org/formats/dfs/), [PLY](https://en.wikipedia.org/wiki/PLY_(file_format)), [BrainNet NV](https://www.nitrc.org/projects/bnv/), [BrainVoyager SRF](https://support.brainvoyager.com/brainvoyager/automation-development/84-file-formats/344-users-guide-2-3-the-format-of-srf-files), [FreeSurfer](http://www.grahamwideman.com/gw/brain/fs/surfacefileformats.htm), [MZ3](https://github.com/neurolabusc/surf-ice/tree/master/mz3), [OFF](https://en.wikipedia.org/wiki/OFF_(file_format)), [Wavefront OBJ](https://brainder.org/tag/obj/), [STL](https://medium.com/3d-printing-stories/why-stl-format-is-bad-fea9ecf5e45), [Legacy VTK](https://vtk.org/wp-content/uploads/2015/04/file-formats.pdf), [X3D](https://3dprint.nih.gov/).
|
|
194
|
+
- Mesh overlay formats: [GIfTI](https://www.nitrc.org/projects/gifti/), [CIfTI-2](https://balsa.wustl.edu/about/fileTypes), [MZ3](https://github.com/neurolabusc/surf-ice/tree/master/mz3), [SMP](https://support.brainvoyager.com/brainvoyager/automation-development/84-file-formats/40-the-format-of-smp-files), STC, FreeSurfer (CURV/ANNOT)
|
|
195
|
+
- Tractography formats: [TCK](https://mrtrix.readthedocs.io/en/latest/getting_started/image_data.html#tracks-file-format-tck), [TRK](http://trackvis.org/docs/?subsect=fileformat), [TRX](https://github.com/frheault/tractography_file_format), VTK, AFNI .niml.tract
|
|
196
|
+
|
|
158
197
|
# Alternatives
|
|
159
198
|
|
|
160
199
|
There are several open source JavaScript NIfTI viewers. What makes NiiVue unique is its use of WebGL 2.0, MRIcroGL inspired shaders, and its minimal design. This makes it easy to integrate with existing web pages quicky in order to build powerful web-based viewers and support cloud-based analysis pipelines. Unlike many alternatives, NiiVue does **not** use [three.js](https://threejs.org). This means the WebGL calls are tuned for voxel display, and the screen is only refreshed when needed (preserving battery life and helping your computer do other tasks). On the other hand, niivue does not have access to the three.js user interface widgets, requiring developers to create their own custom widgets. However, there are popular UI frameworks such as [Vuetifyjs](https://vuetifyjs.com/en/) that greatly reduce this burden. Since there are numerous free alternatives, you can choose the optimal tool for your task.
|
|
161
200
|
[Francesco Giorlando](https://f.giorlando.org/2018/07/web-viewers-for-fmri/) describes some of the differences between different tools.
|
|
162
201
|
|
|
163
|
-
|
|
164
202
|
| Tool | Live Demos |
|
|
165
203
|
| ------------------------------------------------------------------------ | ------------------------------------------------------------------ |
|
|
166
204
|
| [AMI](https://github.com/FNNDSC/ami) | [live demo](https://fnndsc.github.io/ami/) |
|
|
167
|
-
| [BioImage Suite Web Project](https://github.com/bioimagesuiteweb/bisweb) | [live demo](https://bioimagesuiteweb.github.io/webapp/viewer.html) |
|
|
168
|
-
|
|
|
169
|
-
|
|
|
170
|
-
|
|
|
171
|
-
|
|
|
172
|
-
|
|
|
173
|
-
|
|
|
205
|
+
| [BioImage Suite Web Project](https://github.com/bioimagesuiteweb/bisweb) | [live demo](https://bioimagesuiteweb.github.io/webapp/viewer.html) |
|
|
206
|
+
| [BrainBrowser](https://brainbrowser.cbrain.mcgill.ca/) | [live demo](https://brainbrowser.cbrain.mcgill.ca/volume-viewer) |
|
|
207
|
+
| [nifti-drop](https://github.com/vsoch/nifti-drop) | [live demo](http://vsoch.github.io/nifti-drop) |
|
|
208
|
+
| [Med3web](https://lifescience.opensource.epam.com/mri/) | [live demo](https://med3web.opensource.epam.com/) |
|
|
209
|
+
| [MRIcroWeb](https://github.com/rordenlab/MRIcroWeb) | [live demo](https://rordenlab.github.io) |
|
|
210
|
+
| [Papaya](https://github.com/rii-mango/Papaya) | [live demo](https://papaya.greenant.net/) |
|
|
211
|
+
| [VTK.js](https://github.com/Kitware/vtk-js) | [live demo](https://kitware.github.io/paraview-glance/app/) |
|
|
212
|
+
| [slicedrop](https://github.com/slicedrop/slicedrop.github.com) | [live demo](https://slicedrop.com/) |
|
|
174
213
|
|
|
175
214
|
# Development
|
|
176
215
|
|