33 - AFNI DTI & FATCAT - Part 2 of 2
Date Posted:
February 15, 2019
Date Recorded:
June 1, 2018
Speaker(s):
Daniel Glen, NIMH
All Captioned Videos AFNI Training Bootcamp
Description:
Daniel Glen, NIMH
Related documents:
For more information and course materials, please visit the workshop website: http://cbmm.mit.edu.ezproxyberklee.flo.org/afni
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.
DANIEL GLEN: OK, so I'm going to continue on the DTI pipeline. So it's now packaged in a little different way. So that old flow chart isn't what we follow anymore. And it now includes tortoise. We include the DICOM importing and even Freesurfer called within this setup. OK, so we have-- this I don't think is in the handouts. I'll have to put it there. This is from OHBM 2017. So I'll have to get that into the handouts. OK, so we have a new flow chart. And in this new flow chart, we have basically three starting areas-- the DWI data the t2 data, and the t1 data.
With the DWI data, we'll bring that in with DICOM [INAUDIBLE]. We bring in all the data this DICOM data with DICOM [INAUDIBLE]. This is Chris Riordan software that we now distribute with the AFNI. Ours is called DICOM [INAUDIBLE] underscore AFNI. So it's the same software. We just build it in our source code too. OK, so we bring in our DICOM data. We have a viewing tool so that you can look at the volumes and select out bad volumes.
If you have both anterior to posterior and posterior to anterior, the blip up down pairs, it will show you first the one and then the other. And you can select which volumes have to be removed. And it will take the union between those two and remove both sets from your data set so that you don't have to analyze those and update your gradient matrix too. We have a tool to look to see if you've removed some bad volumes. Are there areas that are less covered than others? Have we gotten a full coverage of the gradient directions? We have that gradient flip test I showed you also before too.
OK, on the t2 direction, we bring that in with DICOM [INAUDIBLE]. We center all the t2 images. And we put them in a standard orientation, some uniform orientation. And then we do something called axializing. And you may notice that all the scripts start with FAT something for FATCAT. We're trying to simulate the AFNI proc. So this is the FAT proc. It's not as flexible as AFNI proc yet, but it's getting there. OK, so FAT proc axialize, we axialize the anatomical data sets. That means rather than have data sets that are tilted in one way or the other, they're generally roughly ACPC. So they're straight in one direction.
And this is a good starting point for alignment between t2s and DWIs and also with t1 data. And this also helps-- the t2 are the basis that the DWIs get aligned into in the t2 space. So we will have everything there. So this is a typo. It should be RGB. So RGB colors of the tracts, when we're looking at them as color encoded vectors, then we will see them in the colors that we can recognize.
So we'd be able to tell whether things have gradient flipping, whether we could see major fibers running from front to back or side to side. For the t1s, we look at alignment with our t2s. And so we have displays. We have automatically save displays so you can see that alignment with edges and translucency. And then this all gets fed into this and then we also can include Freesurfer's reconstruction and that gives us the parcellations for tissue types and for regions.
That we also call-- when we use Freesurfer, we always call at SUMA make spec FS, and that creates our standard mesh data sets too. And we take those ROIs and sort them by tissue type that we're going to use and together with our DTI data. This all gets fed into tortoises diff prep. So tortoise is that package from Carlo [? Piopalli's ?] group. Diff prep is the preparation procedure for the diffusion tensor imaging. And it does the distortion correction and the motion correction and we also will call Dr. Buddy. Dr. Buddy is that blip up down correction.
Until recently, tortoise was not scriptable. so you had to go in and click. This was an IDL package. It was fairly slow and tortoise was called tortoise because it was so slow. It's now much, much faster, and it's scriptedable. So the name is still tortoise. You'd still if you calculate the tensor inside tortoise, you still have to open up the GUI. But it's a very fine package and [? Okan ?] [INAUDIBLE] has done a great job in making this scriptable. So this enabled this whole pipeline to come together.
We calculate our tensors after it goes through the preparation procedure with a FAT proc DWI to DT. This is a wrapper for a 3D DWI [? DT. ?] It makes sure that our-- gets the all the gradient directions prepared in the files properly because these files have lots of different formats. There's b matrices and gradient directions. And so they can all go in different ways and everybody has a different standard. We have tools for putting them in into a common standard and to our standard anyway.
So we compute our tensors. And we can then have-- these are the directional encoded maps. So these are the that first eigenvector that's been colored by the fractional anisotropy. So the directions are in x, y, and z. We'll make that similar to a red, green, and blue. And so we'll be able to see the direction of a fiber by its color. And then we'll make it brighter if the fractional anisotropy is higher.
OK, so then we have our parcellation that comes out of Freesurfer. We have that in t1 space. We know how t1 gets to t2, so we'll warp these over to the DTI space. And with FAT proc map to DTI. Now we can do our tractography. So we'll get our target regions with 3D ROI maker. We'll calculate our tracks with 3D track ID. And then we can visualize all this with one of these scripts FAT proc connect vis. We can just use it generally with AFNI, SUMA, and fat cat. And we'll take a look at some examples
And you can also do some statistical analysis on all these tables that come out. Here's an example here of the visualization. We'll see this in a little bit more detail. We try to look for artifacts as we go. I think we have something somewhere around here, where we're going to look for zipper artifacts. So zipper artifacts, it'll be striping through the data. And we have a tool 3D zipper zapper that looks for striping.
Paul sent me this, asked me to make sure that everybody sees this. Because this is called FATCAT, he thought I should work this in, because he accidentally did a Fourier transform of his cat. And that's what it looks like. That's sad. OK so and Bob actually responded with an actual Fourier transform of the FATCAT. And that's what that looks like. So we can tell them that we did include their suggestions for the presentation today. So if you have installed FATCAT demo 2-- I guess we did we never told them to install it. We probably should have told them to do that before the break.
AUDIENCE: [INAUDIBLE]
DANIEL GLEN: Yeah, that's the new one. So you do-- it may take too long to do this, but you don't have that many people here. But I can get started to describe it anyway. Even if you don't have it, it's OK. So at install FATCAT demo 2, if you don't have it. If you do have it, it will be in a directory called FATCAT demo 2. Let's see, I have it here. So this is the latest demo. The previous demo was just deterministic tractography. This one, it doesn't go through the processing as much in terms of a demo. But it's a complete pipeline here.
So let's go through and show-- see what it has. Data basic is DICOM data. We don't need to reanalyze that to reimport that. So we won't do that here. Data proc is where our process data will go. And these are our scripts. So we have various do scripts. So let's take a look and see what those do scripts do. There's a read me guide also here that has an overview of this. You can type at install FATCAT demo 2. It would be like that
OK, so the demo comes with DWI data, t1 data, and t2 data, and then some descriptions of those scripts. So the first script-- the do00 proc subscript. This is just a wrapper for doing the whole group of subjects. It will do one subject after another. It's just a simple loop across subjects. Do01 subject complete-- this is where it gets interesting. This is the actual processing of the data. So let's take a look at that. Just to tell you that the other ones, the example visualization, this will show us our tractography results. That's where we get our pretty pictures. That do03 gives us a QC result. This is where a QC process, not a result. This is where we're going to pick our bad volumes and remove them from our analysis.
This is a kind of manual censoring, and this will take care of which gradients we take out of our tables, and then which ones aren't there. And so it's a little procedure for that. And then do04 shows us the grid files from track ID. And then there's some more descriptions of all the data that goes into this. Here we have the converged conversion of the DWIs, then we convert the anatomicals. This is the same as the flowchart. Maybe it'd be interesting to actually look at the file where we do these things, so you can see the commands.
These are example scripts so you can you can play with these. So let's do that. Let's see LS and I'll edit-- I have particular editor. You can edit with whatever you like. So I'll edit do01 subject complete. OK, so we set up some variables where our data is. Then we go down here and we will find-- let's see what we will find here. OK, so this is converting our DICOM data. You'll notice that all these FATCAT programs-- they start with FAT proc.
So we convert our DICOM data. Then we axialize our t2 data. We align our t1s to the t2s. We run Freesurfer with just the traditional recon all. And then run at SUMA make spec f-- make spec FS after that. We'll mask our data. And then we'll look for artifacts with that zipper zapper. So we're looking for striping artifacts with 3D zipper zapper. Now we'll tag those and prepare our gradient matrix for the diff prep file. And diff prep will do our alignment for the t2. And it will also remove some remove any current distortion and do motion correction.
Then we call Dr. Buddy. And Dr. Buddy does our blip up down correction. And then we calculate our tensor with FAT proc DWI [? DT. ?] This step calculates our directional encoded color maps from the first Eigenvector and the fractional anisotropy. All of these FAT proc scripts, they all produce images, JPEG images that we can look at later. So it's very easy to review our analysis.
OK, so now we're inflating our gray matter ROIs and then doing our tracking down here. So that is our basic pipeline. And here, this is the 3D tract IDs is where all the tractography happens. This is doing the probabilistic tractography. Any questions on that script? It's doing a lot of stuff. It took a long time to develop, so let's go into the next script.
This is some visualization. So here we're going to basically drive SUMA. We're going to have SUMA open up with the results of what we just looked at. And say we only want to look at one particular set of regions, so ones that go through the right thalamus proper, we can do that. Let's just run that. So I'm going to do TCSH do02 example, [? viswm ?] dot TCSH.
OK so here's-- we've opened up SUMA here. And we have just the ones that go through the thalamus. So these are the probabilistic results. And it's colored by regions. The grayscale here is the axial slice of-- I believe this is the fractional anisotropy image. And that's a good point. Inside SUMA, we can show volumes now. We're showing slices as we did in AFNI.
And so we can manipulate those by right clicking on the slice itself. So if you right click, it shows you that it is the fractional anisotropy and shows you the value at that coordinate. If you do control s, you can open up the object controller. Control s for the surface object controller. And you can change the slice that you're on by dragging slider.
So this is a good way to visualize where these tracts are. And you can also do this with the sagittal slice. And if I select the slice and then I do shift scroll, I can scroll with this scroll wheel. If I right click on the slice and then two shift scroll wheel, it will select that slice.
AUDIENCE: [INAUDIBLE]
DANIEL GLEN: You could. From Freesurfer, you could add that into the SUMA command and say, I just want to see-- Yeah, this is a good idea. So it should be in the demo with that, I think. Yeah that's a look at it. So that SUMA command line, you can put various kinds of inputs. You can put a spec file with surfaces in it. You can put a GIFTI data set on the command line. You can put edges. You can put tracts, bundles like this. these are actually GIFTI data sets.
So here we can right click on any of these and manipulate these independently. I think, yes we can.
AUDIENCE: [INAUDIBLE]
DANIEL GLEN: Yes, if you connect it to AFNI, they'll talk to each other and show you where that is. So if I open up this in AFNI, they will be at the same location. Here you can also take this. Let me go back to the slice. As I pick each of my slices-- each of my objects, it becomes the object in the object controller here. I can say turn on the volume rendering. So here's volume rendering of my FA data set. Maybe not so interesting, but
AUDIENCE: [INAUDIBLE]
DANIEL GLEN: Yeah, so we still have the slice turned on. Oh, which extra thing? How did I get this rendering? The V here. So I clicked on the V button. So you can do this with any volume in SUMA. Bring it in to SUMA and show it with your images and tracts and tables and all kinds of stuff, the connections. I will be showing a few more kinds of examples of this in the afternoon. So this is a lot of fun to do with a lot of data. You can bring in lots of different kinds of data and see it in various kinds of contexts and color them differently and render this in one way and that and another.
So it's another one of our endless fun things. So you can see-- if I raise up the fractional anisotropy enough, I've got a kind of white matter map of the brain. Change the transparency of that too. So just some more context for your data, There is example [? three, ?] also. I think that doesn't quite finish on mine. I don't have all the R libraries installed. You need to have several of them. You need [? psi ?] pi installed in your system and then shiny and [INAUDIBLE] and plotly. And I'm having problems with plotly on my end.
But I can start to show you what that looks like. So this is where you select which data, which volumes are bad. If you see a volume, there really is anything too bad here that I can tell. But if you don't like the looks of one of your volumes-- that it looks like it's there's some kind of artifact there, you can remove that. So let's say I don't like that one. So it knows I selected volume 5. And then I could say that's a bad volume. And if I change my mind, I can say unbad. This is a kind of undo. But you have to do it individually.
And then when you're finished this, this is in one direction. So this is in the anterior-posterior direction. The blip down will be shown next. And so it will ask me the same question [AUDIO OUT]. And it just takes a moment for it to calculate. OK. So a lot of things going on here. It will soon start. It's saving a lot of images along the way. And we'll show you how to do that in the afternoon. OK, so now I'm in the other-- the reverse direction. And I do the same thing. This time I say I don't like number 18.
I'll say that one's the bad volume and then finish that. And it updates my gradients and my data sets. And then it's supposed to show me something else, but I don't have all the libraries installed. So it doesn't work for me. All right, so let's see. There was another command I wanted to show you. Let's see if this will somehow work. I doubt it.
All right, so that is a kind of pre-processing step, the quality control. So you would look at your data beforehand and see if it's OK. I think this is getting close to the end of that. All right. I think I'll just stop that and go to the next part of the demo.
So we can also look at the grids that were output. 04, so we have some grids that come from this. OK, so here this-- we're looking at bundle length as a function of the ROIs. And the colors are how long the bundles were. It says hit a key in the terminal to close the point and move on. OK, so now this is our correlation from our resting state data, correlation coefficient, similar kind of table, same ROIs.
AUDIENCE: [INAUDIBLE]
DANIEL GLEN: Yeah, they can be shown in SUMA. This is an overly complicated example of a similar table that can be shown in SUMA. Yes, so you can show these connection tables, these network data sets in SUMA. They're graph data sets-- it's a particular kind. And so it will show [AUDIO OUT], and they will connect with the rest of SUMA. So you can click on that. I will show an example in the afternoon of connections in a similar but different way at the same time.
So yeah, there's a lot of functionality there. This has all the Atlas regions showing the connections, the fractional-- the mean FA value connecting them from the Freesurfer parcellation. This is where missing the plotly part. OK, so let's see. And I copied over one thing. Let's say I have another demo. I wanted you to see how you would do tractography in SUMA. And so this is it.
So this is the deterministic tractography. We do the deterministic tractography as part of our analysis, as part of the pipeline, but only in one place now. So that's when we're checking for the flipping because we're looking to see where we see more tracts. The more tracts, the better. That direction is going to work out best for us. Generally if you get the flipping-- the gradient directions wrong, you'll see fewer tracts. Things won't connect that ought to be connected. And so that's where we use the tracto-- [AUDIO OUT] as a quick way to look for flipping.
Anyway, so we have some tractography data there in the test flip directory. So I'm just going to run it, so you can see what that looks like. There's something strange with my driver because these are a little bit more feathery than they we ought to be. But that's OK. So here we can-- we have the same slice, kind of slices we've seen before, the FA slice.
And we have the whole brain tractography done. You can see all of it at once. These are kind of beautiful images to play with. So you can right click on an image, on a tract. And then we can open up that controller. And we can do create a mask by clicking on masks. And if I double right click on the mask, it changes it to this meshed ball. And as I move this ball around, I can do tractography on the fly.
AUDIENCE: [INAUDIBLE]
DANIEL GLEN: You looked away. Yeah, well, that'll show you, right. I'm sorry it's not included in the regular demo. But yeah, so-- I did this. Let's see, do I have that? The data is there, but I think all the data is there. But this quick deterministic demo is one that Paul just sent me because I wanted to have something like this to show everyone. If you want to see a more complete visualization of the deterministic tractography, do the at install FATCAT demo, and go through each of the visualizations for that because that will have a lot more description of what to click on that.
But I will show you this anyway.
AUDIENCE: [INAUDIBLE]
DANIEL GLEN: They should have this data if they did the at install FATCAT demo 2, they should.
AUDIENCE: [INAUDIBLE] FATCAT demos
DANIEL GLEN: They have that? OK, so they could potentially do that. We could, oh but they have to-- the problem is they have for that, they need it to be processed. And that takes some time, more than that for-- yeah it's a little bit longer than that. I think it's more than 10 minutes for some people. I think it's more like 30 minutes, but I could be wrong.
AUDIENCE: If anyone wants to, you can [INAUDIBLE]
DANIEL GLEN: That's right, you can start it before you go to lunch. And you run for the FATCAT demo, run do00 something. And it will do all the processing on that data to generate the deterministic tractography. And then do06 is a demo to show what it looks like. And then do09 has for [AUDIO OUT], which is a pretty nice one. So anyway, this is--
AUDIENCE: [INAUDIBLE]
DANIEL GLEN: I just asked you to install demo 2 because it's the latest recommended pipeline. That one is not from the recommended pipeline, but it's cool. So that's in the original demo. Yes?
AUDIENCE: [INAUDIBLE]
DANIEL GLEN: Yeah, you should have that data. So you just need to do the do00 script and it will run the processing on that. For the class Paul had that done so that you could see something, even with a deterministic tractography. But now the whole pipeline includes things like Freesurfer and tortoise, and this takes hours and hours to do so. So it's included there, but you obviously don't want to run it in the class. Anyway, so just to look at the SUMA tract-- you give it SUMA dash tract and the name of the tract that's generated and then the volume to show with it.
If you put dash SV, it'll let you talk to AFNI. Also you give it another volume. OK, so these tracts are stored in this directory. So if you want to do the same thing that I did, just do dash tract underscore temp underscore test flip, and so on. I'll leave that up on the screen.
AUDIENCE: [INAUDIBLE]
DANIEL GLEN: It's not there. I just put it there in my directory this morning because Paul, I asked for where-- if there were any deterministic tracts in the directory, if there are, you can see it with this command. So you have to retype that command if you want to see this. So if this is talking to AFNI, this ball will show up in AFNI. And if you have it on a surface, the surface-- the ball will show up on the surface too and in the volume. Oops.
Yes. So there are various things that you can play with inside as these are all-- you can change brightness, the dimming factor. You can change opacity. You can change the line type. You can add in multiple masks. So if you want more masks, you can do that here. And you can do it, A's and B's, and A's or B's, and things like that. So that's all described more in the other visualization, in the install FATCAT demo visualization. All right, I think I've gone through the whole-- the FATCAT business as it is in the pipeline.