Skip to content

korbinian90/Niivue.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Niivue

Stable Dev Build Status Coverage

Installation

This package is not registered yet. Installation can be performed via

import Pkg
Pkg.add(url="https://github.com/korbinian90/Niivue.jl")

Quickstart

This should work in almost any julia environment (REPL, vscode, Pluto, Jupyter)

using Niivue

arr = rand(50,50,20)
nv = niivue(arr)

Critical Bugs

  • only small arrays working (sending from julia to javascript issue, webfiles are fine)

Use settings

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.

Electron Display

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

Examples

Have a look at the 'examples' subfolder.

Hacking

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)

Future plans

  • use niivue-vscode as alternative pre-configured viewer

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages