parameters: (self, sameGaussianParameters, mesh)
return_statement: return (meanHyper, nHyper)
docstring: Return a tuple of (meanHyps, nHyps) for Gaussian parameter estimation.
docstring_summary: Return a tuple of (meanHyps, nHyps) for Gaussian parameter estimation.
docstring_tokens: Return a tuple of ( meanHyps nHyps ) for Gaussian parameter estimation .
function: def get_gaussian_hyps(self, sameGaussianParameters, mesh):
          """
          Return a tuple of (meanHyps, nHyps) for Gaussian parameter estimation.
          """
          nHyper = np.zeros(len(sameGaussianParameters))
          meanHyper = np.zeros(len(sameGaussianParameters))
  
          # TODO this needs to be adapted for multi-image cases (with masking)
          DATA = self.inputImages[0]
  
          for g in range(len(sameGaussianParameters)):
              
              labels = np.array(sameGaussianParameters[g])
  
              if any(labels > 8225):  # thalamus
                  listMask = [10, 49]
              elif any(labels == 28): # VDE
                  listMask = [28, 60]
              elif any(labels == 0):  # background
                  listMask = [1]
              else:
                  listMask = labels
              
              if len(listMask) > 0:
                  MASK = np.zeros(DATA.data.shape, dtype='bool')
                  for l in range(len(listMask)):
                      # Ensure that this uses a modified segmentation
                      MASK = MASK | (self.inputSeg.data == listMask[l])
                  radius = np.round(1 / np.mean(DATA.voxsize))
                  MASK = scipy.ndimage.morphology.binary_erosion(MASK, utils.spherical_strel(radius), border_value=1)
                  total_mask = MASK & (DATA.data > 0)
                  data = DATA.data[total_mask]
                  meanHyper[g] = np.median(data)
                  if any(labels == 28):
                      # Special case: VDE is kind of bimodal in FreeSurfer
                      nHyper[g] = 10
                  else:
                      nHyper[g] = 10 + len(data) * np.prod(DATA.voxsize) / (self.resolution ** 3)
  
          # If any NaN, replace by background
          # ATH: I don't there would ever be NaNs here?
          nans = np.isnan(meanHyper)
          meanHyper[nans] = 55
          nHyper[nans] = 10
  
          return (meanHyper, nHyper)
function_tokens: def get_gaussian_hyps ( self , sameGaussianParameters , mesh ) : nHyper = np . zeros ( len ( sameGaussianParameters ) ) meanHyper = np . zeros ( len ( sameGaussianParameters ) ) # TODO this needs to be adapted for multi-image cases (with masking) DATA = self . inputImages [ 0 ] for g in range ( len ( sameGaussianParameters ) ) : labels = np . array ( sameGaussianParameters [ g ] ) if any ( labels > 8225 ) : # thalamus listMask = [ 10 , 49 ] elif any ( labels == 28 ) : # VDE listMask = [ 28 , 60 ] elif any ( labels == 0 ) : # background listMask = [ 1 ] else : listMask = labels if len ( listMask ) > 0 : MASK = np . zeros ( DATA . data . shape , dtype = 'bool' ) for l in range ( len ( listMask ) ) : # Ensure that this uses a modified segmentation MASK = MASK | ( self . inputSeg . data == listMask [ l ] ) radius = np . round ( 1 / np . mean ( DATA . voxsize ) ) MASK = scipy . ndimage . morphology . binary_erosion ( MASK , utils . spherical_strel ( radius ) , border_value = 1 ) total_mask = MASK & ( DATA . data > 0 ) data = DATA . data [ total_mask ] meanHyper [ g ] = np . median ( data ) if any ( labels == 28 ) : # Special case: VDE is kind of bimodal in FreeSurfer nHyper [ g ] = 10 else : nHyper [ g ] = 10 + len ( data ) * np . prod ( DATA . voxsize ) / ( self . resolution ** 3 ) # If any NaN, replace by background # ATH: I don't there would ever be NaNs here? nans = np . isnan ( meanHyper ) meanHyper [ nans ] = 55 nHyper [ nans ] = 10 return ( meanHyper , nHyper )