0:13

So this is Theme 4, Lecture 9.

So, getting anatomic information from the ROI and the atlas together.

So, in the last lecture, we took the ROI and we put it in the template space.

So now we have the ROI in the template space and

we have the Eve template, which also has an associated atlas.

And the atlas has segmentation for a bunch of the substructures and

a bunch of the structures in the brain.

So it's actually is a full brain segmentation that maps all

the voxels to a specific area.

So, now what we can do is cross-reference where the ROI is placed

in that template space.

With the manually labeled areas to say where is this brain tumor in words.

So, now with the ROI and the template again in the same space,

we can take the pre-labeled atlas.

And cross reference it with the ROI and

say where does the ROI live in the template space.

And then, we can use the labels from the atlas to say actually what structures or

what area of the brain it actually overlaps with.

So not only is the atlas segmented, it has actual clinical or

neuroanatomic labels to that.

So for example if somebody asked, where is this brain tumor?

You can say, maybe it's in the lateral part of the brain, the left, the right,

and so forth.

So, let's show you how to do that.

So first off, we are using the Eve atlas Type I,

there are a few different versions of this atlas, so we are just using the type one.

If you want to [INAUDIBLE] and download it, that's the one we are using.

But this should be located within your template directory, in the MOOC directory

in your virtual machine or in the data set that you downloaded.

So, it has a LUT, which stands for a Look Up Table.

So, the atlas is labeled with

labels one to about 100 and you need a Look Up Table to say.

This number one, where you have to look that up to find out

what area of the brain that is, that's why it's called a Look Up Table.

So we read that in R and we create a data frame.

So, the data frame consists of two columns, one being the index and

the second column being the label, right?

So, that index being on the atlas NIfTI image,

a voxel labeled zero for example as background.

One is the superior parietal lobe on the left side to the cingulate

gyrus on the left side, and so on and so forth.

So now every voxel in the NIfTI image has to be numeric, but

we can use this to actually say what that voxel.

What are of the brain that voxel is located in?

3:50

So again, when we do transformations of images,

we usually have some sort of interpolation.

So I take your brain, or I'll take an image and I'll warp it around and for

example a binary mask.

So when we put that in a new space it's going to be located with the voxel

sizes and the dimensions in the template space.

What that means is, although the region of interest initially was binary.

We actually take it, warp it and we do some interpolation,

AKA some local averaging.

So we take an area of the brain, let's say we put it here and

what do we want to assign that voxel to?

Well, we take a local average of neighboring voxels to get

that voxel value in the template space.

What that means again is that the ROI in the template space

is no longer binary due to interpolation.

So, I did a histogram of the ROI

after it has been non-linearly warped to the template space.

Again, note that this would have happened with the affine registration,

a rigids registration to the template and so forth.

So actually, any registration where you 're changing the voxel dimensions in

the space generally will have some interpolation.

So you have to, if you want to create a binary ROI,

again, you have to do some thresholding.

So in general, a lot of recommendations for binary mass for rigid or

affine registration, or affine transformations.

They say it's maybe used around a 0.5 cutoff,

but we recommend to investigate the image in the template space.

Or in the transform space with different cut off's to see what gives kind of

reasonable results.

And this is that are easy to do with one image, sometimes it's harder to do it in

the entire pipeline of hundreds or thousands of images.

But, you want to at least do some double checks to make sure that

they overlap to what the area should be.

So again, now that it's not binary, we want to say where is this ROI?

So we can do one of two things and I would say one of the most common things to do,

is to do thresholding like we just discussed.

Or depending on what we're doing to just add up the voxel values.

So in some respects, because we're averaging zero to one's,

this can be thought as a proportion.

Or maybe a probability that this voxel is in ROI is brain tumor, right?

So, for example for the impact to the histogram,

0.8 means that when you did some local averaging.

There was about 80% of the neighbouring voxels [INAUDIBLE], so

you can kind of think of it as a probability.

So sometimes for certain problems,

you way want a threshold, you may want to be able to just do a weighted sum.

Where you don't have to sets threshold agnostic,

