module documentation

Implements Otsu's method for thresholding images

Function calc Calculates the inter-class-variance for a histogram with counts at all bin_edges
Function exact Returns a threshold that should be used as <= threshold
Function frac_per_fpix_threshold Calculates the fraction of pixels included in n_max otsu thresholds
Function masks_from_thresholds Undocumented
Function max_frac_diff_threshold Returns the otsu threshold (of n_max thresholds) that selects a group of similarly valued pixels
Function max_frac_per_fpix_threshold Calculates the "most selective" otsu threshold out of n_max thresholds
Function n_exact n is the number of thresholds we want to get out, to get n+1 thresholds, we must first get n thresholds, then find thresholds for each n+1 classes
Function n_thresholds Calculates n otsu-thresholds for data. Automatically calculates the bin edges depending on the sqrt of the number of datapoints
Function plot_repeats Undocumented
Function polynomial Undocumented
Function threshold Given the bin_edges of a histogram and the inter-class-variance at those edges, returns the edge with the maximum inter-class-variance
Variable _lgr Undocumented
def calc(counts, bin_edges):

Calculates the inter-class-variance for a histogram with counts at all bin_edges

def exact(data, max_elements=None) -> float:

Returns a threshold that should be used as <= threshold

def frac_per_fpix_threshold(data, frac_per_fpix=15, n_max=10, on_fail='return_last'):

Calculates the fraction of pixels included in n_max otsu thresholds

def masks_from_thresholds(data, thresholds):

Undocumented

def max_frac_diff_threshold(data, n_max=10):

Returns the otsu threshold (of n_max thresholds) that selects a group of similarly valued pixels

def max_frac_per_fpix_threshold(data, n_max=10):

Calculates the "most selective" otsu threshold out of n_max thresholds

def n_exact(data, n=1, max_elements=None):

n is the number of thresholds we want to get out, to get n+1 thresholds, we must first get n thresholds, then find thresholds for each n+1 classes

def n_thresholds(data, n):

Calculates n otsu-thresholds for data. Automatically calculates the bin edges depending on the sqrt of the number of datapoints

def plot_repeats(data, n=4):

Undocumented

def polynomial(coef, x):

Undocumented

def threshold(bin_edges, icv):

Given the bin_edges of a histogram and the inter-class-variance at those edges, returns the edge with the maximum inter-class-variance

_lgr =

Undocumented