parameters: (outfile, subject, surf='wm', mp=True)
return_statement: return vox.T
docstring: Voxelize the whitematter surface to generate the white matter mask
docstring_summary: Voxelize the whitematter surface to generate the white matter mask
docstring_tokens: Voxelize the whitematter surface to generate the white matter mask
function: def voxelize(outfile, subject, surf='wm', mp=True):
      '''Voxelize the whitematter surface to generate the white matter mask'''
      import nibabel
      from . import polyutils
      nib = db.get_anat(subject, "raw")
      shape = nib.get_shape()
      vox = np.zeros(shape, dtype=bool)
      for pts, polys in db.get_surf(subject, surf, nudge=False):
          xfm = Transform(np.linalg.inv(nib.get_affine()), nib)
          vox += polyutils.voxelize(xfm(pts), polys, shape=shape, center=(0,0,0), mp=mp).astype('bool')
          
      nib = nibabel.Nifti1Image(vox, nib.get_affine(), header=nib.get_header())
      nib.to_filename(outfile)
  
      return vox.T
function_tokens: def voxelize ( outfile , subject , surf = 'wm' , mp = True ) : import nibabel from . import polyutils nib = db . get_anat ( subject , "raw" ) shape = nib . get_shape ( ) vox = np . zeros ( shape , dtype = bool ) for pts , polys in db . get_surf ( subject , surf , nudge = False ) : xfm = Transform ( np . linalg . inv ( nib . get_affine ( ) ) , nib ) vox += polyutils . voxelize ( xfm ( pts ) , polys , shape = shape , center = ( 0 , 0 , 0 ) , mp = mp ) . astype ( 'bool' ) nib = nibabel . Nifti1Image ( vox , nib . get_affine ( ) , header = nib . get_header ( ) ) nib . to_filename ( outfile ) return vox . T