@niivue/niivue 0.30.0 → 0.31.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 +30 -42
- package/dist/niivue.es.js +7858 -3282
- package/dist/niivue.umd.js +196 -186
- package/package.json +4 -3
- package/src/cmaps/_itksnap.json +57 -0
- package/src/cmaps/_slicer3d.json +357 -0
- package/src/cmaps/bcgwhw.json +34 -0
- package/src/cmaps/bcgwhw_dark.json +34 -0
- package/src/cmaps/ct_artery.json +9 -0
- package/src/cmaps/index.js +10 -5
- package/src/colortables.js +49 -0
- package/src/index.html +77 -48
- package/src/indexDraw.html +371 -0
- package/src/indexFloodFillDraw.html +123 -0
- package/src/indexFullScreen.html +76 -0
- package/src/indexIntelGPU.html +124 -0
- package/src/indexIntensityDraw.html +76 -0
- package/src/logger.js +1 -1
- package/src/matcaps/Cortex.jpg +0 -0
- package/src/matcaps/Cream.jpg +0 -0
- package/src/matcaps/Fuzzy.jpg +0 -0
- package/src/matcaps/Gold.jpg +0 -0
- package/src/matcaps/Peach.jpg +0 -0
- package/src/matcaps/Plastic.jpg +0 -0
- package/src/matcaps/Shiny.jpg +0 -0
- package/src/niivue.css +106 -0
- package/src/niivue.js +1797 -1200
- package/src/nvcontroller.js +440 -0
- package/src/nvdocument.js +605 -0
- package/src/nvimage.js +531 -79
- package/src/nvmesh.js +179 -29
- package/src/nvutilities.js +98 -0
- package/src/session-bus.js +205 -0
- package/src/shader-srcs.js +207 -183
- package/src/meshes.html +0 -135
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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
|
-
|
|
5
|
+
NiiVue allows developers to create interactive web pages for visualizing [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 [UI wrapper](https://github.com/niivue/niivue-ui) demonstrates how the modular core NiiVue can be embedded into a rich user interface.
|
|
6
6
|
|
|
7
7
|
# Getting started Docs and References
|
|
8
8
|
|
|
@@ -16,18 +16,15 @@ Installs without the bloat of the development dependencies or testing frameworks
|
|
|
16
16
|
npm install --only=prod @niivue/niivue
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
# Active Projects
|
|
20
|
-
|
|
21
|
-
[See our active projects here](https://github.com/orgs/niivue/projects)
|
|
22
|
-
|
|
23
19
|
# Overview/Mission
|
|
24
20
|
|
|
25
|
-
|
|
21
|
+
NiiVue brings the features of the widely used native desktop applications ([AFNI](https://afni.nimh.nih.gov/about_afni), [FSLeyes](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FSLeyes), [MRIcroGL](https://github.com/rordenlab/MRIcroGL), [Surfice](https://github.com/neurolabusc/surf-ice), [SUMA](https://afni.nimh.nih.gov/Suma)) to the web. The developers of these tools developed NiiVue in collaboration, allowing us to benefit from collective wisdom. This will enable other researchers and developers to build cloud-based medical imaging tools with a powerful viewer that can operate on any device (desktop, tablet, mobile).
|
|
26
22
|
|
|
27
23
|
# Projects and People using NiiVue
|
|
28
24
|
|
|
25
|
+
- Analysis of Functional NeuroImages (AFNI) [Scientific and Statistical Computing Core](https://afni.nimh.nih.gov/) (National Institutes of Health)
|
|
29
26
|
- [Center for the Study of Aphasia Recovery](https://cstar.sc.edu/) (University of South Carolina)
|
|
30
|
-
- [Wellcome Centre for Integrative Neuroimaging](https://www.win.ox.ac.uk/) (University of Oxford)
|
|
27
|
+
- FMRIB's Software Library (FSL) [Wellcome Centre for Integrative Neuroimaging](https://www.win.ox.ac.uk/) (University of Oxford)
|
|
31
28
|
- [OpenNeuro.org](https://openneuro.org)
|
|
32
29
|
- [BrainLife.io](https://brainlife.io/about/)
|
|
33
30
|
|
|
@@ -39,31 +36,32 @@ We host many NiiVue examples via github pages. These are updated and deployed au
|
|
|
39
36
|
|
|
40
37
|
# Requirements for NiiVue to work
|
|
41
38
|
|
|
42
|
-
- [WebGL 2.0 capable](https://caniuse.com/webgl2) web browser (Chrome, FireFox).
|
|
39
|
+
- [WebGL 2.0 capable](https://caniuse.com/webgl2) web browser (Chrome, FireFox, Safari).
|
|
43
40
|
|
|
44
41
|
# Usage
|
|
45
42
|
|
|
46
|
-
##
|
|
47
|
-
```html
|
|
48
|
-
<script src="https://unpkg.com/@niivue/niivue@0.29.0/dist/niivue.umd.js"></script>
|
|
43
|
+
## Pure HTML
|
|
49
44
|
|
|
50
|
-
|
|
45
|
+
While NiiVue can be wrapped with frameworks (VueJS, React, Angular), you can also embed it directly into HTML web pages. Here is a minimal example:
|
|
51
46
|
|
|
47
|
+
```html
|
|
48
|
+
<!DOCTYPE html>
|
|
49
|
+
<html lang="en">
|
|
50
|
+
<head>
|
|
51
|
+
<meta charset="utf-8">
|
|
52
|
+
<title>NiiVue</title>
|
|
53
|
+
</head>
|
|
54
|
+
<body>
|
|
55
|
+
<canvas id="gl"></canvas>
|
|
56
|
+
</body>
|
|
57
|
+
<script src="https://unpkg.com/@niivue/niivue@0.29.0/dist/niivue.umd.js"></script>
|
|
52
58
|
<script>
|
|
53
|
-
|
|
54
|
-
// first object in array is background image
|
|
55
|
-
{
|
|
56
|
-
url: "./some_image.nii.gz",
|
|
57
|
-
}
|
|
58
|
-
]
|
|
59
|
-
|
|
60
|
-
// Niivue will adjust the canvas to 100% of its parent container's size
|
|
61
|
-
// the parent element can be any size you want (small or large)
|
|
59
|
+
var volumeList = [{url: "https://niivue.github.io/niivue-demo-images/mni152.nii.gz"}]
|
|
62
60
|
var nv = new niivue.Niivue()
|
|
63
|
-
nv.attachTo('gl')
|
|
61
|
+
nv.attachTo('gl')
|
|
64
62
|
nv.loadVolumes(volumeList)
|
|
65
|
-
nv.setSliceType(nv.sliceTypeMultiPlanar) // press the "v" key to cycle through views
|
|
66
63
|
</script>
|
|
64
|
+
</html>
|
|
67
65
|
```
|
|
68
66
|
|
|
69
67
|
## VueJS example
|
|
@@ -95,8 +93,7 @@ export default {
|
|
|
95
93
|
mounted() {
|
|
96
94
|
|
|
97
95
|
nv.attachTo('gl')
|
|
98
|
-
nv.loadVolumes(this.volumeList)
|
|
99
|
-
|
|
96
|
+
nv.loadVolumes(this.volumeList)
|
|
100
97
|
}
|
|
101
98
|
}
|
|
102
99
|
|
|
@@ -127,7 +124,7 @@ const NiiVue = ({ imageUrl }) => {
|
|
|
127
124
|
]
|
|
128
125
|
const nv = new Niivue()
|
|
129
126
|
nv.attachToCanvas(canvas.current)
|
|
130
|
-
nv.loadVolumes(volumeList)
|
|
127
|
+
nv.loadVolumes(volumeList)
|
|
131
128
|
}, [imageUrl])
|
|
132
129
|
|
|
133
130
|
return (
|
|
@@ -193,10 +190,11 @@ NiiVue can open several formats popular with brain imaging:
|
|
|
193
190
|
- 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
191
|
- 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
192
|
- 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
|
|
193
|
+
- DICOM: [DICOM](https://dicom.nema.org/medical/dicom/current/output/chtml/part10/chapter_7.html) and [DICOM Manifests](docs/development-notes/dicom-manifests.md)
|
|
196
194
|
|
|
197
195
|
# Alternatives
|
|
198
196
|
|
|
199
|
-
There are several open source JavaScript NIfTI viewers. What makes NiiVue unique is
|
|
197
|
+
There are several open source JavaScript NIfTI viewers. What makes NiiVue unique is how it leverages the shaders functions and 3D textures introduced with WebGL 2.0. The minimal design makes it easy to integrate with existing web pages quickly 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 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 (e.g. using VueJS, React, Angular or pure HTML). Since there are numerous free alternatives, you can choose the optimal tool for your task.
|
|
200
198
|
[Francesco Giorlando](https://f.giorlando.org/2018/07/web-viewers-for-fmri/) describes some of the differences between different tools.
|
|
201
199
|
|
|
202
200
|
| Tool | Live Demos |
|
|
@@ -205,8 +203,6 @@ There are several open source JavaScript NIfTI viewers. What makes NiiVue unique
|
|
|
205
203
|
| [BioImage Suite Web Project](https://github.com/bioimagesuiteweb/bisweb) | [live demo](https://bioimagesuiteweb.github.io/webapp/viewer.html) |
|
|
206
204
|
| [BrainBrowser](https://brainbrowser.cbrain.mcgill.ca/) | [live demo](https://brainbrowser.cbrain.mcgill.ca/volume-viewer) |
|
|
207
205
|
| [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
206
|
| [Papaya](https://github.com/rii-mango/Papaya) | [live demo](https://www.fmrib.ox.ac.uk/ukbiobank/group_means/index.html) |
|
|
211
207
|
| [VTK.js](https://github.com/Kitware/vtk-js) | [live demo](https://kitware.github.io/paraview-glance/app/) |
|
|
212
208
|
| [slicedrop](https://github.com/slicedrop/slicedrop.github.com) | [live demo](https://slicedrop.com/) |
|
|
@@ -233,20 +229,12 @@ npm install --save-dev @niivue/niivue
|
|
|
233
229
|
|
|
234
230
|
## Local Development
|
|
235
231
|
|
|
236
|
-
|
|
237
|
-
- `git clone git@github.com:niivue/niivue.git`
|
|
238
|
-
- `cd niivue`
|
|
239
|
-
- `npm install`
|
|
240
|
-
|
|
241
|
-
Source code can be found in `src/`.
|
|
242
|
-
|
|
243
|
-
You can edit the sources and then launch demos to see the effect of your changes. See the "Launch inlcluded demos" section.
|
|
244
|
-
|
|
245
|
-
## Run hot module reload development mode
|
|
246
|
-
|
|
247
|
-
This will run the vite HMR dev server. Open a browser to the URL output in your terminal. changes made to the source code will be immediately reflected in the browser.
|
|
232
|
+
Make sure you have nodejs and npm installed.
|
|
248
233
|
|
|
249
234
|
```
|
|
235
|
+
git clone git@github.com:niivue/niivue.git
|
|
236
|
+
cd niivue
|
|
237
|
+
npm install
|
|
250
238
|
npm run dev
|
|
251
239
|
```
|
|
252
240
|
|
|
@@ -334,7 +322,7 @@ npm run test -- -t 'test string'
|
|
|
334
322
|
|
|
335
323
|
# Contributing
|
|
336
324
|
|
|
337
|
-
|
|
325
|
+
Contributions to NiiVue are encouraged and welcomed. Feel free to update documentation, add features, fix bugs, or just ask questions on the [issue board](https://github.com/niivue/niivue/issues).
|
|
338
326
|
|
|
339
327
|
## Using Issues
|
|
340
328
|
|