slices3d               package:misc3d               R Documentation

_I_n_t_e_r_a_c_t_i_v_e _I_m_a_g_e _S_l_i_c_e_s _o_f _3_D _o_r _4_D _V_o_l_u_m_e _D_a_t_a

_D_e_s_c_r_i_p_t_i_o_n:

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

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

     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.

_D_e_t_a_i_l_s:

     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).

_E_x_a_m_p_l_e_s:

       #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)

