Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = .git,.git-meta,.gitignore,.gitattributes,*.pdf,*.PDF,*.svg,package-lock.json,vendor,*.css,*.gii,.codespellrc,*.html,*.rtf
check-hidden = true
# ignore-regex =
ignore-words-list =
# Proper surnames: E. Reynolds Losin, Jorge Sepulcre, Claus Svarer (neuroscientists)
losin,
sepulcre,
claus,
# Journal abbreviations: Hum Brain Mapp (Human Brain Mapping), Nat Commun (Nature Communications)
mapp,
commun,
# Neuroimaging acronyms: TE=Echo Time, FWE=Family-Wise Error, BU=author initials, ANS=Autonomic Nervous System
te,
fwe,
bu,
ans,
# MATLAB variable/algorithm identifiers: indx=index, som=self-other-map, ttest=t-test function, als=alternating-least-squares
indx,
som,
ttest,
als,
# Brain region abbreviation: PreS=Presubiculum
pres,
# Meta-analysis coding category in data files (column name / cell value)
anyother,
# Dutch surname: Peter De Weerd (neuroscientist, appears in references.bib)
weerd,
# MATLAB command 'whos' (lists workspace variables; appears in debug session transcript)
whos
23 changes: 23 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Codespell configuration is within .codespellrc
---
name: Codespell

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v6
- name: Codespell
uses: codespell-project/actions-codespell@8f01853be192eb0f849a5c7d721450e7a467c579 # v2.2
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@

%% write - this writes only the label image

% Save: if creating from probabilty images only
% Save: if creating from probability images only
%
% if dosave
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@

%% write - this writes only the label image

% Save: if creating from probabilty images only
% Save: if creating from probability images only
%
% if dosave
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@

%% write - this writes only the label image

% Save: if creating from probabilty images only
% Save: if creating from probability images only
%
% if dosave
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@

%% write - this writes only the label image

% Save: if creating from probabilty images only
% Save: if creating from probability images only
%
% if dosave
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@

%% write - this writes only the label image

% Save: if creating from probabilty images only
% Save: if creating from probability images only
%
% if dosave
%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ https://github.com/Washington-University/HCPpipelines/blob/master/global/templat
https://github.com/Washington-University/HCPpipelines/blob/master/global/templates/standard_mesh_atlases/fs_R/fs_R-to-fs_LR_fsaverage.R_LR.spherical_std.164k_fs_R.surf.gii
onto the subject specific registered spherical surface ([lr]h.sphere.reg in the freesurfer output
directory). This was then projected into the native subject surface space using the inverse transforms from
the fmriprep outputed freesurfer directories and then transformed from native space into
the fmriprep outputted freesurfer directories and then transformed from native space into
MNI152NLin2009cAsym and MNI152NLin6Asym spaces. The results for the left and right hemisphere
concatenated across subjects for each space, study and hemisphere.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ version for improvements now available.

## Probabilities

The atlas is probablistic. The original atlas is defined on a surface, but this surface is folded in different
The atlas is probabilistic. The original atlas is defined on a surface, but this surface is folded in different
ways for different people. Misalignment of gyri and sucli results in parcels projecting into different locations
for different people. The probabilities indicate the likelihood an individual's parcel will project to the
designated location. For instance, V1 and V2 probability maps are shown below, and although one is always more
probable than another there are also regions where identity at the group level is ambiguous.

![Examples of probablistic labels](images/probability_maps_vis_ctx.png)
![Examples of probabilistic labels](images/probability_maps_vis_ctx.png)

You can threshold the map at different probability values to obtain more or less eroded versions of the atlas
using the atlas object's threshold method. This offers a more rigorous dilation/erosion method than was available
Expand All @@ -42,7 +42,7 @@ for the older glasser atlas. Some example thresholds are shown below.
Probabilities were computed first based on alignments in each of three studies (BMRK5, PainGen, SpaceTop) separately
and then averaged. Different studies have different acquisition parameters, which can result in systematic
differences in resulting alignments. Averaging over more studies would be better. In the interest of facilitating
futher updates to this dataset these three studies have had their subject specific MNI space projections uploaded
further updates to this dataset these three studies have had their subject specific MNI space projections uploaded
to figshare. If you want to recompute the probability maps/parcel boundaries you can follow the approach in
the src subfolder here for a new study and combine it with these maps for an incremental improvement. Maps are here:

Expand Down Expand Up @@ -76,7 +76,7 @@ from a study previously analyzed and reported in surface space.

