Halostack Helper module

Misc helper functions

halostack.helpers.get_filenames(fnames)

Get filenames to a list. Expand wildcards etc.

Parameters:fnames (list of strings) – list of filenames or wildcard strings
Return type:list of strings
halostack.helpers.get_image_coordinates(img_in, num)

Get num image coordinates from users’ clicks on the image.

Parameters:
  • img_in (Numpy array) – input image
  • num (int) – number of coordinates to collect
halostack.helpers.get_two_points(img_in)

Get two image pixel coordinates from users’ clicks on the image, and return them as 3-tuple: (mean(xs), mean(ys), max(abs_diff(xs), abs_diff(ys))/2.

Parameters:img_in (Numpy array) – input image
Return type:3-tuple
halostack.helpers.intermediate_fname(prefix, fname)

Form filename for the aligned image files.

Parameters:
  • prefix (str) – prefix to prepend to the basename of the file.
  • fname (str) – filename, with or without the path
Return type:

new filename as a string

halostack.helpers.parse_enhancements(params)

Parse image enhancements and their parameters, if any.

Parameters:params (list of strings) – list of enhancement names and parameters
Return type:ordered dictionary

example of params: [‘usm:20,8’, ‘br’]

halostack.helpers.read_config(args)

Read and parse configuration from a file given in args and update the argument dictionary.

Parameters:args (dictionary) – command-line arguments
Return type:dictionary with updated arguments