simplify_tract: Subsetting operator for 'tract' objects

Description Usage Arguments Value Examples

Description

This method provides an easy and natural way to subset a tract stored in a tract object, without having to deal with the inner representation of the tract class.

Usage

1
simplify_tract(tract, clusters = NULL, validate = TRUE)

Arguments

tract

The input tract.

clusters

A numeric or integer vector giving the cluster membership of each streamline in the tract.

i

A valid expression to extract subtract with fewer streamlines (could be an integer, a numeric vector, of a logical vector).

tract

An object of class tract.

Value

A tract with the selected streamlines only.

A tract.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
file <- system.file("extdata", "Case001_CST_Left.csv", package = "fdatractography")
cst_left <- read_tract(file)
t1 <- cst_left[1]
t2 <- cst_left[1:2]
n <- length(cst_left$data)
selected_streamlines <- sample(c(TRUE, FALSE), n, replace = TRUE)
t3 <- cst_left[selected_streamlines]
Tract Simplification by Cluster Medians

file <- system.file("extdata", "Case001_CST_Left.csv", package = "fdatractography")
cst_left <- read_tract(file)
m <- simplify_tract(cst_left)

astamm/fdatractography documentation built on May 12, 2019, 5:37 a.m.