christian-oreilly / infant_template_paper Goto Github PK
View Code? Open in Web Editor NEWCode used for our infant template paper (2020)
License: GNU Lesser General Public License v2.1
Code used for our infant template paper (2020)
License: GNU Lesser General Public License v2.1
Initial work on this topic has been discussed here:
https://neuroimage.usc.edu/forums/t/atlas-for-1-year-old-infants/15475/71
There are currently some issues with the co-registration of the montage and the surfaces in
Brainstorm. From previous email exchange with @ftadel and @larsoner
Hi Eric & Christian,
As I wrote in the forum thread (https://neuroimage.usc.edu/forums/t/atlas-for-1-year-old-infants/15475/70):
The coregistration in Brainstorm is independent from the original coordinate system of either the surfaces
or the electrodes. Everything imported to Brainstorm is converted to CTF/SCS coordinate system using
the NAS/LPA/RPA (https://neuroimage.usc.edu/brainstorm/CoordinateSystems), so as long as these points
are correctly defined in the MRI and in the montage file (ie. in the same coordinate system as the rest of
the 3D points in the same file), there is no possible coordinate system issue once imported in Brainstorm.
=> You can use the coordinate system you want in the montage.fif files.
The current issues (documented in the forum thread):
1. The bem/outer_skin surface is too large wrt to the other bem surfaces and the MRI
2. The coordinates in the .fif files are not labelled (impossible to know which electrode they
correspond to) => It would be much easier and efficient to transfer these files between programs
if they were simple text files, one 3D point per line, "Name X Y Z" (and you can add an extra 5th column
Type if you can't derive it from the name of the point). Like the Polhemus files... all the complexity of the
FIF files does not bring anything good here, especially if the coordinate system is not even the one
documented in the FIF structure.
If you want something truly portable, use the BIDS electrodes.tsv specification, it would be good
for you to have an export function to this format in any case:
https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/03-electroencephalography.html#electrodes-description-_electrodestsv
3. The NAS/LPA/RPA positions for the import of the MRI+surface must be defined in
Brainstorm MRI coordinates (this is only annoying part that might require extra manual work)
Could we keep this discussion going somewhere it's archived, organized and accessible
by others - instead of via emails? (either the Brainstorm forum thread referenced above or a
new brainstorm or MNE github issue)
Cheers
Francois
The BEM surfaces in the templates are still a bit too expanded.
Example with the skin surface (1month):
Therefore, the EEG electrode positions in the template are not fitted on the skin, they are floating a few millimeters away from the skin:
All the other BEM layers are also too large. Example of inner_skull.surf
:
The same is observed for all ages, example of inner_skull.surf on 24months:
It's useful to have all volumes in the mri
directory, rather than their own atlases
directory, because it facilitates things like warping subjects to digitization (MNE for example warps an mri/*.mgz
). So if instead of putting them in atlases we can make them mgz
with something like:
mri_convert atlases/brain_ANTS_IXI_atlas_head_space.nii.gz mri/brain_ANTS_IXI_atlas_head_space.mgz
then things work at the MNE end like they should.
Not sure if it's worth cutting a 0.2 just for this but it's probably worth adding to the scripts. I can make a PR for this if you want @christian-oreilly
As noted by @ftadel, the head surfaces for the 1 mo time point are not accurate with respect to the average head MRI (the three yellow lines should represent the scalp, the inner skull, and the outer skull surfaces):
Upon closer examination, the extracted surfaces follow the BEM4 segmentation as well as could be expected:
So it seems that in this case the issue comes from the original BEM4 file not being very faithful to the head average MRI.
if I run this:
import mne
subject = mne.datasets.fetch_infant_template('6mo')
Brain = mne.viz.get_brain_class()
brain = Brain(
subject, hemi='split', surf='inflated', size=(1200, 1200),
cortex='low_contrast', views=['lateral', 'medial', 'ventral'],
background='white')
strange_labels = ('isthmuscingulate', 'entorhinal', 'parahippocampal')
regexp = '|'.join(strange_labels)
labels = mne.read_labels_from_annot(subject, 'aparc', regexp=regexp)
for label in labels:
brain.add_label(label, alpha=0.4)
brain.add_annotation('aparc')
brain.save_image('strange_aparc.png')
brain.close()
del brain
I end up with this image:
The large medial wall label I've highlighted purple is isthmuscingulate
which looks really different from expectations. parahippocampal
(just below, in green) and entorhinal
I'm less sure about (though I notice that rh-entorhinal
doesn't even exist for this brain). For comparison, here is what happens if I simply morph the aparc
labels from fsaverage
onto this brain:
As reported by @larsoner in email exchanges:
The 5120-tri BEM surfaces do not have the same triangle definitions as the standard MNE ICO surface. This indicates that they were downsampled by something other than FreeSurfer routines, so some guarantees that are usually there (e.g., can be downsampled to lower ICO, normals point outward, etc.) may not be satisfied. Maybe it's worth using the FreeSurfer downsampling routines to downsample them rather than mne.decimate_surface (which uses VTK)
In order to integrate the templates with MNE, we would want to compute and add to the templates the following artifacts:
I'm working toward #2 and can no longer git clone
:
larsoner@bunk:~/python$ git clone [email protected]:/christian-oreilly/infant_template_paper.git
Cloning into 'infant_template_paper'...
remote: Enumerating objects: 61, done.
remote: Counting objects: 100% (61/61), done.
remote: Compressing objects: 100% (55/55), done.
remote: Total 1261 (delta 5), reused 46 (delta 4), pack-reused 1200
Receiving objects: 100% (1261/1261), 649.52 MiB | 43.55 MiB/s, done.
Resolving deltas: 100% (113/113), done.
Downloading Templates/ANTS1-0Months3T.zip (336 MB)
Error downloading object: Templates/ANTS1-0Months3T.zip (0b47676): Smudge error: Error downloading Templates/ANTS1-0Months3T.zip (0b4767620a442f02f196c9618709cc4eb19abba1481d8f3e65837a18ed84af14): batch response: Git LFS is disabled for this repository.
Errors logged to /home/larsoner/python/infant_template_paper/.git/lfs/logs/20210112T115423.922689879.log
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: Templates/ANTS1-0Months3T.zip: smudge filter lfs failed
.zip
files you made just the contents immediately preceding the removal of the files from the repo? If so then I can at least still make progress on #2 while the LFS stuff is sorted out..zip
files from somewhere, that way end-users don't need git
plus git-lfs
on their systems...In
infant_template_paper/template_building.py
Lines 443 to 447 in d907822
flirt
it has values 0-255, which is not good.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.