revanalyzer.metrics.pnm.BasicPNMMetric
- class revanalyzer.metrics.pnm.BasicPNMMetric(vectorizer, n_threads, resolution, show_time)
Bases:
BasicMetric
Base class of PNM-based metrics. (Don’t use it directly but derive from it).
Input:
vectorizer (PNMVectorizer object): vectorizer to be used for a vector metric.
n_threads (int): number threads used for data generation;
resolution (float): resolution of studied sample;
show_time (bool): Added to monitor time cost for large images.
Methods
Generates PNM metric for a specific subsample.
Read the metric data generated for a specific subsample.
Vizualize the vector metric for a specific subsample.
Vectorize the vector metric values for a given pair of subsample.
- generate(cut_name, gendatadir)
Generates PNM metric for a specific subsample.
Input:
cut_name (str): name of subsample;
gendatadir (str): folder with generated PNM data.
Output:
df (pandas.DataFrame): data frame with pnm statistics.
- 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.