help > Get the volume size of template
Showing 1-2 of 2 posts
Display:
Results per page:
Jan 4, 2024  05:01 PM | Christian Schranz
Get the volume size of template

Hello,


I am trying to get the relative size of a brain lesion in a template.


For this I created lesion masks that are normalized to the MNI brain.


I then opened a template added my lesion mask as an overlay to get me the size of my lesion in cc using batch descriptive.


I was hoping to get the total brain volume again from batch descriptive of the template but the size I am getting for different template is in the 1600cc area or 1700cc are which seems higher than the average, which makes me concerned that I am getting the right numbers.


Can I get the volume of a template this way and if not how can I get either the volume of a template or the relative volume of a lesion mask in the template compared to the whole brain.


Thank you!


Christian Schranz

Jan 4, 2024  07:01 PM | Chris Rorden
RE: Get the volume size of template

You could use FSL:


fslstats input.nii.gz -V


I would derive these details using Python, which is very scriptable.  Note that you may want to consider partial volume effects when computing volumes for non-binary images, e.g. if you have a gray matter probability mask, you may only want to consider voxels that are over 50% GM. To be even more accurate, you could modulate volume by the probability, such that a voxel which is 50% GM only contributes half a voxels volume to the sum.


 


import nibabel as nb
import numpy as np
from nibabel.imagestats import mask_volume
fnm = 'input.nii.gz'
img = nb.load(fnm)
computed_volume = mask_volume(img)
print(f"{computed_volume}mm3")


 


Do remember that the MNI template is larger than the average brain, explaining the difference between SPM and MNI templates when normalizing data, e.g. Figure 1 here:


  https://www.ncbi.nlm.nih.gov/pmc/article...