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
gr...@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

_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer


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.

Reply via email to