juaml / juaml/junifer

[ENH]: Support parcel aggregation with eigenvariate

Open
#285 0 comments 0 reactions 2 assignees View on GitHub

@synchon is already working on this.

Since Dec 14, 2023.

enhancement triage
Dominant language
Python
Stars
16
Forks
13
Avg merge
10h 20m
Merged PRs (30d)
1

Description

Are you requiring a new dataset or marker?
  • I understand this is not a marker or dataset request
Which feature do you want to include?

Parcellation is usually done by aggregating into mean time series per parcel.

SPM provides an option to aggregate using the first eigenvariate time series per parcel as briefly mentioned in the following publication: https://doi.org/10.1016/j.neuroimage.2005.08.012

"Generally, the best (minimum variance) unbiased estimate of the fROI response would involve spatially whitening the data, accounting for spatial correlations and inhomogeneity in both signal and noise.[...] We generally deal with this by taking the first eigenvariate of an fROI, which uses the temporal covariance of voxels in the fROI to find coherent spatial modes of activity (see spm_regions at http://www.fil.ion.ucl.ac.uk/spm). The principal eigenvariate is, like the average, simply a summary of the responses within an fROI. Unlike the average, it does not assume homogenous responses within the fROI."

SPM's MATLAB implementation of the first eigenvariate:
https://github.com/spm/spm12/blob/3085dac00ac804adb190a7e82c6ef11866c8af02/spm_regions.m#L179

The Python implementation I used so far:
https://github.com/weidongcai/GeneralScripts/blob/0a0253346acffc21849c1f66f4fb2bf7ac79e8de/Python3.5/fMRIAnalysisModule/ROIAnalysisModule.py#L17

SPM suggests pre-whitening the data before extraction: https://en.wikibooks.org/wiki/SPM/Timeseries_extraction

"More specifically, it is the first principal component or eigenvariate of the pre-whitened, high-pass filtered and confounded-corrected timeseries in the selected region."

Pre-whitening by SPM is supposedly done in this function:
https://github.com/spm/spm12/blob/3085dac00ac804adb190a7e82c6ef11866c8af02/spm_filter.m

But I couldn't figure it out so I defaulted to demeaning the time series before generating parcels using scipy's signal class: 'voxel_ts_demean = scisig.detrend(voxel_ts_raw, type='constant')'

How do you imagine this integrated in junifer?

extend get_aggfunc_by_name function with an "eigenvariate" option

Do you have a sample code that implements this outside of junifer?

No response

Anything else to say?

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.