# Resting state fMRI and Dynamic Time Wrapping

Resting state fMRI provides neural measurements of the functional relationship between areas of the brain. Rs-fMRI data is particularly useful for investigation of clinical populations. It allows for investigation of the disruption brain networks without the added complexity of variation associated with task-related brain activation Plitt et al., 2015, Smith, 2009. It may be applied in the investigation of mental states, memory and the recall of events, clinical populations, among others Fox, 2010, Shirer et al., 2012. Rs-fMRI has been shown to be highly reproducible and provides data sets that can be easily compared across studies Franco et al., 2013, Shehzad, 2009.

The synchronized spontaneous low frequency fluctuations of the BOLD signal within a task-free environment (resting state) are known to represent the functional connections of different brain areas.

#### Approaches used to compute functional connectivity:

1. Seed based correlation analysis (SCA), a whole-brain connectivity map is obtained by iteratively calculating the linear correlation between the time series of a seed region or voxel and every other region or voxel specified using correlation coefficient as the measure of similarity.
2. Independent component analysis (ICA),
• data driven approach. identifies a predefined number of spatial templates and corresponding time courses to model the data
• activities of the individual voxel are linear combination of these component time series.
• determine the main source or sources that affect the BOLD time course of the corresponding voxel, thus resulting in a fuzzy clustering of voxels.
• Each independent source defines a component, therefore clusters arise not only from actual neural synchronization, but from other signal sources, like measurement noise and artifacts.
3. other

#### How do we look at Resting state fMRI now? What could go wrong?

1. The correlation of low frequency fluctuations on resting-state fMRI arises from fluctuations in blood oxygenation or flow.
2. Traditional resting-state network concept is based on calculating linear dependence of spontaneous low frequency fluctuations of the BOLD signals of different brain areas, which assumes temporally stable zero-lag synchrony across regions. It is a manifestation of functional connectivity of the brain (Biswal et al., 1995).
3. To investigate brain connectivity, a correlation is calculated for the average of the time series of the regions of interest. The correlation is used to build a connectivity matrix.
4. However the brain functional connectivity exhibits dynamic changes and a complex time-lag structure, which cannot be captured by the static zero-lag correlation analysis.
5. Bold signal are not same for all brain regions, example default mode network ( what is default mode network) shows negatively correlated bold signals in normal human begin. Get a better example please something is missing

#### Resting state fMRI data preprocessing technique involved:

• slice time correction
• motion correction
• normalization of voxel intensity
• Nuisance signal removal
• low frequency drift (linear trend and quadratic trend)

#### Why DTW, what property of DTW make it more desirable measure for analysis of fMRI signal?

1. Originally developed for time series analysis and classification of speech signals and have proven results in the field, this would mean that DTW should be able to handle autocorrelation induced by noise component with the fMRI signal just like the speech. (inference considering the similarity of data).
2. DTW distance measure are less sensitive to linearly combined noise in the data.
3. DTW, performs non linear wrapping on the compared time series, this is can be exploited to correct the non stationary time lags introduced by the dynamic transformation of brain states.
4. Non linear wrapping, would also help in negating the shape distortion between brain regions due to variability in neurovascular coupling /hemodynamic response function (I believe both are same but still check this out)

### What is Dynamic Time Wrapping?

DTW (Sakoe and Chiba, 1978) is a family of algorithms which compute the local stretch or compression to apply to the time axes of two time series in order to optimally map one onto the other. DTW outputs the remaining cumulative distance between the two and, if desired, the mapping itself (warping function). In another word they can compute the similarity between time series which may vary in time (i.e. wrap in time).

DTW is widely used e.g. for classification and clustering tasks in Econometrics, Chemometrics and general time series mining. Originally designed for speech recognition, Basically DTW finds the optical global alignment between two time series by exploiting temporal distortion between them.

Multiple studies as confirmed that for the problem involving time series data for example a classification task, algorithm exploiting the DTW to wrap the invariance among the signal is hard to beat. [1][2]

#### Things to be considered while implementing or using DTW:

1. Z Normalizing
2. just-in-time normalization
3. early abandoning techniques
4. Applying endpoint constrain
5. setting up wrapping window

#### Computing DTW,

Compute the distance matrix(cost matrix) between every possible pair of points between the two time series. Any possible wrapping between two time series will be a path through the computed cost matrix.

$DTW(q,c) = min \Bigg( \frac{\sqrt{\sum_{k=1}^{K}w_k)}}{K} \Bigg)$, here w is the wrapping constant.

The optimal (minimum) path or wrapping between two time series will provide us with the DTW, which can be obtained using the below recursive function.

$\gamma(i,j) = distance(q_i,c_i) + min( \gamma(i-1,j-1), \gamma(i-1,j), \gamma(1,j-1))$

Its important to note that DTW is symmetric and has constancy of self similarity but does not follow positivity (separation) and triangular inequality. This would be the best way to say DTW is a distance measure and not a metric. Now interesting if we increase the sample space to an enormous level, we would be able to find lots of A,B, and C which would follow triangular inequality(just read this over the internet try to find the source). Mathematically in the limit, as w tends to zero DTW is a metric, interesting isn’t it?

#### Reference

[1] Bagnall, A., Lines, J., Bostrom, A., Large, J., & Keogh, E. (2017). The great time series classification bake off: a review and experimental evaluation of recent algorithmic advances. Data Mining and Knowledge Discovery, 31(3), 606-660.

[2] Bagnall, A., Lines, J., Bostrom, A., Large, J., & Keogh, E. (2017). The great time series classification bake off: a review and experimental evaluation of recent algorithmic advances. Data Mining and Knowledge Discovery, 31(3), 606-660.