help > RE: VOI in mm cube?
May 29, 2022  07:05 PM | tammartru
RE: VOI in mm cube?
Dear MriCron expert!
Flowing the suggested script for calculating images volume (https://github.com/rordenlab/spmScripts/...)
I am not sure it is the right script, because it seems to only calculate number of Nan voxels.
Could you please direct me to the script calculating ROIs volumes?

Thank you very much!
Tammar

Originally posted by Chris Rorden:
The distance between voxels centers in the row, column and slice directions is stored as pixdim[1], pixdim[2], pixdim[3] in the NIfTI header. Just make sure the image specifies NIFTI_UNITS_MM
  https://nifti.nimh.nih.gov/pub/dist/src/niftilib/nifti1.h
I am surprised that you list negative values, as usually these are absolute values. Not sure which tool described these. You can also determine the voxel size from the s-form or q-form, where negative values would create a negative determinant (e.g. an image that is mirrored with respect to canonical space).

Your formula looks fine, though I would use absolute values for volume. 

If you have a lot of images, you would be better off writing a Matlab or Python script. MRIcroGL can save images as either .nii, .nii.gz or .voi format - in reality the .voi format is just a .nii.gz (with the extension telling the software to treat it as a discrete rather than continuous image). A script like this one 
https://github.com/rordenlab/spmScripts/...
could easily be modified to report volumes for hundreds of images with whatever precision you prefer.

Threaded View

TitleAuthorDate
alexpcg10 Apr 8, 2021
alexpcg10 Apr 11, 2021
Chris Rorden Apr 11, 2021
Chris Rorden Apr 8, 2021
alexpcg10 Apr 9, 2021
Chris Rorden Apr 9, 2021
RE: VOI in mm cube?
tammartru May 29, 2022
Chris Rorden May 30, 2022
tammartru May 31, 2022