Learn R Programming

espadon (version 1.11.3)

get.ijk.from.xyz: Indices relating to the coordinates of the points

Description

The get.ijk.from.xyz function calculates the i, j, k DICOM indices of the points given in the patient's reference frame.

Usage

get.ijk.from.xyz(xyz = matrix(c(0, 0, 0), ncol = 3), vol, verbose = FALSE)

Value

Returns a vector or a matrix of the i, j, k DICOM indices of the x, y, z coordinate points in the patient's frame of reference.

Arguments

xyz

Vector of length 3, corresponding to the x, y, z coordinates (in mm) of a point in the patient's frame of reference, or 3-column matrix of x, y, z coordinates of several points.

vol

"volume" class object.

verbose

Boolean, default to FALSE. If verbose = TRUE, then the xyz coordinates are printed.

Examples

Run this code
# loading of toy-patient objects (decrease dxyz for better result)
step <- 4
patient <- toy.load.patient (modality = "ct", roi.name = "", 
                             dxyz = rep (step, 3))
CT <- patient$ct[[1]]

get.ijk.from.xyz (xyz = CT$xyz0[1,], vol = CT, verbose = TRUE)
get.ijk.from.xyz (xyz = c (1,1,1), vol = CT, verbose = TRUE)

index <- get.ijk.from.xyz (xyz = c (1,1,1), vol = CT)
floor (index)

index <- get.ijk.from.xyz (xyz = matrix (c (0,0,0,1,1,1), ncol = 3, byrow = TRUE), 
                           vol = CT)
floor (index)

Run the code above in your browser using DataLab