parameters: (in_img_data)
return_statement: return out_img_data
docstring: Function to scale image intensities by setting wm peak to 200
docstring_summary: Function to scale image intensities by setting wm peak to 200
docstring_tokens: Function to scale image intensities by setting wm peak to 200
function: def wm_peak_normalize(in_img_data):
      """Function to scale image intensities by setting wm peak to 200"""
  
  
      in_img_flat = np.ravel(in_img_data, 'C')
  
      in_img_fg = in_img_flat[in_img_flat > 0].reshape(-1, 1)
      p95 = np.percentile(in_img_fg, q=95)
      in_img_fg = in_img_fg[in_img_fg < p95]
      in_img_fg = in_img_fg.reshape(-1,1)
  
      # clf = mixture.GMM(n_components=3, covariance_type='full')
      #
      clf = mixture.GaussianMixture(n_components=3, covariance_type='full')
      clf.fit(in_img_fg)
      # max of means is the wm centroid for t1w images
      wm_peak_intensity  = clf.means_.max()
      wm_scaling = 200.0 / wm_peak_intensity
  
      out_img_data = in_img_data * wm_scaling
      return out_img_data
function_tokens: def wm_peak_normalize ( in_img_data ) : in_img_flat = np . ravel ( in_img_data , 'C' ) in_img_fg = in_img_flat [ in_img_flat > 0 ] . reshape ( - 1 , 1 ) p95 = np . percentile ( in_img_fg , q = 95 ) in_img_fg = in_img_fg [ in_img_fg < p95 ] in_img_fg = in_img_fg . reshape ( - 1 , 1 ) # clf = mixture.GMM(n_components=3, covariance_type='full') # clf = mixture . GaussianMixture ( n_components = 3 , covariance_type = 'full' ) clf . fit ( in_img_fg ) # max of means is the wm centroid for t1w images wm_peak_intensity = clf . means_ . max ( ) wm_scaling = 200.0 / wm_peak_intensity out_img_data = in_img_data * wm_scaling return out_img_data