To my knowledge Glasser et al. have not published their subject specific region classifiers (as of 10/24/23),
nor a multimodal alignment template, so subject specific parcel identification is not yet possible outside the
Van Essen lab. However, subject specific parcellations may be avialable from the HCP dataset, and might provide
Van Essen lab. However, subject specific parcellations may be available from the HCP dataset, and might provide
an avenue towards an improved version of this atlas if someone were to obtain appropriate surface to volume
mappings from the HCP study. Coalsen et al. 2018 PNAS achieve precise this kind of surface to volume mapping
that takes variability of the subject specific surface parcellations into account and compares it to a projection
Expand All @@ -91,7 +91,7 @@ were also computed. By enchaining the inverse transform to surface space with th
space we can get a fsaverage surface to MNI space projection for each subject. The Glasser surface parcellation
was transformed with this enchained set of transforms for each of 241 unrelated participants in paingen, 88
participants from BMRK5 and 112 participants from SpaceTop. All transformations were computed by running fmriprep
20.2.3 (BMRK5, PainGen) or 21.0.2 (SpaceTop) with recon-all enabled on these participants, so this probablistic
20.2.3 (BMRK5, PainGen) or 21.0.2 (SpaceTop) with recon-all enabled on these participants, so this probabilistic
atlas is ideally calibrated for use with fmriprep aligned volumes. Resulting parcellations were uploaded to
figshare

Expand Down Expand Up @@ -143,7 +143,7 @@ precision, it's a matter of an imprecise fit to a mean template.
What we offer here instead is the mean of many precise fits to individual templates, which is clearly better in this
regard. While different individuals may have different ventral visual cortical foldings, none of them have have visual
cortex in the cerebellum. Finally, the old atlas is necessarily non-probablistic, which limits its versatility. Note that
in the figure below underlay is MNI152NLin2009cAsym, which is nearly indistiguishable from MNI152NLin2009aAsym, the
in the figure below underlay is MNI152NLin2009cAsym, which is nearly indistinguishable from MNI152NLin2009aAsym, the
asymmetric version of the template the old glasser parcellation was projected to. The fmriprep20 registration fusion
image it cycles with is thresholded at 20% probability, which is a default threshold used throughout much of this repo.

Expand Down Expand Up @@ -186,7 +186,7 @@ Alternatively we can look at the difference between studies, since we have three
greatest agreement, with practically all dice coefficients greater than 0.7. This is fortunate, since it means
between study variability is small relative to between subject variability, and it means we're closer to the number
of degrees of freedom we need for stable estimates of parcel boundaries (Using a single study, so no study related
error, Wu et al. claim you need 300 participants for boundaries to fully stabalize).
error, Wu et al. claim you need 300 participants for boundaries to fully stabilize).

<img alt="paingen vs. bmrk5 to MNi152NLin2009cAsym" src="diagnostics/dice_hist_interstudy_glassers_MNI152NLin2009cAsym.png" width="500" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@

%% write - this writes only the label image

% Save: if creating from probabilty images only
% Save: if creating from probability images only
%
% if dosave
%
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The code in this folder is deprecated. It's based on a dubious projection from surface space to volumetric space
that's based on nearest neighbor interpolation without seemingly any realignments performed. A registration
fusion approach was used to generate a more credible alignment and is available in the parent directory. This is
left here for backwards compatability.
left here for backwards compatibility.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
## Overview

This is a probablistic atlas meant to correspond to freesurfer's thalamic
This is a probabilistic atlas meant to correspond to freesurfer's thalamic
subnuclear parcellations, a joint histologic and in vivo parcellation of the
thalamus into 23 unique regions per hemisphere. It is less granular than
Morel, but has an open usage license, is probablistic and is likely to be
Morel, but has an open usage license, is probabilistic and is likely to be
more accurately segmented. That notwithstanding, the biological accuracy of
the labeling hasn't been sufficiently validated in my opinion (nor has any
other MNI space thalamic atlas), so treat it primarily as an ontology rather
than something with any kind of granular biological validity.

The probablistic labels are derived from labels produced by application of an
The probabilistic labels are derived from labels produced by application of an
automated bayesian segmentation algorithm to 618 participants from 3 studies.
The most recent versions of the algorithm is robust when given DWI and T1
data, so if individual parcellations are needed you can obtain them easily.
Expand All @@ -21,17 +21,17 @@ as well.

## Methods

