Skip to content

AnthonyAndroulakis/niivue.R

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Using NiiVue in R Shiny

NiiVue is an open-source JavaScript library for WebGL2-based medical image viewing. This R package allows you to use NiiVue from R Shiny.

Examples

Tractography (TCK, TRK, TRX, VTK)

Demo for NiiVue's Tractography [code]

Time Series Demo

Partial demo for NiiVue's Time Series (toggle thumbnail doesn't work, but the other features do) [code]

Quickstart

  1. Install the devtools library
install.packages('devtools')
  1. Download this repo
git clone https://github.com/AnthonyAndroulakis/niivue.R
  1. Install niivue R library
cd niivue.R/niivue
devtools::install()
  1. Use it (for more examples, see the examples folder)
suppressWarnings(library(niivue))
library(shiny)

ui <- fluidPage(
  fluidRow(
    tags$div(style = "width: 100%; height: 600px;", NiivueWidget$new()$plot)
  )
)

server <- function(input, output, session) {
  volumeList <- list(
    list(url = "https://niivue.github.io/niivue/images/mni152.nii.gz",
         colormap = "gray", visible=TRUE, opacity=1)
  )

  nv <- NiivueWidget$new()
  nv$loadVolumes(volumeList)
}

shinyApp(ui, server)

Docs

  • you need a shiny server to run niivue.R
  • usage mirrors that of the niivue library (camelcase)
  • nv$opts and nv$graph are reactiveValues variables

Limitations

  • any large data arrays (ex: nv.volumes[0].img) are not sent back to R
  • nv$thumbnailVisible(TRUE) doesn't work as intended
  • only the onLocationChange niivue event handler is implemented
  • no extensive documentation (just refer to https://niivue.github.io/niivue/devdocs/index.html)

About

A WebGL2-based NIFTI volume viewer in R

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published