it doesn't matter what threshold you use.

So here, what we're doing is creating another data frame and

I'll be using the plyr package, and I'll tell you why in a minute.

We're making another data frame, where we took the [COUGH] index.

Now corresponds to the voxel we take syn_roi greater than zero.

So all the voxels of the ROI in the template space that are greater than zero.

And we subset the labels, the atlas labels and we call that index and

then we took the again just the actual values of the ROI.

And so now you have a data frame with two columns one saying,

what is the value of the voxel of the ROI?

And the template space and then what is the associated label on the atlas?

So now I use ddply from the plyr package to say roi.df.

So the data frame we just created and I want to go through each index.

So every single label of the atlas and

I want to summarize it in saying I want to add up all the the voxels.

All the raw intensities or

I want to add it up where only voxels are greater than 0.5.

And I'm actually not adding up only voxels greater than 0.5,

I'm saying if you're greater than 0.5 you're a one.

You already have ROI and

if you're not greater than 0.5 we're going to set you to zero.

So these represent slightly different things, but

they represent for each individual atlas label.

The number of voxels that were counted, so either a weighted sum or

the number greater than 0.5, okay?

And then, we'll actually merge this with the data frame that has the labels.

For example the cingulate and so forth, from the Look Up Table.

So now we can say of the actual image of the ROI,

where do these things lie, and what percentage overlap do we have?

So again, I'm just doing some simple book keeping and

sorting here to actually sort the data frames.

So if you actually do use this code and actually look at each operation.

All we are doing is some merging, some sorting just so

we can actually get to this last table, which I will show you.

The areas of the brain that are engaged by the tumor or the region of interest.

So for example,

the precentral gyrus on the left hand side is engaged by the tumor.

And so what we actually did is we normalized these columns, so

we took the column and divided by the column sums.

And that now each element in this table represents of

the entire ROI, what percent engages this area.

So for example, 15.6% of the brain tumor is in

the precentral gyrus on the left-hand side.

12.9% is in the precentral white matter on the left-hand side.

And so one of the nice things that we see comparing left to right on each of

the rows, is that they relatively comparable?

So that, even if we use a threshold of 0.5 or you use the weighted sum.

You get generally the same results for

how much of the brain tumor's engaged by a certain region.

So this is really nice, so you can now tell clinicians that this patient.

For example, 9.4% of the brain tumor

was engaged in the superior temporal gyrus and so on and so forth.

And then, you can do more things, as in collapsing left and right labels or

collapsing larger areas, so on and so forth.

But this allows you to get to some clinically meaningful or

translatable answer.

10:28

So, there are two ways that I believe we can describe this data.

So, either you say, the denominator is the total size of the ROI, or the brain tumor.

So, in some instances say, 15% of the brain tumor is engaged

by the precentral gyrus on the left-hand side.

The other way you can say,

if if you pre-specified areas that you're interested in.

So let's say the putamen or the insula, saying how much of the insula is

engaged by the region of interest, so that's a little bit different.

So in the first instance where the ROI, the description I just discussed,

the denominator is total number of voxels in the ROI.

In the other instance, it's the total number of voxels in that area,

the region, the neuroanatomic region.

For example, the insula or the putamen, all right?

So this code, it's a little dense and I would step through it very slowly but

the idea is, we're doing the same operation.

The only difference is, we're counting the number of voxels in each of the labels.

And then using that as a denominator to get this table, so

the interpretation of this table is a little bit different.

Saying that 46% of the superior

longitudinal fasciculus on the left hand side is engaged by the brain tumor.

Now, one of the things you should note is that areas or

regions that have smaller volumes.

Have a higher likelihood that you're going to get a large area of overlap.

But to clinicians and to some researchers, this is a more important measure.

And so for example 11.1% of the left side putamen is engaged by the ROI,

so this is just two ways to present your data.

So that it actually has some sort real life or

real neuro anatomic interpretation versus just getting the output muscular.

So that's kind of one step in the direction and

now you can do it on a population level, so on and so forth.

But this one, I think important thing that we want to do

when we have regions of interest on brains.

[NOISE]