clusterTimeSeries: Split time series image into k distinct images

View source: R/clusterTimeSeries.R

clusterTimeSeriesR Documentation

Split time series image into k distinct images

Description

Uses clustering methods to split a time series into similar subsets.

Usage

clusterTimeSeries(mat, krange = 2:10, nsvddims = NA, criterion = "asw")

Arguments

mat

input time series matrix

krange

k cluster range to explore

nsvddims

eg 2

criterion

for clustering see pamk

Value

matrix is output

Author(s)

Avants BB

Examples

## Not run: 
if (!exists("fn")) fn <- getANTsRData("pcasl")
# high motion subject
asl <- antsImageRead(fn, 4)
tr <- antsGetSpacing(asl)[4]
aslmean <- getAverageOfTimeSeries(asl)
aslmask <- getMask(aslmean, lowThresh = mean(aslmean), cleanup = TRUE)
omat <- timeseries2matrix(asl, aslmask)
clustasl <- clusterTimeSeries(omat, krange = 4:10)
for (ct in 1:max(clustasl$clusters))
{
  sel <- clustasl$clusters != ct
  img <- matrix2timeseries(asl, aslmask, omat[sel, ])
  perf <- aslPerfusion(img,
    dorobust = 0.9, useDenoiser = 4, skip = 10, useBayesian = 0,
    moreaccurate = 0, verbose = F, mask = aslmask
  )
  perfp <- list(sequence = "pcasl", m0 = perf$m0)
  cbf <- quantifyCBF(perf$perfusion, perf$mask, perfp)
}

## End(Not run)


stnava/ANTsR documentation built on April 16, 2024, 12:17 a.m.