Mrcalc to threshold hippocampal diffusivity (based off of CSF-like percent)


I have calculated TC,TG, and TW per each voxel as discussed in this paper.

TC.nii.gz (Total CSF)
TG.nii.gz (Total GM)
TW.nii.gz (Total WM)

I also have bilateral hippocampal masks.

I would like to threshold each of my subject’s bilateral hippocampal ROI’s (bhipp2diff.nii.gz) from CSF-like contamination by removing voxels with TC.nii.gz values above .5 (50%) to make a new thresholded mask?

Any guidance?

Hi Daniel,

Just checking: are you wondering about a good threshold, or how to achieve this operation in practice? For the threshold: 50% is surely fine, anything beyond that is severely partial volumed with genuine CSF, I reckon. For completeness sake, note that the peer-reviewed (and revised) final paper of that pre-print is published over here. This is relevant for the complete data and results of the hippocampus.

To achieve this in practice, first make sure your hippocampal masks are correctly aligned to the subject (i.e. to the TW, TG and TC images). Then, also make sure these masks are regridded to those images, for convenience. In what follows, I’ll assume your bhipp2diff.nii.gz is indeed already accurately aligned and regridded to these images; this is crucial of course, as it’s a small and somewhat intricately shaped region.

Then, compute a mask, from TC, of the voxels to exclude wrt the 0.5 threshold (you could also go for the opposite mask, and modify the other steps down the track accordingly of course):

mrthreshold TC.nii.gz too_much_TC.mif -abs 0.5

Double-check that too_much_TC.mif looks like a mask of all voxels where you realistically expect TC > 0.5 (i.e. ventricles and such).

Then, use mrcalc to “remove” this mask from your bhipp2diff.nii.gz. There’s many different ways of doing this, and different logic works intuitively for some people (but not others). Here’s just one way that’ll work. The key here is: your current bhipp2diff.nii.gz generally has all voxels of interest, except for everything in too_much_TC.mif, which you want “gone” from bhipp2diff.nii.gz. So this one will do the trick:

mrcalc too_much_TC.mif 0 bhipp2diff.nii.gz -if cleaned_hipp_mask.mif

I’ve chosen to use the “if” operator in this example. So this command reads more or less like:

IF too_much_TC.mif, THEN set the voxel to 0, ELSE just use the existing value in bhipp2diff.nii.gz.

…and then the final thing is stored in cleaned_hipp_mask.mif in the end. You should finally double-check that that one still looks like the hippocampus mask, but with the too_much_TC.mif voxels removed (if any).


Thank you for the reply! I was indeed asking both about the validity of the threshold and the implementation techniques.

Sorry about not citing the peer reviewed work. I used that link from one of your previous responses to save time.

As always thank you for your in depth guidance!

Great, that should be all covered then. :slightly_smiling_face: :+1:

No worries at all; it’s mostly because it’s relevant specifically for the hippocampus parts. It’s good for others too, to have access to a peer reviewed work.

All good!