get.plane {espadon}R Documentation

Extracting a plane from a volume

Description

The get.plane function extracts a plane from a "volume" class object.

Usage

get.plane(
  vol,
  origin = c(0, 0, 0),
  plane.orientation = c(1, 0, 0, 0, 1, 0),
  alias = "plane.n",
  xgrid = NULL,
  ygrid = NULL,
  interpolate = TRUE
)

Arguments

vol

"volume" class object.

origin

Vector of x, y, z coordinates, representing the origin of the plane to extract. If interpolate = FALSE, these coordinates are replaced by the coordinates of the voxel closest to origin.

plane.orientation

Vector orientation of the plane in the vol frame of reference, composed by the 2 vectors coordinates of the orthonormal basis of the plane. First vector is x-axis, and second one is y-axis.

alias

$object.alias of the created object.

xgrid

Vector, representing the grid of the plane abscissa. See note.

ygrid

Vector, representing the grid of the plane ordinates. See note. If ygrid = NULL, the ordinate is the line intercepting the volume and the step is set to the projection of vol$dxyz onto the ordinate orientation.

interpolate

Boolean, default to TRUE. If interpolate = TRUE, a trilinear interpolation of the value of the voxels, relative to the values of adjacent voxels, is performed.

Value

Returns a "volume" class object, containing only a single plane, at k = 0, in the same frame of reference as vol. This returned object has 2 new fields local.xgrid, and local.ygrid, representing the local grids of the abscissa (columns) and ordinate (rows) of the plane.

Returns NULL if plane doesn't exist.

Note

Determination of axes :

Examples

# loading of toy-patient objects (decrease dxyz for better result)
step <- 4
patient <- toy.load.patient (modality = "mr", dxyz = rep (step, 3))
MR <- patient$mr[[1]] 
    
# mid-volume point 
mid.point <- apply (get.extreme.pt (MR),1,mean)

plane <- get.plane (MR, origin = mid.point, interpolate = TRUE)
display.kplane (plane, interpolate = FALSE)

plane <- get.plane (MR, origin = mid.point, xgrid = seq (-50, 50, 1), 
                    ygrid = seq (-50, 50, 1), interpolate = TRUE)
display.kplane (plane, interpolate = FALSE)

# 3 points on the inclined plane
pts <- t ((MR$xyz.from.ijk %*% MR$cube.idx) [1:3 , c (1, 2, 7)])
orientation <- orientation.create (A = pts[1,], B = pts[2,], C = pts[3,])
origin <- apply (pts, 2, mean)
plane <- get.plane (MR, origin = origin, 
                    plane.orientation = orientation, interpolate = TRUE)
display.kplane (plane, interpolate = FALSE)

orientation <- orientation.create (A = c (0, 0, 0) , B = c (1, 1, 0), 
                                   C = c (-1, 1, 0))
plane <- get.plane (MR, origin = origin, 
                    plane.orientation = orientation, interpolate = TRUE) 
display.kplane (plane, interpolate = FALSE)

[Package espadon version 1.2.0 Index]