Skip to content

cognitive-biology/DLDA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Direct linear discriminant analysis (DLDA)

Here we provide a set of MATLAB based scripts to perform direct linear discriminant analysis on fMRI data.

Citing

Please use the following paper to cite the toolbox:

Kakaei,E. & Braun, J. (2023) - Gradual change of cortical representations with growing visual expertise for synthetic shapes.

If you are using MD758 parcellation please refer to MD758 parcellation and cite accordingly.

Requirements

You need following requirements to run DLDA:

How to use

First, download or clone the repository. NIFTI toolbox should be installed and included in the MATLAB path. Before following the pipeline, you can go over the demo file as an example of how to use this toolbox.

WARNING: Due to large amount of data that fMRI images contain, this process can be memory consuming. Make sure to save any unsaved processes before running this program.

Pipeline:

After having your fMRI images preprocessed, first you need to create a setting and a profile structure array which contain the necessary information for the DLDA pipeline. The setting and profile structures should include the following information:

%% stg (settings) 
stg.atlasnii % 'path_to_atlas_nifti_file.nii' (.nii only)
stg.atlaslist % 'path_to_atlas_list.mat' atlas region information
stg.ROI_ID  % array of ROIs
stg.window % [TR1 TR2] (event centered windows from TR1 to TR2)
stg.TR % fMRI TR in seconds
stg.classificationID % ID of the classes for classification
stg.Nrepetition % number of train-test repetition
stg.TestFraction % fraction of data used for cross-validation 
stg.StatsPermutations % number of first-level permutation test 
stg.PrevalencePermutations % number of second-level permutation test (prevalence analysis)
stg.alpha % level of significance
stg.SaveDirectory % directory in which toolbox will save the output files

%% prf (profile) is a structure of 1-by-N (N: number of images)
prf(i).subject % name or ID of the subject
prf(i).images % path to the pre-processed .nii image file 
prf(i).ID % ID of the events (trigger:-3, ID of the class presented)
prf(i).time % time of the events (MR trigger and class presentation)

Once these information is provided you can take follow the DLDA pipeline which takes the setting and profile variables and performs the following steps:

  1. Checking settings and profile: check_inputs(stg,prf) controls for missing fields of the assigned variables.
  2. Preparing saving directory: prepare_savedir(stg,prf) creates all the required folders under the stg.SaveDirectory directory.
  3. Splitting original image: split_images(stg,prf) divides the original preprocessed images into smaller files for each given ROI, for each subject.
  4. Sequencing events: get_sequences(stg,prf) recognizes TR indices for all events.
  5. Cleaning ROI data: get_clean_data(stg,prf,ROI) whitens and detrends data for a given ROI.
  6. Combine class data over sessions: get_class_data(stg,prf,clean_data) combines the cleaned data over sessions and divides them by classes.
  7. Dividing train/test sets: train_test_division(stg,class_data) divides the combined class data into train and test sets.
  8. Training classifier: training_optimal_space(TrainBatch) finds the optimal subspace and the centroids of each class in that subspace.
  9. Crossvalidation of classifier: test_classification(TestBatch,G) projects the test-set into the optimal subspace G. Then, test_stats(stg,projected_test_data,M) provides multiple cross-validation measures and performs the first-level permutation.

Prevalence statistics:

Additionally, we have included get_prevalence which performs a population prevalence inference using a 2-level permutation test Allefeld et al. 2016.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages