slices3d {misc3d}R Documentation

Interactive Image Slices of 3D or 4D Volume Data

Description

Uses tkrplot to create an interactive slice view of three or four dimensional volume data.

Usage

slices3d(vol, scale = 0.8, col=gray.colors(512), cross = TRUE)

Arguments

vol a three or four dimensional real array.
scale real value for scaling embedded plot size.
col a list of colors.
cross logical; if TRUE, show cross hairs of current slices.

Details

Shows slices of 3D array along the axes as produced by image, along with sliders for controlling which slices are shown. For 4D data an additional slider selects the value of the fourth index. This is useful for viewing medical imaging data (e.g. PET scans and fMRI data).

Examples

  #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(v,col=heat.colors(256))

## Not run: 
  #Example 2: View of FMRI data.
  library(AnalyzeFMRI)
  a<-f.read.analyze.volume(system.file("example.img", package="AnalyzeFMRI"))
  slices3d(aperm(a))
  
## End(Not run)

[Package misc3d version 0.4-0 Index]