This package is not registered yet. Installation can be performed via
import Pkg
Pkg.add(url="https://github.com/korbinian90/Niivue.jl")
This should work in almost any julia environment (REPL, vscode, Pluto, Jupyter)
using Niivue
arr = rand(50,50,20)
nv = niivue(arr)
- only small arrays working (sending from julia to javascript issue, webfiles are fine)
using Niivue
nv = niivue()
display(nv.app) ## currently required to display, run in own cell
volumes = [
Dict(
:url => "https://niivue.github.io/niivue/images/mni152.nii.gz",
:colormap => "gray",
),
Dict(
:url => "https://niivue.github.io/niivue/images/hippo.nii.gz",
:colormap => "red",
)
]
nv.loadVolumes(volumes)
nv.setCrosshairWidth(5)
nv.setCrosshairColor([0,1,1,0.5])
nv.isColorbar = true
The methods (e.g. nv.setCrosshairWidth(5)
) and options (e.g. nv.isColorbar = true
) can be found in the niivue javascript documentation.
To use an Electron display, add in the beginning
using Electron
use_electron_display(devtools=false)
In vscode, by default the plot pane is used. To use the Electron display, deactivate the plotting pane via the command palette (ctrl+shift+p) -> Julia: Disable Plot Pane
Have a look at the 'examples' subfolder.
Javascript can be directly executed from Julia and the nv
object is available as window.nv
using Niivue
nv = niivue()
width = 10
js = Niivue.Bonito.js"""
window.nv.setCrosshairWidth($(width))
"""
Niivue.Bonito.evaljs(nv.app.session.x, js)
- use niivue-vscode as alternative pre-configured viewer