niftynet.utilities.util_common module¶
-
class
CacheFunctionOutput
(func)[source]¶ Bases:
object
this provides a decorator to cache function outputs to avoid repeating some heavy function computations
-
class
MorphologyOps
(binary_img, neigh)[source]¶ Bases:
object
Class that performs the morphological operations needed to get notably connected component. To be used in the evaluation
-
damerau_levenshtein_distance
(s1, s2)[source]¶ Calculates an edit distance, for typo detection. Code based on : https://en.wikipedia.org/wiki/Damerau–Levenshtein_distance
-
has_bad_inputs
(input_args)[source]¶ Check if all input params have been properly set in the configuration file. :param input_args: :return:
-
list_depth_count
(input_list)[source]¶ This function count the maximum depth of a nested list (recursively) This is used to check compatibility of users’ input and system API only to be used for list or tuple
-
otsu_threshold
(img, nbins=256)[source]¶ Implementation of otsu thresholding
Parameters: - img –
- nbins –
Returns:
-
print_progress_bar
(iteration, total, prefix='', suffix='', decimals=1, length=10, fill='=')[source]¶ Call in a loop to create terminal progress bar
Parameters: - iteration – current iteration (Int)
- total – total iterations (Int)
- prefix – prefix string (Str)
- suffix – suffix string (Str)
- decimals – number of decimals in percent complete (Int)
- length – character length of bar (Int)
- fill – bar fill character (Str)