get.value.from.mesh: Voxel value at a given depth of a mesh

get.value.from.meshR Documentation

Voxel value at a given depth of a mesh

Description

The get.value.from.mesh function is used to retrieve the values of an object of class "volume" at the desired depth of a surface described by a mesh. If the mesh corresponds to the "patient" contour, the zero depth is the skin, positive depths enter the patient and negative depths exit to the outside.

Usage

get.value.from.mesh(
  mesh,
  vol,
  method = c("point", "disk", "sphere"),
  depth = 0,
  radius = 5,
  spacing = 1,
  T.MAT = NULL,
  FUN = median,
  ...
)

Arguments

mesh

espadon "mesh" class object, or rgl/Rvcg "mesh3d" class object. "mesh3d" class object shall an additional field "ref.pseudo" specifying the mesh frame of reference.

vol

"volume" class object.

method

string specifying the desired method for retrieving measurements in vol. by default "point". Other methods exist, for example "disk" or "sphere. See details.

depth

Numeric value, representing the depth, relative to the surface of the mesh, at which values are retrieved. 0 corresponds to the surface, positive values enter the volume used to define the mesh and negative values leave it.

radius

Positive number, defining the radius of the disk or sphere, depending on the desired method.

spacing

spacing of the measurement points on the disk or sphere.

T.MAT

"t.mat" class object, created by load.patient.from.Rdcm, load.patient.from.dicom, load.T.MAT or ref.add.

FUN

function to be applied to reduce the data ("disk" or "sphere" method) to a single value. Default, median value.

...

Additional arguments passed to FUN if needed.

Details

The get.value.from.mesh function works at each vertex of the mesh. It moves along the normal at that point to the desired depth.

  • When the method is "point", it simply retrieves the value of the volume vol specified at that point.

  • When the method is "disk", the values are retrieved on the disk orthogonal to the normal,with radius radius.

  • When the method is "sphere", the values are retrieved inside the sphere of radius radius.

For "disk" or "sphere", the measurement points are spaced by spacing. For radius=5 and spacing=1, "disk" and "sphere" perform 78 and 523 measurements respectively. In both cases, the measured values must be reduced to a single result using the FUN function. By default, espadon uses the median, but it can be provided with more complex functions to filter the data efficiently (see example below).

Value

Returns a vector of values measured at the requested depth, with the desired method, filtered by FUN, at each vertex of the mesh.

Examples

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

# creation of the patient mesh
bin <- bin.from.roi (CT, struct = S, roi.name = "patient", 
                     verbose = FALSE)
mesh.patient <- mesh.from.bin (bin, alias = "patient", verbose = FALSE)

# density value on the skin contour, extracted from CT
density <- get.value.from.mesh (mesh.patient, CT ,depth = 0) 

if (interactive()){
  # Display of mesh, with RVV pal
  density[density < -1000] <- -1000
  density[density > 1000] <- 1000
  col <- pal.RVV(255)[cut (density, seq (-1000, 1000, length.out = 256), 
                           include.lowest=TRUE)]
  rgl::open3d ()
  display.3D.mesh (mesh.patient, col = col)
}

espadon documentation built on April 11, 2025, 5:57 p.m.