get.ijk.from.xyz {espadon}R Documentation

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)

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.

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.

Note

The vector or matrix is made up of real numbers. It is up to the user to make the indices as integer.

The indices of the first voxel vol are 0, 0, 0. WARNING: As i,j,k are DICOM indices, they are not directly related to array indices. To get the value of the vol$vol3D.data, use the function get.value.from.ijk.

Examples

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

[Package espadon version 1.7.0 Index]