psych-214-fall-2016 / project-red

Other
1 stars 7 forks source link

voxels outside the brain? #44

Closed zzbalews closed 7 years ago

zzbalews commented 7 years ago

Follow up to Matthew's comment about excluding voxels outside the brain for motion correction: (#20)

Should we be doing that for registration as well? I can see that it makes sense for motion correction because you're aligning volumes that are almost identical. Would it also work for MNI template/T1 registration? I think we rely on the outside shape of the brain to help us, but maybe that's not great and this would get a better alignment inside the brain.

And if yes, we only use voxels that are considered to be "brain" in both images, right?

matthew-brett commented 7 years ago

Just to clarify - I was only referring to the voxels with value exactly zero generated when you resample from outside the volume - I mean at coordinate positions outside the existing array coordinates, e.g. voxels with coordinates < 0. You could also try and exclude very low signal voxels, on the basis that they won't contribute much to the match, but don't remove the stuff at the edges of the brain because the low values there do have a meaning for the registration - that's an edge the registration should work on.

zzbalews commented 7 years ago

OK cool that makes sense. But even after resampling, I think there will still be some voxels that count as the brain in one image and not the other (like this cartoon example). Do we include just the darker overlap area in the cost function? example

Hopefully I'm not misunderstanding your initial point!

matthew-brett commented 7 years ago

Right - in the case where the zeros came from resampling outside the data, then you need to reject those voxels, in both images, because they are no longer comparable - they didn't come from the image. For near zeros, you've got a more complicated problem - which is the one your cartoon shows. So you'd have to be careful a) that you were already close, and b) that you've got a large enough ring around the brain that you would not be excluding brain or just outside by excluding the near-zeros.

zzbalews commented 7 years ago

Thanks for explaining! I think what we're doing now for anatomical registration is ok then. We're using skull-stripped images, so we get 0 if we resample outside the brain or outside the 3D data array. Including all of these 0s might mess with our absolute mutual information value (e.g. comparing MI(template, subj1) and MI(template, subj2) might not be sensible) but shouldn't matter for different transformations of the same subject image. (Unless the scaling is crazy or part of the brain is cut off, but that would cause problems for any strategy.) Does that sound right?

matthew-brett commented 7 years ago

Aha - yes - skull stripping. I forgot that will put exact zeros outside the brain. Your problem here is that you have two reasons for a zero - outside the brain, and outside the array. Usually with anatomical registration, getting zeros from sampling outside the array is less of a problem than with motion correction, because the anatomical image usually does not cut off the brain at the bottom, as the functional images do, so a few extra zeros at the bottom of the brain stem don't hurt you too much in the registration. If you wanted to deal with those extra zeros, you could try putting some tiny value in the masked voxels - like 10e-16 - to distinguish these voxels from the exact zero voxels from sampling outside the image. Or your could ask the resampling to give a different value when outside the array, such as NaN (not a number) and you could remove those values instead.