Interactive Hippocampus

I thought it might make a post that lets you actually play with a 3D model of the brain a little. Unfortunately, I couldn’t figure out how to get blogger to let me host it so I have included a link to it in one of my github repositories.

The values “17” and “53” represent the left and right hippocampus (respectively) that are being isolated to view. If you don’t have a mac or linux computer readily available it is possible to use the oro.nifti package to import nifti files. The actual contour3d command acts on arrays (or 3-dimensional vectors). There’s a pretty ingenuitive community out there that tries to import all sorts of stuff into R, so if you have a 3D model and find a way to convert it to an array in R you can ultimately create a .html file to render it.

library(ANTsR)
library(misc3d)
library(rgl)
library(brainR)
atlas <- antsImageRead("Desktop/mybrain/atlas/Labels.nii.gz")
atlas[atlas != 17 & atlas != 53] <- 0
atlas[atlas == 17 | atlas == 53] <- 1
atlas <- smoothImage(atlas, 1)
atlasar <- as.array(atlas)
contour3d(atlasar, .5)
fname <- "knitted_slice.html"
writeWebGL_split(dir=getwd(), filename = fname, template = system.file("my_template.html", package="brainR"), width=200, writeIt=TRUE)

If all that code doesn’t interest you, feel free to just play with this model.

Please comment and let me know if you’d like to see anymore content like this.

Comments

Popular posts from this blog

Making a Brain Template

Preparing for the MCAT

Align and Bias Correct Your Brain!