Skip to content

DiedrichsenLab/ProbabilisticParcellation

Repository files navigation

ProbabilisticParcellation

Cerebellar Probabilistic Parcellation project using HierarchBayesParcel and FunctionalFusion

Dependencies:

Diedrichsenlab/HierarchicalBayesParcel Diedrichsenlab/FunctionalFusion Diedrichsenlab/DCBC Diedrichsenlab/cortico_cereb_connectivity

Other dependencies:

see requirements.txt

Notebooks / Code to replicate different sections of the paper

Estimation of the atlas

Atlas was estimated using: scripts/atlas_paper/fit_atlas.py

Single dataset parcellations (Fig 1a) single_parcellations.ipynb

Symmetric & asymmetric atlas (Fig 2a, 2b & 2c) atlas_flatmaps.ipynb

State dependency of functional atlases

Plotting MDS plots for different single dataset parcellations (Fig 1B & 1C & 1D) & Statistics for between-dataset ARI (similarity; normalized to within-dataset ARI) between all datasets and the task-general (MDTB) and rest-based (HCP) data: notebooks/evaluate_mds.ipynb

Fusion outperforms other atlases

Plotting DCBC & Statistics DCBC (Fig 1E & 1F): notebooks/evaluate_dcbc.ipynb

Comparison of existing atlasses to fusion notebooks/evaluate_existing.ipynb

Symmetric and Asymmetric atlasses

Plotting symmetry (boundary and functional symmetry, i.e. functional lateralization) and comparing asymmetric and symmetric atlas versions: notebooks/symmetry.ipynb

Fine level of granularity advantageous for individual parcellation

Statistics on DCBC of 68 regions vs 40 regions in individual DCBC (Fig 1F): notebooks/evaluate_dcbc.ipynb

Hierarchical atlas organisation

Dendrogram (Fig 2D): scripts/atlas_paper/dendrogram.py Some manual adjustments had to be made on the produced figure, because the internal ordering of the leaves within a domain is randomly generated by the dendrogram plotting algorithm (for example M4a and M4b are ordered M4b, M4a).

The parcels are reordered according to their functional profiles using the reorder_model function in hierarchical_clustering. Clustering of the 68 subregions into 32 regions (medium) and 4 domains (coarse) is then performed on the reordered model using the function cluster_parcel in hierarchical_clustering.py. Both functions are called by the function reorder_models in scripts/atlas_paper/parcel_hierarchy.py. The order of regions went through several rounds of revisions, with all rounds documented in the reorder_models function.

Characterization of regions

Characterizing regions based on functional responses in the MDTB dataset over and above motor responses is done by estimating a linear model using ridge regression (L2 regularization) with the motor features (left hand presses, right hand presses & saccades) and task condition indicators as the design matrix. The feature model is run using: scripts/atlas_paper/feature_model.py which calls the ridgeFit function in: scripts/atlas_paper/ridge_reg.py

The motor, action, demand and social-linguistic-spatial regions are described in individual notebooks using all datasets and the MDTB feature model:

Motor regions notebooks/atlas_paper/motor.ipynb (Fig S1)

Action regions notebooks/atlas_paper/action.ipynb

Demand regions notebooks/atlas_paper/demand.ipynb

Sociolinguistic regions notebooks/atlas_paper/social.ipynb

Probabilistic maps: function export_all_probmaps in export_atlas.py (Fig S2a)

Region sizes: notebooks/atlas_paper/size_comparison.ipynb (Fig S2b & S2)

Volumetric atlas view: notebooks/atlas_paper/atlas_volume.ipynb (Fig S3)

Localizing individual regions notebooks/atlas_paper/task_differences.ipynb (Fig S4)

Cortical Connectivity

Cortical connectivity models are estimated and evaluated in the repository diedrichsenlab/cortico_cereb_connectivity denoted ccc for short.

Models were trained evaluated ccc.run_model, which is called from ccc.scripts.script_train_eval_models.py

Models are then fused (i.e. simply averaged) using ccc.scripts.script_fuse_models.py

  • Model 4: Demand, HCP and MDTB
  • Model 5: all datasets including HCP
  • Model 6: all datasets excluding HCP
  • Model 7: all datasets excluding HCP and Somatotopic

The final model evaluation results reported in the paper can be found in ccc.notebooks.Evaluate_model_int.ipynb.

To summarize the connectivity pattern by cerebellar regions:

import cortico_cereb_connectivity.scripts.script_summarize_weights as csw
csw.make_weight_map('Fusion','06',method='L2Regression')

To summarize further by cortical ROI: T = csw.make_weight_table(dataset="Fusion",extension="06",cortical_roi="")

Summary figures (by MSHBM_Prior_15_fsLR32) notebooks/atlas_paper/cortical_connectivity.ipynb

Full connectivity maps: notebooks/atlas_paper/connectivity_weights.ipynb (Fig S5 & Fig S6)

Function and boundary (a)symmetry

Size comparison of left and right regions (voxel-wise) of the asymmetric atlas (Fig S8) notebooks/atlas_paper/size_comparison.ipynb

XX

XX add the figure names to plots in jupyter notebook

Individual localization

To get individual parcellations (previously saved as pytorch tensor to save time) run the following script: scripts.individual_variability.export_uhats(model_name)

Which Calls: evaluate.get_individual_parcellation(model_name)

Plotting the individual parcellations: (Fig 5A): notebooks/individual_parcellation.ipynb

Calculating and plotting individual variability (Fig 5B): notebooks/individual_variability.ipynb

which calls: scripts.individual_variability.calc_variability(Data, Info, subject_wise=False):

Plotting probability maps for parcels (Fig 5C): notebooks/individual_group.ipynb plot.plot_parcel_prob

Comparing group and individual parcellations with varying length of data (Fig 5D & 5E): notebooks/individual_group.ipynb

Model to atlas

export_atlas.export_map takes a marginal probabilitiy of a arrangement model and generates the probseg and dseg to save in the ProbabilisticParcellationModel/Atlases directory.

Final export / Production of the atlas

The final step is to take the 2mm atlas in MNISymC2 space and resample it to 1mm isotropic in SUIT, MNIAsym and MNISym spaces defined in the FunctionalFusion/Atlases directory. The reslicing is done on the probseg.nii files and then a new dseg.nii file is computed.

scripts.export_atlas_script.py

which calls

export_atlas.resample_atlas('NettekovenSym32','MNISymC2','MNI152NLin2009cSymC')

The files are then copied for inclusion into the cerebellar_atlases repository by hand.

Spatial subdivision of the atlas

The spatial subdivision of the atlas is then produced in each atlas space seperately - in the final 1mm space.

subdivde_atlas_spatial(fname='NettekovenSym32',atlas='SUIT',outname='NettekovenSym128')

About

Cerebellar Probabilistic Parcellation project using generativeMRF and FunctionalFusion

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages