Learn R Programming

espadon (version 1.11.3)

struct.clustering: Clustering volumes by RoI

Description

The struct.clustering function creates a new volume in which voxels are clustered and labeled by region of interest defined in an rt-struct.

Usage

struct.clustering(
  vol,
  struct,
  roi.name = NULL,
  roi.sname = NULL,
  roi.idx = NULL,
  T.MAT = NULL,
  alias = "",
  description = NULL,
  verbose = TRUE
)

Value

Returns a "volume" class object (see espadon.class

for class definitions), of "cluster" modality. This object contains the $cluster.info field, detailing the label and volumes in cm^3ascii

of the different clusters. Note that the label NA or value 0 is used for the voxels which are not contained in any RoI (air for instance).

Arguments

vol

"volume" class object.

struct

"struct" class object.

roi.name

Vector of exact names of the RoI in the struct object. By default roi.name = NULL. See Details.

roi.sname

Vector of names or parts of names of the RoI in the struct object. By default roi.sname = NULL. See Details.

roi.idx

Vector of indices of the RoI that belong to the struct object. By default roi.idx = NULL. See Details.

T.MAT

"t.mat" class object, created by load.patient.from.Rdcm or load.T.MAT. If T.MAT = NULL, struct$ref.pseudo must be equal to vol$ref.pseudo.

alias

Character string, $alias of the created object.

description

Character string, describing the created object. If description = NULL (default value), it will be set to paste (struct$object.alias,"clustering")

verbose

Boolean. if TRUE (default), the RoI studied are listed.

Details

If roi.name, roi.sname, and roi.idx are all set to NULL, all RoI are selected.

See Also

get.roi.connection

Examples

Run this code
# loading of toy-patient objects (decrease dxyz for better result)
step <- 5
patient <- toy.load.patient (modality = c ("mr", "rtstruct"),  
                             dxyz = rep (step, 3))
MR <- patient$mr[[1]]
S <- patient$rtstruct[[1]]
cluster.vol <- struct.clustering (MR, S, T.MAT = patient$T.MAT, verbose = FALSE)
head (cluster.vol$cluster.info)

# Display
n = nrow(cluster.vol$cluster.info)
col = paste0(c ("#000000", rainbow (n-1)),"af")
breaks <- seq (cluster.vol$min.pixel - 0.5, cluster.vol$max.pixel + 0.5, 
              length.out = n+1)
par0 <- par()
par(mfrow = c(1,2), mar = c(1,15,1,1))
display.palette(col, factors = cluster.vol$cluster.info$label)
par(mar = c(1, 1, 1, 1))
display.plane (MR, cluster.vol, main = "RoI clustering", view.coord = 0,
               top.col = col, top.breaks = breaks, interpolate = FALSE)
par(mfrow= par0$mfrow,mar=par0$mar)

Run the code above in your browser using DataLab