Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rm(list=ls())
- setwd("~/Downloads/")
- library(WhiteStripe)
- library(fslr)
- library(scales)
- img = readNIfTI("T1_mutualinfo2_reg_flirt_MNI152.nii", reorient = FALSE)
- brain_mask = img > 0
- img_cut = function(img, breaks, ...){
- cuts = cut(img, breaks = breaks, ...)
- levs = levels(cuts)
- cuts = as.numeric(cuts)
- # res.p[ rs > ncut ] = cuts
- img = niftiarr(img, array(cuts, dim = dim(img)))
- return(list(img=img, levs = levs))
- }
- breaks = quantile(img[brain_mask == 1], probs = seq(0, 1, by = 0.1))
- col.cut = alpha(div_gradient_pal(low="blue",
- mid="red",
- high="yellow")(
- seq(0, 1, length=length(breaks)-1)
- ), .7)
- cut_img = img_cut(img, breaks = breaks, include.lowest=FALSE)
- ortho2(cut_img$img, col = col.cut,
- breaks = 0:length(cut_img$levs))
- ortho2(img, cut_img$img, col.y = col.cut,
- ybreaks = 0:length(cut_img$levs), ycolorbar = TRUE)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement