@niivue/niivue 1.0.0-rc.21 → 1.0.0-rc.210

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.
Files changed (335) hide show
  1. package/README.md +134 -8
  2. package/dist/NVConstants.d.ts +41 -8
  3. package/dist/NVControlBase.d.ts +711 -68
  4. package/dist/NVDocument.d.ts +69 -28
  5. package/dist/NVEvents.d.ts +12 -2
  6. package/dist/NVLoader.d.ts +28 -1
  7. package/dist/NVModel.d.ts +35 -3
  8. package/dist/NVTypes.d.ts +474 -27
  9. package/dist/annotation/delta.d.ts +12 -0
  10. package/dist/annotation/index.d.ts +3 -3
  11. package/dist/annotation/multiClick.d.ts +5 -2
  12. package/dist/annotation/selection.d.ts +8 -1
  13. package/dist/annotation/shapes.d.ts +8 -1
  14. package/dist/assets/fonts/index.d.ts +1 -0
  15. package/dist/assets/fonts/index.js +1 -4
  16. package/dist/assets/matcaps/index.d.ts +1 -0
  17. package/dist/assets/matcaps/index.js +1 -6
  18. package/dist/byteLru.d.ts +89 -0
  19. package/dist/cmap/NVCmaps.d.ts +83 -5
  20. package/dist/cmap/luts/_registry.d.ts +563 -0
  21. package/dist/cmap/luts/actc.json.d.ts +10 -0
  22. package/dist/cmap/luts/afni_blues_inv.json.d.ts +12 -0
  23. package/dist/cmap/luts/afni_reds_inv.json.d.ts +10 -0
  24. package/dist/cmap/luts/batlow.json.d.ts +25 -0
  25. package/dist/cmap/luts/bcgwhw.json.d.ts +35 -0
  26. package/dist/cmap/luts/bcgwhw_dark.json.d.ts +35 -0
  27. package/dist/cmap/luts/blue.json.d.ts +10 -0
  28. package/dist/cmap/luts/blue2cyan.json.d.ts +10 -0
  29. package/dist/cmap/luts/blue2magenta.json.d.ts +10 -0
  30. package/dist/cmap/luts/blue2red.json.d.ts +10 -0
  31. package/dist/cmap/luts/bluegrn.json.d.ts +10 -0
  32. package/dist/cmap/luts/bone.json.d.ts +10 -0
  33. package/dist/cmap/luts/bronze.json.d.ts +10 -0
  34. package/dist/cmap/luts/cet_l17.json.d.ts +96 -0
  35. package/dist/cmap/luts/cividis.json.d.ts +10 -0
  36. package/dist/cmap/luts/cool.json.d.ts +10 -0
  37. package/dist/cmap/luts/copper.json.d.ts +10 -0
  38. package/dist/cmap/luts/copper2.json.d.ts +10 -0
  39. package/dist/cmap/luts/ct_airways.json.d.ts +12 -0
  40. package/dist/cmap/luts/ct_artery.json.d.ts +12 -0
  41. package/dist/cmap/luts/ct_bones.json.d.ts +12 -0
  42. package/dist/cmap/luts/ct_brain.json.d.ts +12 -0
  43. package/dist/cmap/luts/ct_brain_gray.json.d.ts +12 -0
  44. package/dist/cmap/luts/ct_cardiac.json.d.ts +12 -0
  45. package/dist/cmap/luts/ct_head.json.d.ts +12 -0
  46. package/dist/cmap/luts/ct_kidneys.json.d.ts +12 -0
  47. package/dist/cmap/luts/ct_liver.json.d.ts +12 -0
  48. package/dist/cmap/luts/ct_muscles.json.d.ts +12 -0
  49. package/dist/cmap/luts/ct_scalp.json.d.ts +12 -0
  50. package/dist/cmap/luts/ct_skull.json.d.ts +12 -0
  51. package/dist/cmap/luts/ct_soft.json.d.ts +12 -0
  52. package/dist/cmap/luts/ct_soft_tissue.json.d.ts +12 -0
  53. package/dist/cmap/luts/ct_surface.json.d.ts +12 -0
  54. package/dist/cmap/luts/ct_vessels.json.d.ts +12 -0
  55. package/dist/cmap/luts/ct_w_contrast.json.d.ts +12 -0
  56. package/dist/cmap/luts/cubehelix.json.d.ts +25 -0
  57. package/dist/cmap/luts/cyan.json.d.ts +10 -0
  58. package/dist/cmap/luts/draw.json.d.ts +20 -0
  59. package/dist/cmap/luts/electric_blue.json.d.ts +10 -0
  60. package/dist/cmap/luts/freesurfer.json.d.ts +32 -0
  61. package/dist/cmap/luts/ge_color.json.d.ts +10 -0
  62. package/dist/cmap/luts/gold.json.d.ts +10 -0
  63. package/dist/cmap/luts/gray.json.d.ts +10 -0
  64. package/dist/cmap/luts/green.json.d.ts +10 -0
  65. package/dist/cmap/luts/green2cyan.json.d.ts +10 -0
  66. package/dist/cmap/luts/green2orange.json.d.ts +10 -0
  67. package/dist/cmap/luts/hot.json.d.ts +10 -0
  68. package/dist/cmap/luts/hotiron.json.d.ts +10 -0
  69. package/dist/cmap/luts/hsv.json.d.ts +10 -0
  70. package/dist/cmap/luts/inferno.json.d.ts +10 -0
  71. package/dist/cmap/luts/itksnap.json.d.ts +59 -0
  72. package/dist/cmap/luts/jet.json.d.ts +10 -0
  73. package/dist/cmap/luts/kry.json.d.ts +10 -0
  74. package/dist/cmap/luts/linspecer.json.d.ts +10 -0
  75. package/dist/cmap/luts/lipari.json.d.ts +25 -0
  76. package/dist/cmap/luts/magma.json.d.ts +10 -0
  77. package/dist/cmap/luts/mako.json.d.ts +10 -0
  78. package/dist/cmap/luts/navia.json.d.ts +25 -0
  79. package/dist/cmap/luts/nih.json.d.ts +10 -0
  80. package/dist/cmap/luts/plasma.json.d.ts +10 -0
  81. package/dist/cmap/luts/red.json.d.ts +10 -0
  82. package/dist/cmap/luts/redyell.json.d.ts +10 -0
  83. package/dist/cmap/luts/rocket.json.d.ts +10 -0
  84. package/dist/cmap/luts/roi_i256.json.d.ts +100 -0
  85. package/dist/cmap/luts/slicer3d.json.d.ts +358 -0
  86. package/dist/cmap/luts/surface.json.d.ts +10 -0
  87. package/dist/cmap/luts/thermal.json.d.ts +25 -0
  88. package/dist/cmap/luts/turbo.json.d.ts +10 -0
  89. package/dist/cmap/luts/violet.json.d.ts +10 -0
  90. package/dist/cmap/luts/viridis.json.d.ts +10 -0
  91. package/dist/cmap/luts/warm.json.d.ts +10 -0
  92. package/dist/cmap/luts/winter.json.d.ts +10 -0
  93. package/dist/cmap/luts/x_rain.json.d.ts +10 -0
  94. package/dist/cmap/luts/yellow.json.d.ts +10 -0
  95. package/dist/control/NVCanvasViewportController.d.ts +3 -0
  96. package/dist/control/animate.d.ts +100 -0
  97. package/dist/control/canvasRegistry.d.ts +35 -0
  98. package/dist/control/instances.d.ts +13 -0
  99. package/dist/control/interactions.d.ts +1 -0
  100. package/dist/control/locationTracking.d.ts +5 -4
  101. package/dist/control/measurements.d.ts +0 -2
  102. package/dist/control/pinchZoom.d.ts +14 -2
  103. package/dist/control/viewBoth.d.ts +4 -29
  104. package/dist/control/viewLifecycle.d.ts +7 -0
  105. package/dist/control/viewSingle.d.ts +11 -0
  106. package/dist/control/viewWebGL2.d.ts +1 -11
  107. package/dist/control/viewWebGPU.d.ts +1 -11
  108. package/dist/control/wheelZoomAnchor.d.ts +1 -1
  109. package/dist/core-BANDcQC8.js +42839 -0
  110. package/dist/devicePixelRatio.d.ts +6 -0
  111. package/dist/documentBounds.d.ts +33 -0
  112. package/dist/documentColormaps.d.ts +43 -0
  113. package/dist/documentEvents.d.ts +24 -0
  114. package/dist/documentJson.d.ts +7 -2
  115. package/dist/documentLegend.d.ts +17 -0
  116. package/dist/documentLinkData.d.ts +1 -1
  117. package/dist/documentLinks.d.ts +24 -0
  118. package/dist/documentMatcap.d.ts +27 -0
  119. package/dist/documentMeshLayers.d.ts +2 -3
  120. package/dist/documentSources.d.ts +72 -0
  121. package/dist/documentVolumeOptions.d.ts +4 -4
  122. package/dist/drawing/drawingManager.d.ts +0 -20
  123. package/dist/drawing/penTool.d.ts +2 -2
  124. package/dist/fonts-DGsgW9tm.js +1741 -0
  125. package/dist/gl/NVViewGL.d.ts +24 -4
  126. package/dist/gl/bench.d.ts +1 -3
  127. package/dist/gl/blendOverlays.d.ts +11 -0
  128. package/dist/gl/boxLine.d.ts +17 -0
  129. package/dist/gl/boxLineShader.d.ts +2 -0
  130. package/dist/gl/cinematic.d.ts +95 -0
  131. package/dist/gl/cinematicShader.d.ts +31 -0
  132. package/dist/gl/colorLut.d.ts +9 -0
  133. package/dist/gl/colorbar.d.ts +8 -17
  134. package/dist/gl/crosshair.d.ts +1 -0
  135. package/dist/gl/depthPickShader.d.ts +1 -1
  136. package/dist/gl/font.d.ts +3 -7
  137. package/dist/gl/glUtil.d.ts +25 -0
  138. package/dist/gl/mesh.d.ts +4 -2
  139. package/dist/gl/meshShader.d.ts +2 -0
  140. package/dist/gl/orientChunked.d.ts +2 -2
  141. package/dist/gl/orientOverlay.d.ts +3 -2
  142. package/dist/gl/panelShader.d.ts +2 -2
  143. package/dist/gl/polygon.d.ts +1 -3
  144. package/dist/gl/polygon3d.d.ts +1 -3
  145. package/dist/gl/render.d.ts +70 -188
  146. package/dist/gl/renderShader.d.ts +1 -1
  147. package/dist/gl/slice.d.ts +2 -0
  148. package/dist/gl/sliceShader.d.ts +1 -1
  149. package/dist/gl/slide.d.ts +38 -8
  150. package/dist/gl/slidePlaneRender.d.ts +36 -3
  151. package/dist/gl/slideShader.d.ts +3 -2
  152. package/dist/gl/tileFuse.d.ts +38 -0
  153. package/dist/gl/tileGutter.d.ts +26 -0
  154. package/dist/index.d.ts +31 -19
  155. package/dist/index.webgl2.d.ts +31 -19
  156. package/dist/index.webgpu.d.ts +31 -19
  157. package/dist/matcaps-KEJitnW8.js +3 -0
  158. package/dist/math/NVTransforms.d.ts +18 -4
  159. package/dist/mesh/NVMesh.d.ts +9 -0
  160. package/dist/mesh/connectome/fileData.d.ts +21 -0
  161. package/dist/mesh/connectome/index.d.ts +1 -20
  162. package/dist/mesh/connectome/readers/_registry.d.ts +11 -0
  163. package/dist/mesh/connectome/readers/fsPointset.d.ts +10 -0
  164. package/dist/mesh/connectome/readers/jcon.d.ts +1 -1
  165. package/dist/mesh/layers/index.d.ts +8 -2
  166. package/dist/mesh/layers/readers/_registry.d.ts +15 -0
  167. package/dist/mesh/layers/readers/annot.d.ts +16 -0
  168. package/dist/mesh/layers/readers/curv.d.ts +2 -1
  169. package/dist/mesh/layers/readers/smp.d.ts +2 -1
  170. package/dist/mesh/layers/readers/stc.d.ts +2 -1
  171. package/dist/mesh/readers/_registry.d.ts +41 -0
  172. package/dist/mesh/readers/asc.d.ts +2 -0
  173. package/dist/mesh/shownIndices.d.ts +10 -0
  174. package/dist/mesh/tracts/readers/_registry.d.ts +17 -0
  175. package/dist/mesh/tracts/readers/tck.d.ts +6 -0
  176. package/dist/mesh/tracts/readers/tract.d.ts +4 -0
  177. package/dist/mesh/triangleClusters.d.ts +40 -0
  178. package/dist/mesh/vertexFormat.d.ts +16 -3
  179. package/dist/mesh/writers/_registry.d.ts +15 -0
  180. package/dist/mesh/writers/index.d.ts +1 -2
  181. package/dist/mesh/writers/mz3.d.ts +2 -1
  182. package/dist/niivue.js +109 -146
  183. package/dist/niivue.webgl2.js +18 -206
  184. package/dist/niivue.webgpu.js +18 -204
  185. package/dist/scene/NvSceneController.d.ts +145 -0
  186. package/dist/scene/layouts.d.ts +21 -0
  187. package/dist/scene/types.d.ts +18 -0
  188. package/dist/scene.js +557 -0
  189. package/dist/signal/readers/_registry.d.ts +11 -0
  190. package/dist/slide/NVSlide.d.ts +571 -111
  191. package/dist/slide/colorLutShader.d.ts +8 -0
  192. package/dist/slide/dziSource.d.ts +4 -3
  193. package/dist/slide/slideChannels.d.ts +29 -0
  194. package/dist/slide/slideController.d.ts +137 -0
  195. package/dist/slide/slideDrawing.d.ts +10 -0
  196. package/dist/slide/slideFuse.d.ts +198 -0
  197. package/dist/slide/slideLoadQueue.d.ts +36 -0
  198. package/dist/slide/slideLod.d.ts +86 -0
  199. package/dist/slide/slideOverlay.d.ts +50 -0
  200. package/dist/slide/slidePlacement.d.ts +88 -0
  201. package/dist/slide/slidePlane.d.ts +82 -24
  202. package/dist/slide/slideSource.d.ts +163 -0
  203. package/dist/slide/slideThumbnail.d.ts +12 -0
  204. package/dist/slide/slideTiles.d.ts +124 -0
  205. package/dist/slide/slideView.d.ts +108 -0
  206. package/dist/slide/slideViewBoth.d.ts +6 -0
  207. package/dist/slide/slideViewWebGL2.d.ts +5 -0
  208. package/dist/slide/slideViewWebGPU.d.ts +5 -0
  209. package/dist/slide/tileGutter.d.ts +121 -0
  210. package/dist/slide/tileTextureCache.d.ts +33 -5
  211. package/dist/slide/volumeSliceSource.d.ts +25 -19
  212. package/dist/slideViewWebGL2-DTV6c4AF.js +5547 -0
  213. package/dist/slideViewWebGPU-kkwLzgMY.js +5635 -0
  214. package/dist/standalone/assets/fonts/index.js +1 -0
  215. package/dist/standalone/assets/matcaps/index.js +1 -0
  216. package/dist/standalone/chunks/core-C_xNJ_6T.js +108 -0
  217. package/dist/standalone/chunks/fonts-CJneqA-R.js +3 -0
  218. package/dist/standalone/chunks/matcaps-BDC36G_o.js +1 -0
  219. package/dist/standalone/chunks/slideViewWebGL2-DABfVPYd.js +3380 -0
  220. package/dist/standalone/chunks/slideViewWebGPU-B6VxC89f.js +3916 -0
  221. package/dist/standalone/chunks/viewSingle-D05PH_w3.js +1 -0
  222. package/dist/standalone/niivue.js +1 -0
  223. package/dist/standalone/niivue.webgl2.js +1 -0
  224. package/dist/standalone/niivue.webgpu.js +1 -0
  225. package/dist/standalone/viewport.js +1 -0
  226. package/dist/testing/headless.d.ts +66 -0
  227. package/dist/testing/nimlTract.d.ts +2 -0
  228. package/dist/view/NVAnnotation.d.ts +5 -8
  229. package/dist/view/NVBench.d.ts +20 -0
  230. package/dist/view/NVBoxEdges.d.ts +22 -0
  231. package/dist/view/NVCinematic.d.ts +232 -0
  232. package/dist/view/NVColorbar.d.ts +3 -0
  233. package/dist/view/NVColorbarRenderer.d.ts +23 -0
  234. package/dist/view/NVCrosscut.d.ts +13 -0
  235. package/dist/view/NVCrosshair.d.ts +8 -0
  236. package/dist/view/NVDrawingTexture.d.ts +7 -0
  237. package/dist/view/NVFont.d.ts +11 -0
  238. package/dist/view/NVFontRenderer.d.ts +16 -0
  239. package/dist/view/NVGraph.d.ts +7 -4
  240. package/dist/view/NVLegend.d.ts +55 -6
  241. package/dist/view/NVLine.d.ts +0 -29
  242. package/dist/view/NVMeasurement.d.ts +36 -0
  243. package/dist/view/NVOrient.d.ts +14 -0
  244. package/dist/view/NVOverlayHook.d.ts +8 -0
  245. package/dist/view/NVPerfMarks.d.ts +9 -4
  246. package/dist/view/NVPlaneOutline.d.ts +19 -0
  247. package/dist/view/NVRuler.d.ts +31 -3
  248. package/dist/view/NVSliceLayout.d.ts +78 -9
  249. package/dist/view/NVVolumeVisibility.d.ts +46 -0
  250. package/dist/view/chunkStackFuse.d.ts +88 -0
  251. package/dist/view/matcapFallback.d.ts +7 -0
  252. package/dist/view/orientationLabels.d.ts +53 -0
  253. package/dist/view/sliceUtils.d.ts +9 -1
  254. package/dist/view/tickSpacing.d.ts +2 -0
  255. package/dist/view/volumeUpdateScope.d.ts +10 -3
  256. package/dist/viewSingle-DkMqnJku.js +65 -0
  257. package/dist/viewport.js +173 -161
  258. package/dist/volume/ChunkExplode.d.ts +20 -0
  259. package/dist/volume/ChunkResidency.d.ts +49 -35
  260. package/dist/volume/ChunkStreamRenderer.d.ts +354 -0
  261. package/dist/volume/ChunkVisibility.d.ts +20 -10
  262. package/dist/volume/ChunkedVolumeSource.d.ts +17 -1
  263. package/dist/volume/NVChunkedVolume.d.ts +187 -31
  264. package/dist/volume/allenAtlas.d.ts +1 -1
  265. package/dist/volume/allenAtlasLoader.d.ts +0 -6
  266. package/dist/volume/budgetPlans.d.ts +16 -1
  267. package/dist/volume/ccf.d.ts +41 -0
  268. package/dist/volume/channelColormaps.d.ts +32 -2
  269. package/dist/volume/channelVolumeFile.d.ts +6 -2
  270. package/dist/volume/chunkBudget.d.ts +21 -0
  271. package/dist/volume/chunkFetch.d.ts +45 -0
  272. package/dist/volume/chunkPlanMessage.d.ts +18 -0
  273. package/dist/volume/chunkPrediction.d.ts +19 -0
  274. package/dist/volume/chunkRender.d.ts +60 -0
  275. package/dist/volume/chunkTiming.d.ts +1 -1
  276. package/dist/volume/chunking.d.ts +23 -21
  277. package/dist/volume/decodedChunkCache.d.ts +11 -79
  278. package/dist/volume/imageDecode.d.ts +10 -0
  279. package/dist/volume/loadBridge.d.ts +0 -2
  280. package/dist/volume/omeTiff.d.ts +3 -1
  281. package/dist/volume/omeTiffLoader.d.ts +0 -6
  282. package/dist/volume/orientChunked.d.ts +31 -17
  283. package/dist/volume/overlayBlend.d.ts +10 -5
  284. package/dist/volume/pairedImage.d.ts +23 -0
  285. package/dist/volume/readers/_registry.d.ts +35 -0
  286. package/dist/volume/readers/fib.d.ts +3 -1
  287. package/dist/volume/readers/mgh.d.ts +1 -1
  288. package/dist/volume/readers/tiff.d.ts +1 -1
  289. package/dist/volume/regionDescriptives.d.ts +30 -0
  290. package/dist/volume/streamingVolume.d.ts +5 -6
  291. package/dist/volume/transforms/_registry.d.ts +2 -0
  292. package/dist/volume/transforms/index.d.ts +0 -12
  293. package/dist/volume/utils.d.ts +86 -3
  294. package/dist/volume/volumeIds.d.ts +16 -0
  295. package/dist/volume/writers/_registry.d.ts +11 -0
  296. package/dist/wgpu/NVViewGPU.d.ts +28 -4
  297. package/dist/wgpu/bench.d.ts +1 -3
  298. package/dist/wgpu/blendOverlays.d.ts +12 -0
  299. package/dist/wgpu/boxLine.d.ts +18 -0
  300. package/dist/wgpu/cinematic.d.ts +86 -0
  301. package/dist/wgpu/colorLut.d.ts +13 -0
  302. package/dist/wgpu/colorbar.d.ts +8 -17
  303. package/dist/wgpu/depthPick.d.ts +1 -1
  304. package/dist/wgpu/font.d.ts +5 -7
  305. package/dist/wgpu/line.d.ts +2 -1
  306. package/dist/wgpu/mesh.d.ts +13 -1
  307. package/dist/wgpu/orient.d.ts +13 -11
  308. package/dist/wgpu/orientChunked.d.ts +2 -2
  309. package/dist/wgpu/pipeline.d.ts +24 -0
  310. package/dist/wgpu/render.d.ts +58 -189
  311. package/dist/wgpu/sceneCapture.d.ts +18 -0
  312. package/dist/wgpu/slice.d.ts +1 -0
  313. package/dist/wgpu/slide.d.ts +60 -9
  314. package/dist/wgpu/slidePlaneRender.d.ts +33 -9
  315. package/dist/wgpu/tileFuse.d.ts +46 -0
  316. package/dist/wgpu/tileGutter.d.ts +27 -0
  317. package/dist/wgpu/volumeShaderLib.d.ts +1 -1
  318. package/dist/workers/pageWorker.d.ts +10 -0
  319. package/dist/workers/transform.worker.d.ts +2 -2
  320. package/dist/workers/workerPost.d.ts +1 -0
  321. package/package.json +35 -17
  322. package/dist/cortex-CBhDullr.js +0 -4
  323. package/dist/fetchOmeZarrChunkedSource-CIkXzcEM.js +0 -49358
  324. package/dist/index-Cbb_IM7q.js +0 -148
  325. package/dist/omeZarrChunkWorkerPool-DcJBdCFl.js +0 -179
  326. package/dist/slide-4q4P_FGk.js +0 -310
  327. package/dist/slide-oBdx2X1m.js +0 -234
  328. package/dist/volume/chunkWorkerRouting.d.ts +0 -42
  329. package/dist/volume/fetchOmeZarrChunkedSource.d.ts +0 -10
  330. package/dist/volume/omeZarr.d.ts +0 -114
  331. package/dist/volume/omeZarrChunkWorkerPool.d.ts +0 -51
  332. package/dist/volume/omeZarrChunkedSource.d.ts +0 -208
  333. package/dist/volume/omeZarrLoader.d.ts +0 -163
  334. package/dist/volume/persistentByteCache.d.ts +0 -241
  335. package/dist/workers/omeZarrChunk.worker.d.ts +0 -25
