@niivue/niivue 0.10.1 → 0.12.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 +65 -13
- package/dist/niivue.es.js +13937 -0
- package/dist/niivue.umd.js +541 -0
- package/package.json +22 -17
- 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 +80 -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 +2643 -0
- package/src/nvimage.js +486 -0
- package/src/shader-srcs.js +519 -0
- package/src/shader.js +76 -0
- package/dist/niivue.js +0 -2
package/README.md
CHANGED
|
@@ -33,8 +33,8 @@ We host many NiiVue examples via github pages. These are updated and deployed au
|
|
|
33
33
|
# Usage
|
|
34
34
|
|
|
35
35
|
## existing html page
|
|
36
|
-
```
|
|
37
|
-
<script src="https://unpkg.com/@niivue/niivue@0.
|
|
36
|
+
```html
|
|
37
|
+
<script src="https://unpkg.com/@niivue/niivue@0.12.0/dist/niivue.js"></script>
|
|
38
38
|
|
|
39
39
|
<canvas id="gl" height=480 width=640></canvas>
|
|
40
40
|
|
|
@@ -45,11 +45,8 @@ We host many NiiVue examples via github pages. These are updated and deployed au
|
|
|
45
45
|
url: "./some_image.nii.gz",
|
|
46
46
|
volume: {hdr: null, img: null},
|
|
47
47
|
name: "some_image",
|
|
48
|
-
intensityMin: 0, // not used yet
|
|
49
|
-
intensityMax: 100, // not used yet
|
|
50
|
-
intensityRange:[0, 100], // not used yet
|
|
51
48
|
colorMap: "gray",
|
|
52
|
-
opacity:
|
|
49
|
+
opacity: 1,
|
|
53
50
|
visible: true,
|
|
54
51
|
}
|
|
55
52
|
]
|
|
@@ -59,16 +56,17 @@ We host many NiiVue examples via github pages. These are updated and deployed au
|
|
|
59
56
|
var nv = new niivue.Niivue()
|
|
60
57
|
nv.attachTo('gl') // the canvas element id
|
|
61
58
|
nv.loadVolumes(volumeList)
|
|
62
|
-
nv.setSliceType(nv.sliceTypeMultiPlanar)
|
|
59
|
+
nv.setSliceType(nv.sliceTypeMultiPlanar) // press the "v" key to cycle through views
|
|
63
60
|
</script>
|
|
64
61
|
```
|
|
65
62
|
|
|
66
63
|
## VueJS example
|
|
67
64
|
|
|
68
|
-
|
|
65
|
+
install: `npm i @niivue/niivue`
|
|
66
|
+
|
|
67
|
+
```js
|
|
69
68
|
<script>
|
|
70
69
|
import {Niivue} from '@niivue/niivue'
|
|
71
|
-
console.log(Niivue)
|
|
72
70
|
const nv = new Niivue()
|
|
73
71
|
|
|
74
72
|
|
|
@@ -84,7 +82,7 @@ export default {
|
|
|
84
82
|
url: "./mni152.nii.gz",
|
|
85
83
|
volume: {hdr: null, img: null},
|
|
86
84
|
colorMap: "gray",
|
|
87
|
-
opacity:
|
|
85
|
+
opacity: 1,
|
|
88
86
|
visible: true,
|
|
89
87
|
}
|
|
90
88
|
]
|
|
@@ -95,7 +93,7 @@ export default {
|
|
|
95
93
|
mounted() {
|
|
96
94
|
|
|
97
95
|
nv.attachTo('gl')
|
|
98
|
-
nv.loadVolumes(this.volumeList)
|
|
96
|
+
nv.loadVolumes(this.volumeList) // press the "v" key to cycle through views
|
|
99
97
|
|
|
100
98
|
}
|
|
101
99
|
}
|
|
@@ -116,13 +114,41 @@ export default {
|
|
|
116
114
|
|
|
117
115
|
## React example
|
|
118
116
|
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
install: `npm i @niivue/niivue`
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
import { useRef, useState } from 'react'
|
|
121
|
+
import { Niivue } from '@niivue/niivue'
|
|
122
|
+
|
|
123
|
+
const NiiVue = ({ imageUrl }) => {
|
|
124
|
+
const canvas = useRef()
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
const volumeList = [
|
|
127
|
+
{
|
|
128
|
+
url: imageUrl,
|
|
129
|
+
volume: { hdr: null, img: null },
|
|
130
|
+
colorMap: 'gray',
|
|
131
|
+
opacity: 1,
|
|
132
|
+
visible: true,
|
|
133
|
+
},
|
|
134
|
+
]
|
|
135
|
+
const nv = new Niivue()
|
|
136
|
+
nv.attachToCanvas(canvas)
|
|
137
|
+
nv.loadVolumes(volumeList) // press the "v" key to cycle through volumes
|
|
138
|
+
}, [imageUrl])
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<canvas ref={canvas} height={480} width={640} />
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
121
146
|
# Contributors
|
|
122
147
|
|
|
123
148
|
- [Taylor Hanayik](https://github.com/hanayik)
|
|
124
149
|
- [Chris Rorden](https://github.com/neurolabusc)
|
|
125
150
|
- [Christopher Drake](https://github.com/cdrake)
|
|
151
|
+
- [Nell Hardcastle](https://github.com/nellh)
|
|
126
152
|
|
|
127
153
|
*To add yourself please create a PR
|
|
128
154
|
|
|
@@ -183,6 +209,14 @@ Source code can be found in `src/`.
|
|
|
183
209
|
|
|
184
210
|
You can edit the sources and then launch demos to see the effect of your changes. See the "Launch inlcluded demos" section.
|
|
185
211
|
|
|
212
|
+
## Run hot module reload development mode
|
|
213
|
+
|
|
214
|
+
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.
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
npm run dev
|
|
218
|
+
```
|
|
219
|
+
|
|
186
220
|
## Launch included demos
|
|
187
221
|
|
|
188
222
|
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 +267,15 @@ Running the tests will format, build, and copy the bundled `niivue.js` to the `t
|
|
|
233
267
|
|
|
234
268
|
### on macOS and Linux
|
|
235
269
|
|
|
270
|
+
**If using macOS with Apple Silicon add this to your .zshrc (if zsh). Also ensure Chrome is installed at that location:**
|
|
271
|
+
|
|
272
|
+
```
|
|
273
|
+
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
|
274
|
+
export PUPPETEER_EXECUTABLE_PATH=/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
|
|
275
|
+
```
|
|
276
|
+
|
|
236
277
|
```
|
|
278
|
+
npm install
|
|
237
279
|
npm run test
|
|
238
280
|
```
|
|
239
281
|
|
|
@@ -305,4 +347,14 @@ cd src/cmaps
|
|
|
305
347
|
for f in ls *.json; do echo "export { default as `basename $f .json` } from './$f';" >> index.js; done;
|
|
306
348
|
```
|
|
307
349
|
|
|
350
|
+
## macOS kill test server if kept alive because of failing tests
|
|
351
|
+
|
|
352
|
+
```
|
|
353
|
+
sudo lsof -iTCP -sTCP:LISTEN -n -P | grep 8888 # 8888 is the test server used by jest
|
|
354
|
+
|
|
355
|
+
# the process id is the second column in the result
|
|
356
|
+
|
|
357
|
+
kill <pid> # kill the node process running the server if needed (when tests fail locally)
|
|
358
|
+
```
|
|
359
|
+
|
|
308
360
|
|