revanalyzer.metrics.pnm.EulerDensityII

class revanalyzer.metrics.pnm.EulerDensityII(n_threads=1, resolution=1.0, show_time=False)

Bases: BasicPNMMetric

Class describing Euler density II metric.

Input:

n_threads (int): number of threads used for data generation, default: 1;

resolution (float): resolution of studied sample, default: 1;

show_time (bool): Added to monitor time cost for large images, default: False.

Methods

generate

Generates Euler density for a specific subsample.

read

Read the metric data generated for a specific subsample.

show

Vizualize the vector metric for a specific subsample.

vectorize

Vectorize the vector metric values for a given pair of subsample.

generate(cut, cut_name, outputdir, gendatadir)

Generates Euler density for a specific subsample.

Input:

cut (numpy.ndarray): 3D array representing a subsample;

cut_name (str): name of subsample;

outputdir (str): output folder;

gendatadir (str): folder with generated PNM data.

read(inputdir, step, cut_id)

Read the metric data generated for a specific subsample.

Input:

inputdir (str): path to the folder containing image;

step (int): subsamples selection step;

cut_id (int: 0,..8): cut index.

Output:

metric value (float or np.array(dtype=’float’)).

show(inputdir, step, cut_id, nbins, metric_name)

Vizualize the vector metric for a specific subsample.

Input:

inputdir (str): path to the folder containing generated metric data for subcubes;

step (int): subsamples selection step;

cut_id (int: 0,..8): cut index;

nbins (int): number of bins in histogram;

metric_name(str): name of metric.

vectorize(v1, v2)

Vectorize the vector metric values for a given pair of subsample. Makes normalization to voxels and calls the vectorizer function.

Input:

v1 (list(dtype = float)): data for the first subsample;

v2 (list(dtype = float)): data for the second subsample.

Output:

(list(dtype = float), list(dtype = float), float) - a tuple, in which the first two elements are vectorized metric values for a given pair of subsamples, and the last one is the normalized distance between these vectors.