"Prettier" Utilities - leahghartman/GaussBean GitHub Wiki

This section covers all functions in the "prettier" utilities module (so, all of the code contained in pre_utils.py).

Note: I wouldn't necessarily copy and paste any of the code here, this is simply for explanation purposes. If you want examples of code that will actually run, look in the examples folder under the "Code" tab above.

Contents:


thru_median

thru_median(mediansize, repeatamount=0, imgpath='', imgar=[])

The function "thru_median" returns an image in the form of an array that has been run through a median filter a specified number of times.

Parameters:

  • mediansize : integer : The size of the median filter in pixels (generally want this to be small; from 2-10 pixels).
  • repeatamount (OPTIONAL) : integer : The number of times the user wants to run the image through the median filter.
  • imgpath (OPTIONAL) : string : Path to a given image/dataset/location
  • imgar (OPTIONAL) : array : Rather than a path, the user can also use an array as an argument to the function

thru_lowpass

thru_lowpass(radius, imgpath='', imgar=[])

The function "thru_lowpass" returns an image in the form of an array that has been run through a low-pass filter one time.

Parameters:

  • radius : integer : The radius of the mask used for the low-pass filter in pixels.
  • imgpath (OPTIONAL) : string : Path to a given image/dataset/location
  • imgar (OPTIONAL) : array : Rather than a path, the user can also use an array as an argument to the function

back_subtract

back_subtract(origpath='', backpath='', origimgar=[], backimgar=[])

The function "back_subtract" returns an image in the form of an array after the background image provided is subtracted from the original image.

Parameters:

  • origpath (OPTIONAL) : string : The path of the original image to be used (the image before background subtraction).
  • backpath (OPTIONAL) : string : The path of the background image to be subtracted from the original image (this should be a blank image).
  • origimgar (OPTIONAL) : array : Rather than an image path, one can opt to use an array instead. This is the array of the original image to be used (before background subtraction).
  • backimgar (OPTIONAL) : array : Rather than an image path, one can opt to use an array instead. This is the array of the background image to be used (a blank image).

crop_image

crop_image(xpoint, ypoint, xmargins, ymargins, imgpath='', imgar=[])

The function "crop_image" returns an image in the form of an array after being cropped the amount specified around the point specified.

Parameters:

  • xpoint : integer : x-coordinate of the point at which the crop will be occurring.
  • ypoint : integer : y-coordinate of the point at which the crop will be occurring.
  • xmargins : integer : A number (in pixels) of how far in the x-direction, on either side of the cropping point, the user wants the image to be cropped.
  • ymargins : integer : A number (in pixels) of how far in the y-direction, on either side of the cropping point, the user wants the image to be cropped.
  • imgpath (OPTIONAL) : string : Path to a given image/dataset/location
  • imgar (OPTIONAL) : array : Rather than a path, the user can also use an array as an argument to the function

⚠️ **GitHub.com Fallback** ⚠️