Skip to content

Commit

Permalink
Full conversion of MMPthal atlas to MNI152NLin6Asym space
Browse files Browse the repository at this point in the history
  • Loading branch information
baxpr committed Jul 17, 2024
1 parent d9711c8 commit 1069580
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 118 deletions.
Binary file not shown.
43 changes: 0 additions & 43 deletions atlases-devel/atlas-MMPthal/atlas-MMPthal_dseg.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -3897,46 +3897,3 @@ index label
13535 thal_13535
13536 thal_13536
13537 thal_13537
13538 thal_13538
13539 thal_13539
13540 thal_13540
13541 thal_13541
13542 thal_13542
13543 thal_13543
13544 thal_13544
13545 thal_13545
13546 thal_13546
13547 thal_13547
13548 thal_13548
13549 thal_13549
13550 thal_13550
13551 thal_13551
13552 thal_13552
13553 thal_13553
13554 thal_13554
13555 thal_13555
13556 thal_13556
13557 thal_13557
13558 thal_13558
13559 thal_13559
13560 thal_13560
13561 thal_13561
13562 thal_13562
13563 thal_13563
13564 thal_13564
13565 thal_13565
13566 thal_13566
13567 thal_13567
13568 thal_13568
13569 thal_13569
13570 thal_13570
13571 thal_13571
13572 thal_13572
13573 thal_13573
13574 thal_13574
13575 thal_13575
13576 thal_13576
13577 thal_13577
13578 thal_13578
13579 thal_13579
13580 thal_13580
Binary file not shown.
8 changes: 8 additions & 0 deletions atlases-devel/atlas-MMPthal/get_templateflow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env python
#
# https://www.templateflow.org/usage/client/

from templateflow import api as tflow
path = tflow.get('MNI152NLin6Asym', desc=None, resolution=2,
suffix='T1w', extension='nii.gz')
print(path)
53 changes: 21 additions & 32 deletions atlases-devel/atlas-MMPthal/process_thalamus.sh
Original file line number Diff line number Diff line change
@@ -1,53 +1,42 @@
#!/usr/bin/env bash

# Start with FSL Thalamus-maxprob atlas (1mm)
fslmaths /usr/local/fsl/data/atlases/Thalamus/Thalamus-maxprob-thr25-1mm.nii.gz -bin thalmask

# Resample to match MMP atlas (1.5mm)
#flirt \
# -in thalmask \
# -ref space-MNI152NLin2009cAsym_atlas-MMP_dseg \
# -usesqform \
# -applyxfm \
# -interp nearestneighbour \
# -out rthalmask

# We have 8464 voxels in the maxprob25 thalamus mask
#fslstats -K rthalmask rthalmask -m -v

#./make_thalamus_voxels.py
# Process atlas-MMP_space-MNI152NLin2009cAsym_res-015 to match fmriprep MNI152NLin6Asym space,
# and add thalamus voxel ROIs
#
# See get_templateflow.py to get specific atlas image for grid reference

#fslmaths \
# space-MNI152NLin2009cAsym_atlas-MMP_dseg \
# -add rthalatlas \
# space-MNI152NLin2009cAsym_atlas-MMPthal_dseg


## Alternative approach to match templateflow 2mm atlas tpl-MNI152NLin2009cAsym_res-02_T1w.nii.gz
## and thereby match an available fmriprep output
# Get thalamus mask from FSL maxprob and resample to template grid
fslmaths /usr/local/fsl/data/atlases/Thalamus/Thalamus-maxprob-thr25-1mm.nii.gz -bin thalmask
flirt \
-in thalmask \
-ref tpl-MNI152NLin2009cAsym_res-02_T1w.nii.gz \
-ref tpl-MNI152NLin6Asym_res-02_T1w \
-usesqform \
-applyxfm \
-interp nearestneighbour \
-out rthalmask

fslstats -K rthalmask rthalmask -m -v

# Make tsv labels for the MMP atlas
./make_MMP_tsv.py

# Make thalamus voxel ROIs and add their labels to the list
./make_thalamus_voxels.py

# Resample the source MMP atlas to desired grid
flirt \
-in space-MNI152NLin2009cAsym_atlas-MMP_dseg \
-ref tpl-MNI152NLin2009cAsym_res-02_T1w.nii.gz \
-in atlas-MMP_space-MNI152NLin2009cAsym_res-015 \
-ref tpl-MNI152NLin6Asym_res-02_T1w \
-usesqform \
-applyxfm \
-interp nearestneighbour \
-out space-MNI152NLin2009cAsym_res-02_atlas-MMP_dseg
-out atlas-MMP_space-MNI152NLin6Asym_res-02_dseg

# Add the thalamus ROIs
fslmaths \
space-MNI152NLin2009cAsym_res-02_atlas-MMP_dseg \
atlas-MMP_space-MNI152NLin6Asym_res-02_dseg \
-add rthalatlas \
space-MNI152NLin2009cAsym_res-02_atlas-MMPthal_dseg
atlas-MMPthal_space-MNI152NLin6Asym_res-02_dseg





Binary file modified atlases-devel/atlas-MMPthal/rthalatlas.nii.gz
Binary file not shown.
Binary file modified atlases-devel/atlas-MMPthal/rthalmask.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
43 changes: 0 additions & 43 deletions atlases/atlas-MMPthal/atlas-MMPthal_dseg.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -3897,46 +3897,3 @@ index label
13535 thal_13535
13536 thal_13536
13537 thal_13537
13538 thal_13538
13539 thal_13539
13540 thal_13540
13541 thal_13541
13542 thal_13542
13543 thal_13543
13544 thal_13544
13545 thal_13545
13546 thal_13546
13547 thal_13547
13548 thal_13548
13549 thal_13549
13550 thal_13550
13551 thal_13551
13552 thal_13552
13553 thal_13553
13554 thal_13554
13555 thal_13555
13556 thal_13556
13557 thal_13557
13558 thal_13558
13559 thal_13559
13560 thal_13560
13561 thal_13561
13562 thal_13562
13563 thal_13563
13564 thal_13564
13565 thal_13565
13566 thal_13566
13567 thal_13567
13568 thal_13568
13569 thal_13569
13570 thal_13570
13571 thal_13571
13572 thal_13572
13573 thal_13573
13574 thal_13574
13575 thal_13575
13576 thal_13576
13577 thal_13577
13578 thal_13578
13579 thal_13579
13580 thal_13580
Binary file not shown.
Binary file not shown.

0 comments on commit 1069580

Please sign in to comment.