slices.to.raster <- function(in.array, n.row, n.col, orientation) {
slice.count <- 0
out.mx <- numeric()
for (i in 1:n.row) {
row.temp <- numeric()
for (j in 1:n.col) {
slice.count <- slice.count + 1
row.temp <- switch(orientation,
`coronal`=rbind(row.temp, in.array[ ,slice.count, ]),
`axial`=rbind(row.temp, in.array[ , ,slice.count]),
`sagittal`=rbind(row.temp, in.array[slice.count, , ]))
}
out.mx <- cbind(row.temp, out.mx)
}
out.mx <- melt(out.mx)
return(out.mx)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.