package/README.md CHANGED
@@ -2,20 +2,23 @@
2
2
 
3
3
  NiiVue is a tool for visualizing volumes, meshes, and tractography streamlines commonly used in neuroimaging. The original NiiVue project evolved organically, resulting in tightly coupled model, view, and controller components. This repository refactors the codebase to improve maintainability and to support emerging technologies such as WebGPU.
4
4
 
5
+ Documentation: https://niivue.github.io/mono/docs/guide/
6
+
5
7
  ## Getting Started
6
8
 
7
9
  ### Prerequisites
8
10
 
9
11
  - [Bun](https://bun.sh/)
10
12
  - A browser with WebGPU support (Chrome, Firefox). Safari works if you have a recent MacOS (version 26) or iOS. Older browsers will fall back to the WebGL2 renderer.
13
+ - Slides (`NVSlide`) need `AbortSignal.any` (Chrome 116, Firefox 124, Safari 17.4); `@niivue/nv-ext-tile` DICOM-WSI indexing also needs resizable `ArrayBuffer`s (Chrome 111, Firefox 128, Safari 16.4) and says so when they are missing.
11
14
 
12
15
  ### Build Commands
13
16
 
14
17
  ```bash
15
18
  bun install # Install dependencies
16
19
  bun run dev # Hot-reload dev server
17
- bun run build # Library build to ./dist (published npm package)
18
- bun run deploy # Production examples-site build to ./dist (GitHub Pages)
20
+ bun run build # Library build to ./dist (published npm package), incl. dist/standalone
21
+ bun run deploy # Production examples-site build to ./dist-examples (GitHub Pages)
19
22
  bun run demo # Build examples site and serve locally
20
23
  bun run lint # Biome check
21
24
  bun run lint:fix # Biome auto-fix
@@ -35,7 +38,7 @@ The normal audit includes tests, examples (including their worker), and standalo
35
38
  scripts. The production configuration checks library sources without treating
36
39
  examples or test consumers as usage; it retains Vite support for `import.meta.glob`.
37
40
  Both protect exports from all published package entry points. These targets scope
38
- reporting to `packages/niivue`; they are not a complete audit of the monorepo.
41
+ reporting to `packages/niivue`; `bun run knip` at the root audits the whole monorepo.
39
42
 
40
43
  This is a manual review tool, not a CI gate. It exits with status 1 while findings
41
44
  remain, including deliberately deferred exports. An unused export is a candidate,
@@ -67,8 +70,8 @@ in production is one well-predicted branch per call site. See
67
70
 
68
71
  ### Development Workflows
69
72
 
70
- - **`bun run dev`** — Serves the `examples/` pages from source with hot reloading at `localhost:5273`. The pages `import '../src/index.ts'` directly, so dev and the deployed build run the same files. On-demand sample data (OME-Zarr, DICOM-WSI) is downloaded into `public/` if missing.
71
- - **`bun run demo`** — Builds the examples site to `dist/` and serves it with `http-server`. Use this to test the actual built output or before deploying to GitHub Pages.
73
+ - **`bun run dev`** — Serves the `examples/` pages from source with hot reloading at `localhost:5273`. The pages `import '../src/index.ts'` directly, so dev and the deployed build run the same files. On-demand sample data (DICOM-WSI) is downloaded into `public/` if missing.
74
+ - **`bun run demo`** — Builds the examples site to `dist-examples/` and serves it with `vite preview`. Use this to test the actual built output or before deploying to GitHub Pages.
72
75
 
73
76
  ## Usage
74
77
 
@@ -87,10 +90,13 @@ Add a `<canvas>` to your page and attach NiiVue to it:
87
90
 
88
91
  ### Backend-specific distributions
89
92
 
90
- By default, `@niivue/niivue` includes both backends (WebGPU + WebGL2 fallback):
93
+ By default, `@niivue/niivue` includes both backends and renders with WebGL2. Opt in to WebGPU with the `backend` option; if WebGPU is unavailable or fails to initialize, it falls back to WebGL2:
91
94
 
92
95
  ```js
93
96
  import NiiVue from '@niivue/niivue'
97
+
98
+ const nv = new NiiVue() // WebGL2
99
+ const nvGpu = new NiiVue({ backend: 'webgpu' }) // WebGPU, WebGL2 fallback
94
100
  ```
95
101
 
96
102
  You can also import backend-only builds to reduce package size:
@@ -102,12 +108,122 @@ import NiiVueWebGL2 from '@niivue/niivue/webgl2' // WebGL2-only
102
108
 
103
109
  In backend-only builds, selecting the missing backend throws an explicit error.
104
110
 
111
+ ### Multi-viewer scenes
112
+
113
+ `@niivue/niivue/scene` exports `NvSceneController`, which lays out several NiiVue
114
+ instances in one container element (it creates their divs and canvases) and can
115
+ sync them. `@niivue/nvreact` and `@niivue/nv-web-component` are built on it.
116
+ The subpath is side-effect free, is not part of the root entry, and has no
117
+ standalone copy. Scene viewers use the universal `@niivue/niivue` build: in an
118
+ app built on `@niivue/niivue/webgpu` or `/webgl2` they are not `instanceof` that
119
+ backend-only `NiiVue` class, and they bring in the other backend's view code.
120
+
121
+ ```js
122
+ import { NvSceneController } from '@niivue/niivue/scene'
123
+
124
+ const scene = new NvSceneController()
125
+ scene.setContainerElement(document.getElementById('viewers'))
126
+ scene.setLayout('1x2') // two viewers side by side
127
+ await scene.loadVolume(0, { url: '/volumes/mni152.nii.gz' })
128
+ ```
129
+
130
+ ### Without a bundler (standalone ES modules)
131
+
132
+ The entry points above import `cbor-x`, `gl-matrix` and `nifti-reader-js` by
133
+ bare name, which only a bundler (or an import map listing every
134
+ dependency) can resolve. For pages with no JavaScript toolchain, such as static
135
+ HTML reports or pages served by a small Python server, the package also ships a
136
+ self-contained build in `dist/standalone/`:
137
+
138
+ ```
139
+ dist/standalone/
140
+ niivue.js # same API as @niivue/niivue (both backends)
141
+ niivue.webgl2.js # same API as @niivue/niivue/webgl2
142
+ niivue.webgpu.js # same API as @niivue/niivue/webgpu
143
+ viewport.js # same API as @niivue/niivue/viewport
144
+ assets/fonts/index.js
145
+ assets/matcaps/index.js
146
+ chunks/ # shared code and lazily loaded chunks
147
+ ```
148
+
149
+ Every dependency is bundled in, workers and images are inlined, and chunks
150
+ import each other by relative path, so the folder has no external references
151
+ and works from any base URL. Optional code stays in chunks that are fetched
152
+ only when used; a page showing a
153
+ NIfTI volume loads about 1.6 MB of JavaScript (about 0.5 MB gzipped). The build
154
+ fails if any bare import appears in the folder (`scripts/check-standalone.ts`).
155
+
156
+ `@niivue/nv-ext-tile` ships a matching `dist/standalone/` (`tiff.js`, `dicom.js`, `zarr.js`) that maps onto this folder with the same import map; see its README.
157
+
158
+ Copy the folder next to your page (here as `niivue/`) and map the package name
159
+ once:
160
+
161
+ ```html
162
+ <script type="importmap">
163
+ { "imports": { "@niivue/niivue": "./niivue/niivue.js" } }
164
+ </script>
165
+ <canvas id="gl1"></canvas>
166
+ <script type="module">
167
+ import NiiVue from '@niivue/niivue'
168
+
169
+ const nv = new NiiVue()
170
+ await nv.attachToCanvas(document.getElementById('gl1'))
171
+ await nv.loadVolumes([{ url: './mni152.nii.gz' }])
172
+ </script>
173
+ ```
174
+
175
+ The import map is optional; `import NiiVue from './niivue/niivue.js'` works
176
+ too. Load only one copy of NiiVue per page: the standalone folder and a bundled
177
+ copy are separate module instances.
178
+
179
+ To vendor a pinned release without Node, download the npm tarball, check it
180
+ against the registry's `dist.integrity`, and copy the folder out:
181
+
182
+ ```bash
183
+ VERSION=1.0.0-rc.45
184
+ curl -sO "https://registry.npmjs.org/@niivue/niivue/-/niivue-$VERSION.tgz"
185
+ curl -s "https://registry.npmjs.org/@niivue/niivue/$VERSION" # read dist.integrity
186
+ echo "sha512-$(openssl dgst -sha512 -binary "niivue-$VERSION.tgz" | openssl base64 -A)"
187
+ tar -xzf "niivue-$VERSION.tgz" package/dist/standalone
188
+ cp -R package/dist/standalone ./niivue
189
+ ```
190
+
191
+ Or point the import map at a CDN copy of the same folder:
192
+
193
+ ```html
194
+ <script type="importmap">
195
+ {
196
+ "imports": {
197
+ "@niivue/niivue": "https://cdn.jsdelivr.net/npm/@niivue/niivue@1.0.0-rc.45/dist/standalone/niivue.js"
198
+ }
199
+ }
200
+ </script>
201
+ ```
202
+
203
+ Node tools that need the folder's location can resolve it through the package
204
+ exports: `import.meta.resolve('@niivue/niivue/standalone')` returns the URL of
205
+ `dist/standalone/niivue.js`.
206
+
207
+ `bun run build` produces the folder (`bun run build:standalone` rebuilds just
208
+ this part). To try it locally, run `bun run examples:standalone` after a build
209
+ and open http://localhost:5403/. That serves `examples/standalone/index.html`
210
+ with a plain static server, the built folder as `niivue/`, and the sample
211
+ volumes, with no Vite in between.
212
+
105
213
  ### Load a mesh
106
214
 
107
215
  ```js
108
216
  await nv.loadMeshes([{ url: '/meshes/brain.mz3' }])
109
217
  ```
110
218
 
219
+ ### AFNI tractography
220
+
221
+ Binary `.niml.tract` files load through `loadMeshes` or by dropping them onto
222
+ any viewer with drag-and-drop enabled (for example `examples/tract.html`).
223
+ Little- and big-endian records are supported; text/base64 NIML is not.
224
+ Coordinates are converted from AFNI RAI to RAS mm. Bundle IDs are available
225
+ for coloring with `tractOptions: { colorBy: 'dps:tract' }`.
226
+
111
227
  ### Signals (physio and spectroscopy)
112
228
 
113
229
  Alongside spatial volumes and meshes, NiiVue can load **signals** — a third,
@@ -200,9 +316,19 @@ const nv = new NiiVue({
200
316
  })
201
317
  ```
202
318
 
319
+ ### Migration (rc)
320
+
321
+ `DecodedChunkStats` (`ChunkStreamDetail.decoded`) is now `ByteLruStats`, which adds `evictedBytes`. `ByteLru<K, V>`, the byte-bounded LRU behind the decoded-chunk tier and the slide tile cache, is exported, and replaces nv-ext-tile's `ByteLruCache`.
322
+
323
+ Unused slide and streaming options were removed:
324
+
325
+ - `NVSlideSpatialTransform`, `NVSlideOptions.spatialTransform`, `NVSlide.spatialTransform` and `setSpatialTransform` are gone. Nothing read them; place a slide in world space with `setSlidePlane`'s `pixelToWorld`.
326
+ - `createSlideView` no longer takes `renderer`, `ownsSlide` or `signal`. The view makes and destroys its own renderer and always disposes the slide it releases (`setSlide`, `destroy`). To cancel a start, destroy the view once it resolves.
327
+ - `loadChunkedVolume` no longer takes `focusBounds` (pass them to `NVChunkedVolume.setFocus(frac, bounds)`), `retryAttempts` (always 3), `frameStagingBytes` (64 MiB) or `readoutBytes` (384 MiB).
328
+
203
329
  ### Testing
204
330
 
205
- The package includes a unit test suite for non-rendering (server-side) logic using the [Bun test runner](https://bun.sh/docs/cli/test). Tests are co-located with source files as `*.test.ts`.
331
+ The package includes a unit test suite for non-rendering logic, including a headless controller (loading, documents, events), using the [Bun test runner](https://bun.sh/docs/cli/test). Tests are co-located with source files as `*.test.ts`. Rendering, Workers and pointer input are covered by Playwright specs in `e2e/` (see `notes/agents/testing.md`).
206
332
 
207
333
  ```bash
208
334
  bun test # Run all tests with coverage
@@ -227,7 +353,7 @@ bunx nx test niivue
227
353
 
228
354
  ### Architecture
229
355
 
230
- The codebase is written in **TypeScript** and follows an MVC pattern with dual rendering backends (WebGPU and WebGL2). See [AGENTS.md](AGENTS.md) for detailed architecture documentation, directory structure, code style, and module naming conventions.
356
+ The codebase is written in **TypeScript** and follows an MVC pattern with dual rendering backends (WebGPU and WebGL2). See [AGENTS.md](AGENTS.md) for the package's rules and code style, and [notes/agents/](notes/agents/) for architecture and the other areas in detail.
231
357
 
232
358
  ### Dependencies
233
359
 
@@ -1,4 +1,4 @@
1
- import { AnnotationConfig, DrawConfig, InteractionConfig, LayoutConfig, MeshRenderConfig, UIConfig, VolumeRenderConfig } from './NVTypes';
1
+ import { AnnotationConfig, CinematicOptions, DrawConfig, InteractionConfig, LayoutConfig, MeshRenderConfig, Rotation2D, UIConfig, VolumeRenderConfig } from './NVTypes';
2
2
  export declare const NUM_CLIP_PLANE = 6;
3
3
  export declare const DEFAULT_CLIP_PLANE: readonly [0, 0, 0, 2];
4
4
  export declare enum COLORMAP_TYPE {
@@ -47,6 +47,13 @@ export declare enum DRAG_MODE {
47
47
  * lighting (illumination, gradient opacity, silhouette) are ignored: a plane
48
48
  * has no surface to shade.
49
49
  *
50
+ * CINEMATIC is a progressive path tracer for the background volume: a 2D
51
+ * (intensity x gradient) transfer function baked from the volume's colormap,
52
+ * soft shadows and ambient occlusion, refined over `cinematic.maxFrames`
53
+ * frames. A label volume on the same grid supplies per-label materials;
54
+ * without one, standard overlays draw unlit. A chunked background falls back
55
+ * to COMPOSITE. See `VolumeRenderConfig.cinematic`.
56
+ *
50
57
  * Applies to the 3D render only; a 2D slice draws one plane, where the modes
51
58
  * are identical.
52
59
  *
@@ -62,28 +69,39 @@ export declare enum DRAG_MODE {
62
69
  export declare enum VOLUME_RENDER_MODE {
63
70
  COMPOSITE = 0,
64
71
  MAXIMUM = 1,
65
- SLICES = 2
72
+ SLICES = 2,
73
+ CINEMATIC = 3
66
74
  }
67
75
  /**
68
76
  * How overlapping overlays combine their opacities before being drawn over the
69
77
  * background. MAX suits independent thresholded maps (overlap is no more
70
78
  * opaque than its parts); ADDITIVE suits fractions that sum to 1 (tissue or
71
- * probability maps), so a voxel split between two maps is fully opaque; OVER
72
- * stacks them like transparencies, 1 - (1-a1)(1-a2)...
79
+ * probability maps), so a voxel split between two maps is fully opaque; UNION
80
+ * stacks them like transparencies, 1 - (1-a1)(1-a2)..., in any order.
73
81
  */
74
82
  export declare enum OVERLAY_ALPHA_BLEND {
75
83
  MAX = 0,
76
84
  ADDITIVE = 1,
77
- OVER = 2
85
+ UNION = 2
78
86
  }
79
87
  /**
80
88
  * How overlapping overlays combine their colours. ADDITIVE sums the
81
89
  * opacity-weighted colours (red + green = yellow, may clip); MEAN takes their
82
- * opacity-weighted average (red + green = dark yellow, never clips).
90
+ * opacity-weighted average (red + green = dark yellow, never clips); OVER
91
+ * composites them in volume order, each overlay over the ones before it (an
92
+ * opaque green over red is green). Pair OVER with OVERLAY_ALPHA_BLEND.UNION for
93
+ * classic source-over stacking, e.g. segmentations; other alpha modes change
94
+ * only the opacity. MAX keeps each colour
95
+ * component's brightest opacity-weighted value (red + green = yellow, never
96
+ * clips, and a faint overlay never dims a bright one); with
97
+ * OVERLAY_ALPHA_BLEND.MAX it is the channel fusion of fluorescence viewers
98
+ * such as Allen's Vol-E.
83
99
  */
84
100
  export declare enum OVERLAY_COLOR_BLEND {
85
101
  ADDITIVE = 0,
86
- MEAN = 1
102
+ MEAN = 1,
103
+ OVER = 2,
104
+ MAX = 3
87
105
  }
88
106
  /**
89
107
  * The `VOLUME_RENDER_MODE` a caller-supplied `volumeRenderMode` means, or
@@ -285,7 +303,7 @@ export declare function lodOpacityScale(downsample: number, coefficient: number)
285
303
  export declare function sliceTypeDim(sliceType: number): number;
286
304
  /** Next view for the V hotkey: axial, coronal, sagittal, multiplanar, render, then wrap (as NiiVue 0.6). NONE restarts at axial. */
287
305
  export declare function nextSliceType(sliceType: number): number;
288
- export declare const NVD_DOCUMENT_VERSION = 9;
306
+ export declare const NVD_DOCUMENT_VERSION = 11;
289
307
  export declare const SCENE_DEFAULTS: {
290
308
  azimuth: number;
291
309
  elevation: number;
@@ -302,7 +320,22 @@ export declare const SCENE_DEFAULTS: {
302
320
  export declare const LAYOUT_DEFAULTS: LayoutConfig;
303
321
  export declare const UI_DEFAULTS: UIConfig;
304
322
  export declare const VOLUME_DEFAULTS: VolumeRenderConfig;
323
+ /** Cinematic settings with bad values replaced by their defaults or bounds. */
324
+ export declare function clampCinematicOptions(o: Partial<CinematicOptions>): CinematicOptions;
325
+ /** `v` clamped to `range`; non-finite gives `fallback`. */
326
+ export declare function clampFinite(v: number, range: readonly [number, number], fallback: number): number;
327
+ /** A layout inset as four finite, non-negative CSS px; anything else side becomes 0. */
328
+ export declare function normalizeInset(v: unknown): [number, number, number, number];
329
+ /**
330
+ * `v` rounded to the nearest quarter turn, as 0, 90, 180 or 270 (-90 is 270).
331
+ * Non-finite or non-numeric gives 0.
332
+ */
333
+ export declare function normalizeRotation2D(v: unknown): Rotation2D;
334
+ /** Ray-march samples per voxel, clamped to [1, 4]; non-finite gives the default. */
335
+ export declare function clampSampleRate(v: number): number;
305
336
  export declare const MESH_DEFAULTS: MeshRenderConfig;
337
+ /** Crosscut line width, at least 0; non-finite gives the default. */
338
+ export declare function clampCrosscutWidth(v: number): number;
306
339
  export declare const DRAW_DEFAULTS: DrawConfig;
307
340
  export declare const INTERACTION_DEFAULTS: InteractionConfig;
308
341
  export declare const ANNOTATION_DEFAULTS: AnnotationConfig;