# NOT RUN {
#Example 1: View of a mixture of three tri-variate normal densities
nmix3 <- function(x, y, z, m, s) {
0.4 * dnorm(x, m, s) * dnorm(y, m, s) * dnorm(z, m, s) +
0.3 * dnorm(x, -m, s) * dnorm(y, -m, s) * dnorm(z, -m, s) +
0.3 * dnorm(x, m, s) * dnorm(y, -1.5 * m, s) * dnorm(z, m, s)
}
x<-seq(-2, 2, len=40)
g<-expand.grid(x = x, y = x, z = x)
v<-array(nmix3(g$x,g$y,g$z, .5,.5), c(40,40,40))
slices3d(vol1=v, main="View of a mixture of three tri-variate normals", col1=heat.colors(256))
# }
# NOT RUN {
#Example 2: Put a z-map from fMRI data on top of a structure
# image. The threshold value of the z-map is 2.
library(AnalyzeFMRI)
temp<-f.read.analyze.volume("standard.img")
z<-f.read.analyze.volume("z-map.img")
slices3d(vol1=temp, vol2=z[,,,1], rlim2=c(2,Inf),col2=heat.colors(20),
main="Regions above threshold values.")
# }
Run the code above in your browser using DataLab