get.plane | R Documentation |
The get.plane
function extracts a plane from a "volume"
class object.
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,
method = c("NN", "Av")
)
vol |
"volume" class object. |
origin |
Vector of x, y, z coordinates, representing the origin of the
plane to extract. If |
plane.orientation |
Vector orientation of the plane in the |
alias |
|
xgrid |
Vector, representing the grid of the plane abscissa. See note. |
ygrid |
Vector, representing the grid of the plane ordinates. See note.
If |
interpolate |
Boolean, default to |
method |
method of interpolation, defaulted to 'NN' ie 'Nearest Neighbor'. See Details. |
The interpolation method is chosen from:
'NN'
: the value of a voxel is calculated from its nearest adajcent neighbors.
'Av'
: the value of a voxel is the weighted average of
the voxels contained in a box, whose sides are automatically calculated from
the back.bol$dxyz
steps.
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.
Determination of axes :
the x-axis has plane.orientation[1:3]
as unit vector.
the y-axis has plane.orientation[4:6]
as unit vector.
If xgrid
is not NULL
, origin + x.grid * plane.orientation[1:3]
are the coordinates of the points on the x axis.
If ygrid
is not NULL
, origin + y.grid * plane.orientation[4:6]
are the coordinates of the points on the y axis.
If xgrid
or ygrid
are NULL, they are determined to represent
as closely as possible the initial volume in the required cut.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.