The probablistic labels are not directly derived from the original Iglesias
The probabilistic labels are not directly derived from the original Iglesias
et al. (2018) Neuroimage parcellation that is used internally by freesurfer.
Those probablistic labels aren't readily available. They're stored in an
esoteric format interally by freesurfer, and based on personal correspondence
Those probabilistic labels aren't readily available. They're stored in an
esoteric format internally by freesurfer, and based on personal correspondence
with Iglesias there is no readily available nifti version of the
probablistic labels available for distribution. There is a version available
probabilistic labels available for distribution. There is a version available
that's packaged with LeadDBS, but the relationship between this version and
the original probablistic labels isn't clear. Instead, what I (BP) have done
the original probabilistic labels isn't clear. Instead, what I (BP) have done
is to fit the freesurfer segmentation to 278 HCP participants, 76 spacetop
participants and 264 paingen participants and use those subject specific labels
to determine probablistic labels for the population.
to determine probabilistic labels for the population.

Atlas labels were generated by running freesurfer's Thalamic segmentation on
T1 and DWI data from 278 unrelated HCP participants, 76 spacetop participants
Expand Down Expand Up @@ -116,17 +116,17 @@ all labels would be 1). Signals obtained from individualized parcellations shoul
therefore be more homogeneous across participants than signals obtained from the
group parcels. We therefore take task evoked responses from SpaceTop (Pain, Vicarious
and Cognitive) and estimate the mean parcel task evoked response for each in each
thalamic region in each of the 76 particpants segmented using both individual parcellations
thalamic region in each of the 76 participants segmented using both individual parcellations
and a group parcellation. We then evaluate the effect of parcellation type and the
interaction between task x parcellation type for each region. We would expect to see
larger regional effects with the individualized parcellation due
to constructive amplification while we expect lower regional effects in the group
parcellation due to destructive interference of signals from heterogenous sources
parcellation due to destructive interference of signals from heterogeneous sources
("blurring"). We also expect task differences between regions to be greater in the
individualized parcellation (significant interactions) for the same reason.

First level GLM contrasts were estimated using task evoked responses taken
with respect to baseline, controling for 24 motion parameters and CSF, and using a
with respect to baseline, controlling for 24 motion parameters and CSF, and using a
canonical HRF for convolution. Data was unsmoothed. Of the 76 participants with individual
parcellations, 73 of them had task contrasts available (the other three were presumably
missing BOLD data, I ran all that I could).
Expand All @@ -136,7 +136,7 @@ parcel using either an individualized parcellation or a group parcellation. Subj
treated as random effectively turning this into a within subjects repeated measures
analysis, although this isn't clearly illustrated in the figures below, so take note now.
Task contrasts were coded pain = [1/2, -1/3] vic = [-1/2, -1/3], cog = [0, 2/3] which
yeilded two planned contrasts: pain_v_vic and pain_vic_v_cog. A parcellation variable was
yielded two planned contrasts: pain_v_vic and pain_vic_v_cog. A parcellation variable was
also coded as [1/2, -1/2] for the individual vs. group parcellation (resp). In Wilkinson
notation the model took the form,

Expand All @@ -151,7 +151,7 @@ it's important to note.

Models were fit separately for each region using restricted expectation maximum
likelihood (ReML) and full covariance estimation. Satterthwaites correction was used to
estimate degrees of freedom, and in most cases yeilded n-1 degrees of freedom, but due
estimate degrees of freedom, and in most cases yielded n-1 degrees of freedom, but due
to some regions missing in some individual parcellations the df are also somewhat variable.
This is precisely what we would expect for a repeated measures analysis.

Expand All @@ -161,7 +161,7 @@ with respect to baseline. Of the 76 participants with individual parcellations,
BOLD data, I ran all that I could).

The results are very mixed. With 46 regions our Holm-Sidak corrected p-value
theshold is p < 0.0011 for alpha=0.05.
threshold is p < 0.0011 for alpha=0.05.

Regions with lower evoked response across tasks using individualized parcellations (unexpected):
- central_medial_(left)<br />
Expand Down Expand Up @@ -254,7 +254,7 @@ The same as the above only shown in FSL with a T2 image juxtaposed along side it

The morel atlas is the most detailed histological atlas available in MNI space.
Its major limitation is that it is based on 6 participants (or maybe 3 and
mirror imaged, unclear), is not probablistic, and lacks an open license. The
mirror imaged, unclear), is not probabilistic, and lacks an open license. The
Iglesias atlas is based on 12 participants (or maybe 6 and mirror imaged)
augmented by 55 in vivo scans that are used to calibrate probabilistic maps.
In our case these are further mediated by projection to 278 individual's
Expand Down Expand Up @@ -351,5 +351,5 @@ Right Thalamus (axial)

## References

