Hi Doug or Nick, I was wondering if you could clarify once exactly how the SupraTentorial volume in the aseg.stats is calculated from an algorithmic perspective. In particular, it isn't simply the sum of CortexVol + CorticalWhiteMatterVol + SubCortGrayVol, as implied by the Wiki.
thanks! -MH
Hi Mike, below is the code that we use. Let me know if it is not clear. doug
SupraTentVolCor = SupraTentorialVolCorrection(mri_aseg, mri_ribbon); SupraTentVol = SupraTentVolCor + lhpialvolTot + rhpialvolTot;
/*! \fn double SupraTentorialVolCorrection(MRI *aseg, MRI *ribbon) \brief Returns the volume of supratentorial structures that do not fall inside the pial surface or are cut by the pial surface. The idea is that the volume of everything in the pial surface can be computed using the surface and that this function can be used to compute everything else. Note that there is no partial volume correction. \param aseg - aseg.mgz or aparc+aseg.mgz \param ribbon is the ribbon.mgz, which has non-zero values for everything inside the pial surf. */ double SupraTentorialVolCorrection(MRI *aseg, MRI *ribbon) { int c,r,s,SegId; double vol = 0; int RibbonVal, VoxSize;
VoxSize = aseg->xsize * aseg->ysize * aseg->zsize; for(c=0; c < aseg->width; c++){ for(r=0; r < aseg->height; r++){ for(s=0; s < aseg->depth; s++){
// If this voxel is inside the pial, then skip it because it // will be part of the surface-based volume measure RibbonVal = MRIgetVoxVal(ribbon,c,r,s,0); if(RibbonVal == 0) continue;
// If it gets here, it means that the voxel was not within // the pial surface. It could be in a structure that should // be part of the supratentorium.
// These are midline, medial wall, or unknown structures // that the pial could cut through. SegId = MRIgetVoxVal(aseg,c,r,s,0); if(SegId == Left_Lateral_Ventricles) vol += VoxSize; if(SegId == Right_Lateral_Ventricles) vol += VoxSize; if(SegId == Left_choroid_plexus) vol += VoxSize; if(SegId == Right_choroid_plexus) vol += VoxSize; if(SegId == Left_Inf_Lat_Vent) vol += VoxSize; if(SegId == Right_Inf_Lat_Vent) vol += VoxSize; if(SegId == WM_hypointensities) vol += VoxSize; if(SegId == Left_WM_hypointensities) vol += VoxSize; if(SegId == Right_WM_hypointensities) vol += VoxSize; if(SegId == Left_Thalamus_Proper) vol += VoxSize; if(SegId == Right_Thalamus_Proper) vol += VoxSize; if(SegId == Left_Thalamus) vol += VoxSize; if(SegId == Right_Thalamus) vol += VoxSize; if(SegId == CC_Posterior) vol += VoxSize; if(SegId == CC_Mid_Posterior) vol += VoxSize; if(SegId == CC_Central) vol += VoxSize; if(SegId == CC_Mid_Anterior) vol += VoxSize; if(SegId == CC_Anterior) vol += VoxSize; if(SegId == Left_VentralDC) vol += VoxSize; if(SegId == Right_VentralDC) vol += VoxSize;
// These are unlikely to have the pial surface cut through // them, but no harm to include them if(SegId == Left_Caudate) vol += VoxSize; if(SegId == Right_Caudate) vol += VoxSize; if(SegId == Left_Putamen ) vol += VoxSize; if(SegId == Right_Putamen ) vol += VoxSize; if(SegId == Left_Pallidum) vol += VoxSize; if(SegId == Right_Pallidum) vol += VoxSize; if(SegId == Left_Hippocampus) vol += VoxSize; if(SegId == Right_Hippocampus) vol += VoxSize; if(SegId == Left_Amygdala) vol += VoxSize; if(SegId == Right_Amygdala) vol += VoxSize; if(SegId == Left_Accumbens_area) vol += VoxSize; if(SegId == Right_Accumbens_area) vol += VoxSize; } } } return(vol); }
Michael Harms wrote:
Hi Doug or Nick, I was wondering if you could clarify once exactly how the SupraTentorial volume in the aseg.stats is calculated from an algorithmic perspective. In particular, it isn't simply the sum of CortexVol + CorticalWhiteMatterVol + SubCortGrayVol, as implied by the Wiki.
thanks! -MH
Hi Doug, Ok, you're going to make me work for it! :)
I'm guessing that XhpialvolTot in that formula is simply the output of `mris_volume Xh.pial` ?
What I'm confused about is why the sum of TotalGrayVol + CorticalWhiteMatterVol seems to be about 8-10% larger than SupraTentorialVol. (And that's even after including ventricles into the SupraTentorialVol calculation...)
thanks, -MH
On Tue, 2012-02-21 at 13:56 -0500, Douglas N Greve wrote:
Hi Mike, below is the code that we use. Let me know if it is not clear. doug
SupraTentVolCor = SupraTentorialVolCorrection(mri_aseg, mri_ribbon); SupraTentVol = SupraTentVolCor + lhpialvolTot + rhpialvolTot;/*! \fn double SupraTentorialVolCorrection(MRI *aseg, MRI *ribbon) \brief Returns the volume of supratentorial structures that do not fall inside the pial surface or are cut by the pial surface. The idea is that the volume of everything in the pial surface can be computed using the surface and that this function can be used to compute everything else. Note that there is no partial volume correction. \param aseg - aseg.mgz or aparc+aseg.mgz \param ribbon is the ribbon.mgz, which has non-zero values for everything inside the pial surf. */ double SupraTentorialVolCorrection(MRI *aseg, MRI *ribbon) { int c,r,s,SegId; double vol = 0; int RibbonVal, VoxSize;
VoxSize = aseg->xsize * aseg->ysize * aseg->zsize; for(c=0; c < aseg->width; c++){ for(r=0; r < aseg->height; r++){ for(s=0; s < aseg->depth; s++){
// If this voxel is inside the pial, then skip it because it // will be part of the surface-based volume measure RibbonVal = MRIgetVoxVal(ribbon,c,r,s,0); if(RibbonVal == 0) continue; // If it gets here, it means that the voxel was not within // the pial surface. It could be in a structure that should // be part of the supratentorium. // These are midline, medial wall, or unknown structures // that the pial could cut through. SegId = MRIgetVoxVal(aseg,c,r,s,0); if(SegId == Left_Lateral_Ventricles) vol += VoxSize; if(SegId == Right_Lateral_Ventricles) vol += VoxSize; if(SegId == Left_choroid_plexus) vol += VoxSize; if(SegId == Right_choroid_plexus) vol += VoxSize; if(SegId == Left_Inf_Lat_Vent) vol += VoxSize; if(SegId == Right_Inf_Lat_Vent) vol += VoxSize; if(SegId == WM_hypointensities) vol += VoxSize; if(SegId == Left_WM_hypointensities) vol += VoxSize; if(SegId == Right_WM_hypointensities) vol += VoxSize; if(SegId == Left_Thalamus_Proper) vol += VoxSize; if(SegId == Right_Thalamus_Proper) vol += VoxSize; if(SegId == Left_Thalamus) vol += VoxSize; if(SegId == Right_Thalamus) vol += VoxSize; if(SegId == CC_Posterior) vol += VoxSize; if(SegId == CC_Mid_Posterior) vol += VoxSize; if(SegId == CC_Central) vol += VoxSize; if(SegId == CC_Mid_Anterior) vol += VoxSize; if(SegId == CC_Anterior) vol += VoxSize; if(SegId == Left_VentralDC) vol += VoxSize; if(SegId == Right_VentralDC) vol += VoxSize; // These are unlikely to have the pial surface cut through // them, but no harm to include them if(SegId == Left_Caudate) vol += VoxSize; if(SegId == Right_Caudate) vol += VoxSize; if(SegId == Left_Putamen ) vol += VoxSize; if(SegId == Right_Putamen ) vol += VoxSize; if(SegId == Left_Pallidum) vol += VoxSize; if(SegId == Right_Pallidum) vol += VoxSize; if(SegId == Left_Hippocampus) vol += VoxSize; if(SegId == Right_Hippocampus) vol += VoxSize; if(SegId == Left_Amygdala) vol += VoxSize; if(SegId == Right_Amygdala) vol += VoxSize; if(SegId == Left_Accumbens_area) vol += VoxSize; if(SegId == Right_Accumbens_area) vol += VoxSize; } }} return(vol); }
Michael Harms wrote:
Hi Doug or Nick, I was wondering if you could clarify once exactly how the SupraTentorial volume in the aseg.stats is calculated from an algorithmic perspective. In particular, it isn't simply the sum of CortexVol + CorticalWhiteMatterVol + SubCortGrayVol, as implied by the Wiki.
thanks! -MH
-- Douglas N. Greve, Ph.D. MGH-NMR Center greve@nmr.mgh.harvard.edu Phone Number: 617-724-2358 Fax: 617-726-7422
Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting FileDrop: www.nmr.mgh.harvard.edu/facility/filedrop/index.html
The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
Thanks to Mike's determination, I have found a bug in the way that the Supratentoral volume in aseg.stats is computed.
A fixed linux version can be obtained from ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/mri_segstats.linux . Copy this into $FREESURFER_HOME/bin/mri_segstats, then run recon-all -s subject -segstats
to generate a new aseg.stats file. This should only take a few minutes. I'll post mac versions when I have them (but prod me if you don't see them soon and you need them).
I apologize for the inconveniences cause by this bug.
doug
Michael Harms wrote:
Hi Doug, Ok, you're going to make me work for it! :)
I'm guessing that XhpialvolTot in that formula is simply the output of `mris_volume Xh.pial` ?
What I'm confused about is why the sum of TotalGrayVol + CorticalWhiteMatterVol seems to be about 8-10% larger than SupraTentorialVol. (And that's even after including ventricles into the SupraTentorialVol calculation...)
thanks, -MH
On Tue, 2012-02-21 at 13:56 -0500, Douglas N Greve wrote:
Hi Mike, below is the code that we use. Let me know if it is not clear. doug
SupraTentVolCor = SupraTentorialVolCorrection(mri_aseg, mri_ribbon); SupraTentVol = SupraTentVolCor + lhpialvolTot + rhpialvolTot;/*! \fn double SupraTentorialVolCorrection(MRI *aseg, MRI *ribbon) \brief Returns the volume of supratentorial structures that do not fall inside the pial surface or are cut by the pial surface. The idea is that the volume of everything in the pial surface can be computed using the surface and that this function can be used to compute everything else. Note that there is no partial volume correction. \param aseg - aseg.mgz or aparc+aseg.mgz \param ribbon is the ribbon.mgz, which has non-zero values for everything inside the pial surf. */ double SupraTentorialVolCorrection(MRI *aseg, MRI *ribbon) { int c,r,s,SegId; double vol = 0; int RibbonVal, VoxSize;
VoxSize = aseg->xsize * aseg->ysize * aseg->zsize; for(c=0; c < aseg->width; c++){ for(r=0; r < aseg->height; r++){ for(s=0; s < aseg->depth; s++){
// If this voxel is inside the pial, then skip it because it // will be part of the surface-based volume measure RibbonVal = MRIgetVoxVal(ribbon,c,r,s,0); if(RibbonVal == 0) continue; // If it gets here, it means that the voxel was not within // the pial surface. It could be in a structure that should // be part of the supratentorium. // These are midline, medial wall, or unknown structures // that the pial could cut through. SegId = MRIgetVoxVal(aseg,c,r,s,0); if(SegId == Left_Lateral_Ventricles) vol += VoxSize; if(SegId == Right_Lateral_Ventricles) vol += VoxSize; if(SegId == Left_choroid_plexus) vol += VoxSize; if(SegId == Right_choroid_plexus) vol += VoxSize; if(SegId == Left_Inf_Lat_Vent) vol += VoxSize; if(SegId == Right_Inf_Lat_Vent) vol += VoxSize; if(SegId == WM_hypointensities) vol += VoxSize; if(SegId == Left_WM_hypointensities) vol += VoxSize; if(SegId == Right_WM_hypointensities) vol += VoxSize; if(SegId == Left_Thalamus_Proper) vol += VoxSize; if(SegId == Right_Thalamus_Proper) vol += VoxSize; if(SegId == Left_Thalamus) vol += VoxSize; if(SegId == Right_Thalamus) vol += VoxSize; if(SegId == CC_Posterior) vol += VoxSize; if(SegId == CC_Mid_Posterior) vol += VoxSize; if(SegId == CC_Central) vol += VoxSize; if(SegId == CC_Mid_Anterior) vol += VoxSize; if(SegId == CC_Anterior) vol += VoxSize; if(SegId == Left_VentralDC) vol += VoxSize; if(SegId == Right_VentralDC) vol += VoxSize; // These are unlikely to have the pial surface cut through // them, but no harm to include them if(SegId == Left_Caudate) vol += VoxSize; if(SegId == Right_Caudate) vol += VoxSize; if(SegId == Left_Putamen ) vol += VoxSize; if(SegId == Right_Putamen ) vol += VoxSize; if(SegId == Left_Pallidum) vol += VoxSize; if(SegId == Right_Pallidum) vol += VoxSize; if(SegId == Left_Hippocampus) vol += VoxSize; if(SegId == Right_Hippocampus) vol += VoxSize; if(SegId == Left_Amygdala) vol += VoxSize; if(SegId == Right_Amygdala) vol += VoxSize; if(SegId == Left_Accumbens_area) vol += VoxSize; if(SegId == Right_Accumbens_area) vol += VoxSize; } }} return(vol); }
Michael Harms wrote:
Hi Doug or Nick, I was wondering if you could clarify once exactly how the SupraTentorial volume in the aseg.stats is calculated from an algorithmic perspective. In particular, it isn't simply the sum of CortexVol + CorticalWhiteMatterVol + SubCortGrayVol, as implied by the Wiki.
thanks! -MH
-- Douglas N. Greve, Ph.D. MGH-NMR Center greve@nmr.mgh.harvard.edu Phone Number: 617-724-2358 Fax: 617-726-7422
Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting FileDrop: www.nmr.mgh.harvard.edu/facility/filedrop/index.html
The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
freesurfer@nmr.mgh.harvard.edu