background_estimation

nighres.intensity.background_estimation(image, distribution='exponential', ratio=0.001, skip_zero=True, iterate=True, dilate=0, threshold=0.5, save_data=False, overwrite=False, output_dir=None, file_name=None)[source]

Background Estimation

Estimates image background by robustlyfitting various distribution models

Parameters:
  • image (niimg) – Input image
  • distribution ({'exponential','half-normal'}) – Distribution model to use for the background noise
  • ratio (float, optional) – Robustness ratio for estimating image intensities
  • skip_zero (bool, optional) – Whether to consider or skip zero values
  • iterate (bool, optional) – Whether to run an iterative estimation (preferred, but sometimes unstable)
  • dilate (int, optional) – Number of voxels to dilate or erode in the final mask
  • save_data (bool) – Save output data to file (default is False)
  • overwrite (bool) – Overwrite existing results (default is False)
  • output_dir (str, optional) – Path to desired output directory, will be created if it doesn’t exist
  • file_name (str, optional) – Desired base name for output files with file extension (suffixes will be added)
Returns:

Dictionary collecting outputs under the following keys (suffix of output files in brackets)

  • masked (niimg): The background-masked input image
  • proba (niimg): The probability map of the foreground
  • mask (niimg): The mask of the foreground

Return type:

dict

Notes

Original Java module by Pierre-Louis Bazin.