@niivue/niivue 0.10.1 → 0.12.3
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 +69 -13
- package/dist/niivue.es.js +13950 -0
- package/dist/niivue.umd.js +541 -0
- package/package.json +26 -19
- package/src/cmaps/actc.json +9 -0
- package/src/cmaps/blue.json +9 -0
- package/src/cmaps/blue2red.json +9 -0
- package/src/cmaps/bluegrn.json +9 -0
- package/src/cmaps/bone.json +9 -0
- package/src/cmaps/bronze.json +9 -0
- package/src/cmaps/cividis.json +9 -0
- package/src/cmaps/cool.json +9 -0
- package/src/cmaps/copper.json +9 -0
- package/src/cmaps/copper2.json +9 -0
- package/src/cmaps/ct_airways.json +9 -0
- package/src/cmaps/ct_bones.json +9 -0
- package/src/cmaps/ct_brain.json +9 -0
- package/src/cmaps/ct_brain_gray.json +9 -0
- package/src/cmaps/ct_cardiac.json +9 -0
- package/src/cmaps/ct_head.json +9 -0
- package/src/cmaps/ct_kidneys.json +9 -0
- package/src/cmaps/ct_liver.json +9 -0
- package/src/cmaps/ct_muscles.json +9 -0
- package/src/cmaps/ct_scalp.json +9 -0
- package/src/cmaps/ct_skull.json +9 -0
- package/src/cmaps/ct_soft.json +9 -0
- package/src/cmaps/ct_soft_tissue.json +9 -0
- package/src/cmaps/ct_surface.json +9 -0
- package/src/cmaps/ct_vessels.json +9 -0
- package/src/cmaps/ct_w_contrast.json +9 -0
- package/src/cmaps/cubehelix.json +24 -0
- package/src/cmaps/electric_blue.json +9 -0
- package/src/cmaps/ge_color.json +9 -0
- package/src/cmaps/gold.json +9 -0
- package/src/cmaps/gray.json +9 -0
- package/src/cmaps/green.json +9 -0
- package/src/cmaps/hot.json +9 -0
- package/src/cmaps/hotiron.json +9 -0
- package/src/cmaps/hsv.json +9 -0
- package/src/cmaps/index.js +52 -0
- package/src/cmaps/inferno.json +9 -0
- package/src/cmaps/jet.json +9 -0
- package/src/cmaps/linspecer.json +9 -0
- package/src/cmaps/magma.json +9 -0
- package/src/cmaps/mako.json +9 -0
- package/src/cmaps/nih.json +9 -0
- package/src/cmaps/plasma.json +9 -0
- package/src/cmaps/random.json +92 -0
- package/src/cmaps/red.json +9 -0
- package/src/cmaps/redyell.json +9 -0
- package/src/cmaps/rocket.json +9 -0
- package/src/cmaps/surface.json +9 -0
- package/src/cmaps/violet.json +9 -0
- package/src/cmaps/viridis.json +9 -0
- package/src/cmaps/warm.json +9 -0
- package/src/cmaps/winter.json +9 -0
- package/src/cmaps/x_rain.json +9 -0
- package/src/fonts/Garamond.json +1491 -0
- package/src/fonts/Garamond.png +0 -0
- package/src/fonts/GaramondBold.json +1506 -0
- package/src/fonts/GaramondBold.png +0 -0
- package/src/fonts/Roboto-Regular.json +1496 -0
- package/src/fonts/Roboto-Regular.png +0 -0
- package/src/fonts/Ubuntu.json +1506 -0
- package/src/fonts/Ubuntu.png +0 -0
- package/src/fonts/UbuntuBold.json +1506 -0
- package/src/fonts/UbuntuBold.png +0 -0
- package/src/index.html +81 -0
- package/src/mni152.nii.gz +0 -0
- package/src/niivue-object3D.js +31 -0
- package/src/niivue-shader3D.js +11 -0
- package/src/niivue.js +2894 -0
- package/src/nvimage.js +567 -0
- package/src/shader-srcs.js +519 -0
- package/src/shader.js +76 -0
- package/dist/niivue.js +0 -2
package/README.md
CHANGED
|
@@ -4,6 +4,10 @@ NiiVue is a WebGL 2.0 medical image viewer. This repository contains the **core
|
|
|
4
4
|
|
|
5
5
|
The NiiVue package is intented to be used by individuals developing interactive web pages related to showing [nifti](https://nifti.nimh.nih.gov) images. 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
|
+
# Getting started Docs and References
|
|
8
|
+
|
|
9
|
+
[click here to go to the docs web page](https://niivue.github.io/niivue/devdocs/)
|
|
10
|
+
|
|
7
11
|
# Active Projects
|
|
8
12
|
|
|
9
13
|
[See our active projects here](https://github.com/orgs/niivue/projects)
|
|
@@ -33,8 +37,8 @@ We host many NiiVue examples via github pages. These are updated and deployed au
|
|
|
33
37
|
# Usage
|
|
34
38
|
|
|
35
39
|
## existing html page
|
|
36
|
-
```
|
|
37
|
-
<script src="https://unpkg.com/@niivue/niivue@0.
|
|
40
|
+
```html
|
|
41
|
+
<script src="https://unpkg.com/@niivue/niivue@0.12.3/dist/niivue.umd.js"></script>
|
|
38
42
|
|
|
39
43
|
<canvas id="gl" height=480 width=640></canvas>
|
|
40
44
|
|
|
@@ -45,11 +49,8 @@ We host many NiiVue examples via github pages. These are updated and deployed au
|
|
|
45
49
|
url: "./some_image.nii.gz",
|
|
46
50
|
volume: {hdr: null, img: null},
|
|
47
51
|
name: "some_image",
|
|
48
|
-
intensityMin: 0, // not used yet
|
|
49
|
-
intensityMax: 100, // not used yet
|
|
50
|
-
intensityRange:[0, 100], // not used yet
|
|
51
52
|
colorMap: "gray",
|
|
52
|
-
opacity:
|
|
53
|
+
opacity: 1,
|
|
53
54
|
visible: true,
|
|
54
55
|
}
|
|
55
56
|
]
|
|
@@ -59,16 +60,17 @@ We host many NiiVue examples via github pages. These are updated and deployed au
|
|
|
59
60
|
var nv = new niivue.Niivue()
|
|
60
61
|
nv.attachTo('gl') // the canvas element id
|
|
61
62
|
nv.loadVolumes(volumeList)
|
|
62
|
-
nv.setSliceType(nv.sliceTypeMultiPlanar)
|
|
63
|
+
nv.setSliceType(nv.sliceTypeMultiPlanar) // press the "v" key to cycle through views
|
|
63
64
|
</script>
|
|
64
65
|
```
|
|
65
66
|
|
|
66
67
|
## VueJS example
|
|
67
68
|
|
|
68
|
-
|
|
69
|
+
install: `npm i @niivue/niivue`
|
|
70
|
+
|
|
71
|
+
```js
|
|
69
72
|
<script>
|
|
70
73
|
import {Niivue} from '@niivue/niivue'
|
|
71
|
-
console.log(Niivue)
|
|
72
74
|
const nv = new Niivue()
|
|
73
75
|
|
|
74
76
|
|
|
@@ -84,7 +86,7 @@ export default {
|
|
|
84
86
|
url: "./mni152.nii.gz",
|
|
85
87
|
volume: {hdr: null, img: null},
|
|
86
88
|
colorMap: "gray",
|
|
87
|
-
opacity:
|
|
89
|
+
opacity: 1,
|
|
88
90
|
visible: true,
|
|
89
91
|
}
|
|
90
92
|
]
|
|
@@ -95,7 +97,7 @@ export default {
|
|
|
95
97
|
mounted() {
|
|
96
98
|
|
|
97
99
|
nv.attachTo('gl')
|
|
98
|
-
nv.loadVolumes(this.volumeList)
|
|
100
|
+
nv.loadVolumes(this.volumeList) // press the "v" key to cycle through views
|
|
99
101
|
|
|
100
102
|
}
|
|
101
103
|
}
|
|
@@ -116,13 +118,41 @@ export default {
|
|
|
116
118
|
|
|
117
119
|
## React example
|
|
118
120
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
+
install: `npm i @niivue/niivue`
|
|
122
|
+
|
|
123
|
+
```js
|
|
124
|
+
import { useRef, useState } from 'react'
|
|
125
|
+
import { Niivue } from '@niivue/niivue'
|
|
126
|
+
|
|
127
|
+
const NiiVue = ({ imageUrl }) => {
|
|
128
|
+
const canvas = useRef()
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
const volumeList = [
|
|
131
|
+
{
|
|
132
|
+
url: imageUrl,
|
|
133
|
+
volume: { hdr: null, img: null },
|
|
134
|
+
colorMap: 'gray',
|
|
135
|
+
opacity: 1,
|
|
136
|
+
visible: true,
|
|
137
|
+
},
|
|
138
|
+
]
|
|
139
|
+
const nv = new Niivue()
|
|
140
|
+
nv.attachToCanvas(canvas)
|
|
141
|
+
nv.loadVolumes(volumeList) // press the "v" key to cycle through volumes
|
|
142
|
+
}, [imageUrl])
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<canvas ref={canvas} height={480} width={640} />
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
121
150
|
# Contributors
|
|
122
151
|
|
|
123
152
|
- [Taylor Hanayik](https://github.com/hanayik)
|
|
124
153
|
- [Chris Rorden](https://github.com/neurolabusc)
|
|
125
154
|
- [Christopher Drake](https://github.com/cdrake)
|
|
155
|
+
- [Nell Hardcastle](https://github.com/nellh)
|
|
126
156
|
|
|
127
157
|
*To add yourself please create a PR
|
|
128
158
|
|
|
@@ -183,6 +213,14 @@ Source code can be found in `src/`.
|
|
|
183
213
|
|
|
184
214
|
You can edit the sources and then launch demos to see the effect of your changes. See the "Launch inlcluded demos" section.
|
|
185
215
|
|
|
216
|
+
## Run hot module reload development mode
|
|
217
|
+
|
|
218
|
+
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.
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
npm run dev
|
|
222
|
+
```
|
|
223
|
+
|
|
186
224
|
## Launch included demos
|
|
187
225
|
|
|
188
226
|
Launching the demos will format, build, and serve niivue demo pages. Open the demo URL in your browser to view the demo web pages. You can find the demo URL in your terminal after running `npm run demo`. The demos are intentionally simple, and each canvas showcases different NiiVue features.
|
|
@@ -233,7 +271,15 @@ Running the tests will format, build, and copy the bundled `niivue.js` to the `t
|
|
|
233
271
|
|
|
234
272
|
### on macOS and Linux
|
|
235
273
|
|
|
274
|
+
**If using macOS with Apple Silicon add this to your .zshrc (if zsh). Also ensure Chrome is installed at that location:**
|
|
275
|
+
|
|
276
|
+
```
|
|
277
|
+
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
|
278
|
+
export PUPPETEER_EXECUTABLE_PATH=/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
|
|
279
|
+
```
|
|
280
|
+
|
|
236
281
|
```
|
|
282
|
+
npm install
|
|
237
283
|
npm run test
|
|
238
284
|
```
|
|
239
285
|
|
|
@@ -305,4 +351,14 @@ cd src/cmaps
|
|
|
305
351
|
for f in ls *.json; do echo "export { default as `basename $f .json` } from './$f';" >> index.js; done;
|
|
306
352
|
```
|
|
307
353
|
|
|
354
|
+
## macOS kill test server if kept alive because of failing tests
|
|
355
|
+
|
|
356
|
+
```
|
|
357
|
+
sudo lsof -iTCP -sTCP:LISTEN -n -P | grep 8888 # 8888 is the test server used by jest
|
|
358
|
+
|
|
359
|
+
# the process id is the second column in the result
|
|
360
|
+
|
|
361
|
+
kill <pid> # kill the node process running the server if needed (when tests fail locally)
|
|
362
|
+
```
|
|
363
|
+
|
|
308
364
|
|