* Iglesias JE, Insausti R, Lerma-Usabiaga G, Bocchetta M, Van Leemput K, Greve DN, van der Kouwe A, Fischl B, Caballero-Gaudes C, Paz-Alonso PM. (2018). A probablistic atlas of the human thalamuc nuclei combining ex vivo MRI and histology. Neuroimage, 314-326, 183.
* Iglesias JE, Insausti R, Lerma-Usabiaga G, Bocchetta M, Van Leemput K, Greve DN, van der Kouwe A, Fischl B, Caballero-Gaudes C, Paz-Alonso PM. (2018). A probabilistic atlas of the human thalamuc nuclei combining ex vivo MRI and histology. Neuroimage, 314-326, 183.
* Tregidgo HFJ, Soskic S, Althonayan J, Maffei C, Van Leemput K, Golland P, Insausti R, Lerma-Usabiaga G, Caballero-Gaudes C, Paz-Alonso PM, Yendiki A, Alexander DC, Bocchetta M, Rohrer JD, Iglesias JE. (2023). Accurate Bayesian segmentation of thalamic nuclei using diffusion MRI and an improved histological atlas. Neuroimage, 274, 120129.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
thisAtlas.probability_maps = [];
thisLeadsAtlas = leadsAtlas.select_atlas_subset(thisAtlas.labels,'exact').threshold(0.2);
thisLeadsAtlas.probability_maps = [];
for orientation = {'saggital','coronal','axial'}
for orientation = {'sagittal','coronal','axial'}
%%
o2 = thisAtlas.montage('transvalue',0.5,'regioncenters',orientation{1});
for i = 1:num_regions(thisAtlas)
Expand Down Expand Up @@ -92,7 +92,7 @@
thisAtlas.probability_maps = [];
thisLeadsAtlas = leadsAtlas.select_atlas_subset(thisAtlas.labels,'exact').threshold(0.2);
thisLeadsAtlas.probability_maps = [];
for orientation = {'saggital','coronal','axial'}
for orientation = {'sagittal','coronal','axial'}
%%
o2 = thisAtlas.montage('transvalue',0.5,'regioncenters',orientation{1});
for i = 1:num_regions(thisAtlas)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
thisAtlas = [newAtlas1{:}];
thisMorelAtlas = [newAtlas2{:}];

for orientation = {'saggital','coronal','axial'}
for orientation = {'sagittal','coronal','axial'}
%%
o2 = thisAtlas.montage('transvalue',0.5,'regioncenters',orientation{1});
for i = 1:num_regions(thisAtlas)
Expand Down Expand Up @@ -84,7 +84,7 @@
thisAtlas = [newAtlas1{:}];
thisMorelAtlas = [newAtlas2{:}];

for orientation = {'saggital','coronal','axial'}
for orientation = {'sagittal','coronal','axial'}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as relates to code, not sure if "kosher" or I should just whitelist the sagittal. please advise

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Yarik! I think we've replaced this error in most/all of the core code with codespell, and this is historical. i would correct the spelling.

%%
o2 = thisAtlas.montage('transvalue',0.5,'regioncenters',orientation{1});
for i = 1:num_regions(thisAtlas)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

space_description = 'MNI152NLin2009cAsym';
atlas_name = sprintf('iglesias_HCP278_ST76_PG264_%s', space_description);
references = char({'Iglesias JE, Insausti R, Lerma-Usabiaga G, Bocchetta M, Van Leemput K, Greve DN, van der Kouwe A, Fischl B, Caballero-Gaudes C, Paz-Alonso PM. (2018). A probablistic atlas of the human thalamuc nuclei combining ex vivo MRI and histology. Neuroimage, 314-326, 183.'; ...
references = char({'Iglesias JE, Insausti R, Lerma-Usabiaga G, Bocchetta M, Van Leemput K, Greve DN, van der Kouwe A, Fischl B, Caballero-Gaudes C, Paz-Alonso PM. (2018). A probabilistic atlas of the human thalamuc nuclei combining ex vivo MRI and histology. Neuroimage, 314-326, 183.'; ...
'Tregidgo HFJ, Soskic S, Althonayan J, Maffei C, Van Leemput K, Golland P, Insausti R, Lerma-Usabiaga G, Caballero-Gaudes C, Paz-Alonso PM, Yendiki A, Alexander DC, Bocchetta M, Rohrer JD, Iglesias JE. (2023). Accurate Bayesian segmentation of thalamic nuclei using diffusion MRI and an improved histological atlas. Neuroimage, 274, 120129.'});

dosave = true;
Expand Down
Loading