Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. rm(list=ls())
  2. setwd("~/Downloads/")
  3. library(WhiteStripe)
  4. library(fslr)
  5. library(scales)
  6. img = readNIfTI("T1_mutualinfo2_reg_flirt_MNI152.nii", reorient = FALSE)
  7. brain_mask = img > 0
  8.  
  9. img_cut = function(img, breaks, ...){
  10. cuts = cut(img, breaks = breaks, ...)
  11. levs = levels(cuts)
  12. cuts = as.numeric(cuts)
  13. # res.p[ rs > ncut ] = cuts
  14. img = niftiarr(img, array(cuts, dim = dim(img)))
  15. return(list(img=img, levs = levs))
  16. }
  17.  
  18. breaks = quantile(img[brain_mask == 1], probs = seq(0, 1, by = 0.1))
  19.  
  20. col.cut = alpha(div_gradient_pal(low="blue",
  21. mid="red",
  22. high="yellow")(
  23. seq(0, 1, length=length(breaks)-1)
  24. ), .7)
  25. cut_img = img_cut(img, breaks = breaks, include.lowest=FALSE)
  26. ortho2(cut_img$img, col = col.cut,
  27. breaks = 0:length(cut_img$levs))
  28.  
  29. ortho2(img, cut_img$img, col.y = col.cut,
  30. ybreaks = 0:length(cut_img$levs), ycolorbar = TRUE)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement