18 - Atlases and ROIs: Part 1 of 2
October 16, 2018
May 30, 2018
Daniel Glen, NIMH
All Captioned Videos AFNI Training Bootcamp
Daniel Glen, NIMH
For more information and course materials, please visit the workshop website:
We recommend viewing the videos at 1920 x 1080 (Full HD) resolution for the best experience. A lot of code and type is displayed that may be hard to read otherwise.
PRESENTER: First a note that if you want to see other videos of us of our boot camps, you can click anywhere on our website on the documentation tab. And then on that documentation tab, you can scroll down to 2.1 AFNI bootcamp lecture recordings.
And then down here, these have just been made available. They probably won't be as good as the ones that we're making here. But we do have them already available. And including the handouts that you also have too. So these were done at NIH recently. So we have Paul Taylor and Bob Cox also presenting.
I'm going to continue on with the atlas and the ROI talk. Let's start with atlas and then switch over to ROIs. OK, so I'm going to start AFNI again in the AFNI data6 AFNI directory, just to show how this works actually with a real subject.
There could be functional activation on there. Let's do that just for fun here. And I will change to [INAUDIBLE] in my overlay. Let's put that in. Talairach views, standard space. You can do this if you like. And I will change my power of 10 slider. I've got the reliable visual coefficient set. And my overlay and reliable visual t-stat. And let's say I'll raise this up to something fairly high. And I'll change my range to show about 2% max.
So anywhere I click, I can then right click in an image viewer and select where am I. And the where am I window opens up. And we see the atlas is-- the focal point in these different atlases and nearby regions. First we have the Talairach Daemon Then we have macro labels. This is from the Eickhoff-Zilles group. The macro labels group is natively done in the MNI Anat space, which is this MNI A code here. And this supplies somewhat different sets of regions.
You'll see that no two atlases agree with each other. They call things-- call regions by different names. Additionally, Eickhoff-Zilles produced these probabilistic maps. These are made from post-mortem studies from 10 subjects. And these 10 subjects, they've drawn on each of the 10 subjects and aligned them together. So at every voxel, you have how many of the 10 subjects agreed at that voxel? It's generally they're in increments of 10%.
And that's on the probabilistic map. So if you look at every single voxel and look for the region that gives the maximum probability, that's how we generate the maximum probability maps, these MPM maps.
And so here you can see the probability of this region. So this one has a 0.2 probability of being this region at that focus point. And there's also a 0.6 possibility of being this region, and 0.4 of being this region. I know they don't-- it's they don't necessarily add up to 1. But that's how these regions, these atlases were made.
They also provide the gray and white matter. And we also have the left and right brain for the N27 data set. We also have the MPM atlases that were provided by Rutvik Desai, an AFNI user who ran at auto Talairach on 75 different subjects that he had done FreeSurfer segmentation for, and he created probabilistic map and the MPM maps of those 75 subjects from FreeSurfer segmentation.
So these are some of the atlases that are available. These are the ones that are installed by default. You can install more. We'll talk about some of those. Let's see, in the clusterized plugin. Let's see, I will just do quick clusterizing. And go to the report. This also has a where am I feature.
For each of your clusters, it will report the overlap of the cluster with regions from across the different atlases. And it takes it some time to generate. So here it is. Here's the report from that. And the Talairach Daemon the first cluster intersects 12.9% with this region, so on.
Then the second cluster overlaps the second volume of the Talairach demon, which are the Brodmann areas, 7.2%. And you can go down this long list for each of the regions, each of the atlases and see the overlap. So that's all available to you there. You can define which atlases you're actually interested in AFNI. You don't have to look at all atlases. You can say, I have an AFNI atlas list, and configure that the way you want.
So that's when we see some of those features that are built into AFNI. I'm going to close this for now. And I want you to see kind of how the inner workings of how AFNI knows about atlases. Now, AFNI is not Talairach specific despite our view names, and despite our earlier history. We started off with Talairach one of the first groups that ever showed a Talairach Daemon. You can see where are our AFNI-- our atlases are configured.
Almost everything AFNI knows atlases is defined in one file. And so that-- let me do [INAUDIBLE] because it's a little bit easier. OK, so less tilde slash A bin. And I have-- there's a file called AFNI atlas spaces dot niml. And NIML is a neuroimaging markup language, an XML-like language that we invented for these kinds of files. We use NIML in different ways. This is one way.
So this file has almost everything that we know about atlases. First we define the template spaces, just like in this class we define what these words mean. Here we define specific instances of what template spaces are. So the first one listed is the orig space. This is the native space of a data set.
And this is actually a very recent addition to this file, because we don't actually have to define that in most cases. We have the next one is the TTN27 template space. And you can see that that is a specific form of the Talairach space. So we have the space name and we have a generic space.
And then we have some description of it. And that's all it takes to define a space. And all your data sets will have a space associated with them. AFNI format has a space attribute inside its header. If it's a NIFTI data set, there are-- you can either carry the AFNI extension with it, or it can have it as part of its S form codes that say which space it is, and there's a very, very limited number there. So this is a little bit more robust.
So then we have other kinds of Talairach spaces. And then we have various kinds of MNI spaces, as I said. The MNI has lots and lots of variance. And so you just say which MNI template you're actually using, because there are many different forms. There's also the MNI Anat that we talked about yesterday.
We have forms from MNI and SPM and FSL, other forms. There's the Haskin pediatrics. So we developed a new template. And that means there's a new space too.
The next section of this file describes the transformations, the spatial transformations to go from one space to another. And they're pretty simple. We basically have the source and the destination space. Some sort of name for the space, and how it goes between them.
So to go from TTN27 to Talairach space, well these are two variants of the same space. So we'll just say that's an identity. It doesn't actually have to do anything. Our code will take care of that in a special way.
And other ways to go between forms of Talairach space are going to be very similar, just identities. And then we get down to how to go between Talairach and MNI space. And that's a much more complicated question. So going between Talairach and MNI space was defined in one way using this thing called a Brett transform, the two-piece transformation that is actually built into AFNI in some parts. If you're doing that and it doesn't know anything about the space, it will use the Brett transform by default.
You can also use specific transformations. So Lancaster and Fox in 2007 came out with different ways to go from MNI space to Talairach space. And these are bidirectional, so you can invert the transformation and go the other way. And depending on which form. So they defined it for MNI SBM 2, MNI FSL. And MNI other.
And you'll note that each of these has-- well, they can have a distance associated with. So you can control which one is preferred by the distance. And if it's we calculate how to go from one space to another using the shortest distance. So you can manipulate that a bit.
To go from MNI space to TTN27, this is a special case because we transformed the N27 data set ourselves from MNI space to Talairach space. So we know exactly how that happened. We used a 12-piece manual transformation. So to go back, we just have to apply the inverse of that transformation. So here's one way, and then if we can just calculate the inverse.
To go from MNI to MNI Anat is here. So we have just the few millimeters in one direction and the other. And both directions are listed here. So that you can see that it's pretty simple to define spaces and the transformations. Then we have actually the definitions of where our atlases are.
So first one listed is the Talairach Daemon. It says what the file is. The TT atlas plus Talairach. As this is the name and this is the file. And what space that atlas is in. And then some description. And then if you go down here, you'll see that the Eickhoff-Zilles atlas-- this is the 1.8 version listed here --has a lot of publications associated with it.
And all these people have contributed atlases. They're all expecting you to cite them. They've put a lot of work into them. So for the Eickhoff-Zilles atlases is in particular, there are multiple publications to site. So you would cite their overall-- one of these overall tool box citations, and then the particular region that it came from.
Let's see. So let's go down through there, the maximum probabilistic map. So this is how AFNI finds the atlases. Go down through this. Templates are listed too. Now, you can see a summary of this kind of data by typing on the command line, where am I dash show atlases. And it will show you the atlases. And we have show template spaces.
We have-- if you want to see what regions are available across all atlases, you can do where are my show atlas codes. Show atlas code, sorry. Single. And it goes through all the different atlases and tells you what regions are and all of those.
Now, if you wanted to add something specific, so you wanted to add the marmoset atlas or add the macaque atlas, then we give you a separate file called custom atlases dot niml. And custom atlases dot niml has exactly the same format, except it's got the space definition and the atlas definition for the new atlas. And you can extend that as you like. You would create a new supplemental atlas directory. And that would be where you'd keep all your list of custom atlases.
If you want different atlases for every directory that you run AFNI, and you can-- that's also possible with session atlases dot niml. So when you do a free surfer segmentation, that actually provides you a session atlases dot niml file, your own personal atlas for that particular subject. And so it will read that. That has, again, the same format as the niml file we just looked at.
So some of the atlases that are provided with AFNI, the Talairach Daemon. I'll talk about some of this. So you see that the Talairach Daemon has the gyrul areas. And it has the-- it's a two subbrick data set, gyrul areas and Brodmann areas. And you'll see, the Brodmann areas don't overlap. This N-27 data set that's underneath it very well. Actually, the chance of their overlapping anything is fairly small, because these are very thin areas and there is no template to align to them. So that that's a problem. And there are more problems. We'll see that in a moment.
We have the Eickhoff-Zilles atlases from the 10 postmortems. These are the probabilistic maps on this side. And these are the regions in the 1.8 version. We have the macro labels, the Eickhoff-Zilles group, they also did macro labels. These are drawn on the N-27 data set. And they're more complete coverage. So done for that particular subject.
These are the Desai atlases. We have the probabilistic maps available too, but in the standard distribution we just apply the maximum probability maps using-- they were created with that auto Talairach across the 75 different subjects. And they provide both kinds of segmentation that comes out of FreeSurfer.
So back to the Talairach Daemon. A couple of years ago, one of our AFNI users noticed that when he was looking at slices in AFNI of the Talairach Brodmann areas, the Brodmann areas in Talairach space with the Talairach Daemon, he noticed that Brodmann area 6 didn't look like it was contiguous. All the pieces weren't touching each other.
And we thought, well, it's just, you're not looking at the three dimensions. That's probably not a problem. But then we looked at it, rendered it, and here's a rendering in SUMA. And you can see this L-shaped piece is out by itself. And looking at it more closely, you can see that that one has been mislabeled.
This was done by digitizing the Talairach to our no atlas, putting it into a volume-- these are 5 millimeter slices. You can see they're kind of thick slabs compared to the anatomical volume. And this atlas has been around for more than 20 years. And no one noticed this. It's been in AFNI, it's been in all kinds of packages. And no one's ever noticed that the Brodmann areas, actually this is only one of many, many examples in the Talairach atlas that have this kind of mistakes. There's a lot of areas that are not contiguous.
And so this is something that we are working on trying to fix for ourselves. But I don't think that the Talairach Daemon is a very good choice. If you can avoid it-- it is, unfortunately, one of the very few that provide any information about the Brodmann areas, so we're going to try to develop something new, or get something new that has Brodmann areas in it.
Yesterday we looked at go to atlas location, and the where are my in the GUI. Now, where am I in the GUI is one way to use where am I. You can also use it on the command line. And it works pretty similarly. Here's an example.
This one is where my in the command line actually has more capabilities. So you can take the output from a clustering command. So this is a 3D cluster. We have a newer version, a newer command called 3D three clusterize that does something similar. So we're going to get clusters of the F-stat here and put it into a file got clusts.1d.
It will have separate columns for the center of mass in columns 1, 2 and 3. These are the locations. We're going to feed that-- the clust1d table into where am I, and where am I will report what's at each of those regions. So you can automate your analysis with atlas regions on the command line. So this is all scriptable, because in AFNI we like to have everything scriptable.
What else can where am I do? Where am I can report the overlap mask just as we saw in the clusterized plugin. This can be done with where am I dash O-mask. You give it the region. It says-- looks at it and says, OK, there's a value-- for every unique value it will see the overlap across your atlases. In this case, 89% of this region overlapped the middle occipital gyrus. But it goes through all of the atlases like that.
We also looked at atlas colors yesterday. So you can color all the different regions. If you're interested in a particular area, you can show it inside AFNI in the GUI. So I've shown you various atlases and templates. Very often people want to make their own atlas, and this is a little description of how that works.
We have these two scripts, the add to MNI awarp and add to MNI qwarp bar that will-- and this is showing how it goes through the process. You start with some initial template. You finally align to that initial template. And then take averages of your data sets and repeat the alignment again and again until you have your own new template.
This is a very long process. There's a lot of nonlinear warping that goes on. But you can end up with some interesting things. And several of our users have done that. If you have in atlas that you like that's from someplace else, you can make it into an AFNI compatible atlas fairly easily. You don't need to make your own template. You can make your own atlas too.
And you just create your supplemental atlas directory. This is where your custom atlases dot [INAUDIBLE] file will go. And you call this script @atlasize and you tell it what space that atlas is in, and the data set to give it. And then a file of the labels. It says what is the name of the region, and the index of the region.
So the name might be in column 1 and the region index is in column 0, for instance. And then whether you want it available as for all atlases or for all sessions or for only one particular session. This determines whether you get custom atlases or session atlases [INAUDIBLE]. So easy to take somebody else's atlas and put it into AFNI, and then it's available in where am I. So it's fairly extensible.
In a previous bootcamp, Peter Molfese, we had a bootcamp at Yale. And he was at Haskins Lab there. And he's now at NIH. And he wanted a pediatric atlas. And he had pediatric subjects, so he made a new atlas in the method I just talked about. We had to figure out exactly what's the best way to do it.
So we started out with an affine average and then nonlinear averages. And so we have that available in AFNI too. And you can see the difference between what an affine group and what a nonlinear group looks like.
We compare different techniques, because you can do this in lots and lots of different ways, and we wanted to be sure we were doing it the best way possible. One thing that we did was interesting that we compared, we aligned every subject, all 75 subjects to all of the other subjects, 74 other subjects.
And we looked for the subject that was the most typical in that. That was the one that had the smallest deformation to all the other subjects. And that's what this guy over here looks like. This is the most typical subject. Presumably that would be a good starting point. Like the TTN27, we have no idea whether the N27 data set, the [INAUDIBLE] brain, is a typical person subject. It's not too bad. But it's not exactly typical. It's a little different than what we would get if we would average over lots of different subjects.
We found this typical subject. We also found the most atypical subject, the weirdest kid in the group. And there were some issues there too. And we also had to remove some-- it also shows up as a kind of quality control measure too, the ones that are the least typical.
And what we found was the iterative method using an affine base, using that blurry base for our nonlinear iteration was the best. But you can see that all the iterative methods came out pretty close. And even starting with none-- even starting with any particular one, it actually-- they all come at pretty good, as long as you go through this iterative process. But this one ended up being-- this one affine iterative ended up being the best by all the metrics that we could come up with.
SUBJECT: Was that the best just in this one case? The affine iterative seems like it's going to be a much faster process than nonlinear.
PRESENTER: It is a nonlinear process. It's still the nonlinear procedure for all of these things, but it's just what do we start with. Yeah. So in the end, we end up with the reasonable atlas, and we think it's the best one that we could do for that data.
And we can integrate it into AFNI, because the AFNI is flexible in that way. So we can add our own atlases in. And so when you put in a new space, you get-- it shows up in your, can show up in your list of spaces. So it's in Haskin Ped space. And you can have it show up in where am I like that.
And because it's relatively simple, we can take other people's templates and atlases. So we have the infant brains atlases and templates from Feng Shi at UNC. The neonate, the one-year, the two-year brain templates, and there's a lot of other ones that go with this, and then the atlases that go with that.
We have the cerebellum atlas and templates from Joern Diedrichsen. We have Scott Mackey's ventromedial prefrontal cortex shown here. We have the Waxholm rat atlas. And you can see that here this is a fairly impressive work here with 39 micron MRI of a rat brain. That's shown down here.
And then there, this region is drawn for that. Some of the region-- the cortex is pretty much one region. But subcortically they've divided a lot more. And here's a rendering inside SUMA of the regions of just the hippocampus. So a lot of things you can do with atlas is you can add some atlases pretty easily. [INAUDIBLE] at NIMH, he and two others drew regions for the BNST and that's just one region. Very, very small region. And he added that to-- we've added that to AFNI too.
The Brainnetome project has a lot of regions determined through DTI and resting state fMRI. And we've added that in. Here is the volume and the surface renderings of that Atlas. And we have the Allen Mouse Brain. So all these are things that people have asked for.
A very-- a great long-term project that we've done for many years is with Kadharbatcha Saleem who did the macaque atlas. First he did a paper version. And that had been available for many years. And is generally regarded as the best macaque brain atlas.
We went through long procedure to convert that into digital form, and it's available in AFNI with just @install d99 macaque. So you can automatically download it and set up the variables so that it uses it in AFNI. He also provided connection information from tracer studies. So you can have a fairly large list of connections.
So if you click on a region, it will-- with these region names, it will show you what is connected by tracer studies. And you can see it either in this format or in a matrix format. And these two talk together. And they also talked to AFNI. This is inside SUMA, which we will show you tomorrow.
So that's a really nice atlas. It's done-- Saleem has put a lot of work into drawing all the regions and making sure it matches the paper version of the atlas too. We also provide coordinate transformation so that you can know where to look in the atlas too. We have some just preliminary links set up. So if you click in where am I on the 45A, it will open up a page on the AFNI site for describing that region and the connections for that region.
We also have alignment [INAUDIBLE] for macaques to align to the template space and then bring the regions back into the native space. So that's macaque align. And these are various age macaques. We have-- from another group at NIH, they took 31 macaques and then aligned them together using a similar procedure as what we described before, that they used the [INAUDIBLE] program to do that part.
And they did some segmentation of those regions. And 31 macaques, surprisingly, come out with a result that has more detail than one-- than the d99 macaque even at average together iteratively. These can show things like the colostrum, which you can see in here, which is a very fine structure.
And it's not typically visible on most MRI scans. But it's not that visible on any one of the MRI scans of any one macaques. But when you average them all together, it comes through the noise, and we can even see subthalamic structures, and you can see we have a fair bit of the vasculature too.
So that's available with AFNI. We have another install script I think for that. And it's on our website. That's not impressive enough. Those were 250 microns. This is NIH marmoset template and atlas from Cirong Liu, Afonso Silva and a bunch of other people too, [INAUDIBLE] and I worked on this too.
And this is at 150 microns. And we have it at-- the atlas is that as at three different resolutions. Low, medium, and high resolution. And we have the Paxinos atlas too, transformed into this space. So that's, again, it's it becomes part of AFNI, because AFNI is not specific to any particular space. So it's easy to use.
But Cirong is never satisfied so he has making this even better. So 150 isn't good enough. He's changed-- he's going and DTI is down to 80 and even 64 microns. And this is a T2 [INAUDIBLE]. This is the 150 on this side, and then he has 50 micron on that side. And 50 micron, you can start to really see a lot of very, very fine structure.
And so he's able to-- he's been drawing these regions that are very, very detailed. And he's also providing tracer studies from the literature. So to make a connectivity table too. So this is phase two of this marmoset project. And this is coming along pretty well.
So here the DTI becomes very close to what you see in histology. You can see-- and you don't have the problems of histology, because you have the whole volume.
If you take any-- if you do FreeSurfer segmentation on your human subjects, back to humans, then you get the equivalent of an atlas for that subject. And that will show up in AFNI in a couple of different ways, and can also have it show up in where am I.
It gives you a table-- a data set that has an atlas, points list table, which I didn't mention before. If you do 3D [INAUDIBLE] dash atlas points list on your data, set it will give you the table that's in the header of that data set. So we're still working on lots of things. Just this morning, I had an email from Megan Robinson and Mike Beauchamp. They've transformed the HCP atlas-- this is for use in AFNI. It will soon be available.
And so this is the Human Connectome project from Matt Glasser. So [INAUDIBLE] a procedure to get it into MNI space. And I think it's a pretty decent atlas. So we'll have that available soon.
The Human Atlas Working Group standardized the HAWG, HAWG standardized format was accepted by all of the software makers and atlas makers as a new standard. We just have to implement it. So that requires a little bit of work. But at least we have an agreement on what to do with that. So it's a pretty simple format using JSON, and we just need to write it up. But that's in the works.
PRESENTER: Well, there are at install scripts for some of them. And then there are just downloads for others. If I-- let's see, if I open up-- you can see where all the atlases are, because everything that's available is in AFNI. So we have all the atlases under just atlases. I mean, they're not necessarily pretty, but they're all here. There's marmoset, there's macaque. And macaque has the NMT and this is the d99.
NMT has its own versions. There are new versions of NMT that will be coming out too. So they're enhancing that too, enhancing the segmentation, improving that. And if you type at install and then tab, you can see all the things that could be at installed. At install NIH marmoset is one of the commands. You can also at install d99 macaque.
SUBJECT: Is it easy to specify [INAUDIBLE] individual [INAUDIBLE] atlas script or [INAUDIBLE]?
PRESENTER: When you're running-- oh, oh, yeah. So if you put the label in the name, which I will show in the ROI part of the talk, it will automatically get that label from the data set. So that will be in-- that's from the header of the data set. It says, OK, I'm looking for amygdala. Which code is amygdala? Go get that number. And you don't have to worry about what number it is.
So yes. It is available. It's usable as it is just by name. And it's a preferable to use atlas regions in the same way as you would use subbrick labels. So that you don't get mixed up and if things get reordered, you don't have to worry about it.
So this is the talk on ROIs. And so first definition. What's an ROI? Different software will call ROIs different things. So we use ROIs in a certain way. We use it as a kind of a bit mask and just say what's-- an ROI and an AFNI is really just another data set. It's a volume. It has exactly the same number of voxels as something else that you're interested in most likely.
And at 0 are usually the areas that we're interested in. And usually, even more than that, we're usually interested in positive values. So positive values are the areas we want. Those are our regions of interest, the ones we're interested in. And zero values are the ones we're not interested in. That's how we do it.
In other software, you might have vertices, so it says this coordinate is connected to that by some polygon. So we don't do it like that. These don't have to be contiguous. ROIs can be a value there and a value there. They could be completely separate.
And we will usually save them in a smaller format. We have integers usually, and even more so small integers, so we'll save them as bytes. You don't have to. But it's most likely that's what you'd want to do. How do you create them? You can draw them, you can cluster them, and you can get them out of atlases. Those are three ways to get them.