Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
appFiles
data
functions
rsconnect/shinyapps.io/athanasiamo
.gitignore
README.rmd
app.R

README.rmd

# VisMRI

There are three functions in the functions subfolder. 

- **nifti2df**: after having read a nii.gz file with oro.nifti's readNIFTI function, use this function to transform the 3D matrix into a 2D long data.frame for ggplot  
- **plotNifti**: function to plot the file created by the above function.

```{r echo=F}
library(tidyverse); library(oro.nifti); library(plotly); library(shiny)
rm(list=ls())

sapply(list.files("functions",pattern=".R", full.names = T), source)

#Read in background image and convert
BG = readNIfTI("data/Fix_94_FL12DW_291115_NoDiff/bg_image.nii.gz") %>% 
  nifti2df()

#Read in overlay (stats) 
Cope3 = readNIfTI("data/Fix_94_FL12DW_291115_NoDiff/cope3.feat/stats/zstat5.nii.gz") %>% 
  nifti2df() %>% rename(Cope3=Val)

# Add overlay to the df for plotting (will only work with one overlay)
IMG = left_join(BG, Cope3, by = c("X", "Y", "Z"))

# Try some plotting!
plotNifti(BG, view="axial")
plotNifti(Cope3, view="sagittal")
plotNifti(Dat=IMG, view="sagittal", threshMin=2)
plotNifti(Dat=IMG, view="axial", slice=30,threshMin=2.5)
```
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.