Xmipp
v3.23.11-Nereus
|
Functions | |
int | HistogramBuild (float *VolumeSource, long Nx, long Ny, long Nz, double Frequency[], float Value[], int *Status) |
int | HistogramEqualize (double Frequency[], float Value[], float EqualizedValue[], long HistogramLength, long *NumberOfClasses, double Tolerance) |
int | HistogramGetSize (float *VolumeSource, long Nx, long Ny, long Nz, long *HistogramLength, int *Status) |
int | HistogramKMeans (double Frequency[], float Value[], float QuantizedValue[], long HistogramLength, long *NumberOfClasses, double Tolerance, int *Status) |
int HistogramBuild | ( | float * | VolumeSource, |
long | Nx, | ||
long | Ny, | ||
long | Nz, | ||
double | Frequency[], | ||
float | Value[], | ||
int * | Status | ||
) |
Build histogram. Computation of the frequencies of occurrence of data values. VolumeSource is a (float)volume of size (Nx x Ny x Nz). Value[] is a (float)array of length previously determined by HistogramGetSize. The returned content of Value[] is sorted in strict ascending order. Frequency[] is a (double)array of length previously determined by HistogramGetSize.
success: return(!ERROR); failure: return(ERROR)
int HistogramEqualize | ( | double | Frequency[], |
float | Value[], | ||
float | EqualizedValue[], | ||
long | HistogramLength, | ||
long * | NumberOfClasses, | ||
double | Tolerance | ||
) |
Equalize histogram. Construction of the lookup table: Value[k] <-> EqualizedValue[k]. EqualizedValue[] satisfies:
where ~=~ means "is about equal to", and where K(n) is a domain such that
under the constraint
Frequency[] is a (double)array of length HistogramLength. The content of Frequency[] must be strictly positive. The content of Frequency[] must have unit sum. Value[] is a (float)array of length HistogramLength. The content of Value[] must be sorted in strictly ascending order. EqualizedValue[] is a returned (float)array of length HistogramLength.
On input, NumberOfClasses indicates the desired number of classes. On output, NumberOfClasses returns the effective number of classes. NumberOfClasses is no greater than (1.0 / max(Frequency[])), and never increases.
It may happen that the only solution that satisfies all constraints is undesirable e.g., Frequency[] = {0.9, 0.1}; Value[] = {10.0F, 90.0F}; NumberOfClasses = 2L; (desired) results in QuantizedValues[] = {18.0F, 18.0F}; NumberOfClasses = 1L; (actual)
success: return(!ERROR); failure: return(ERROR)
int HistogramGetSize | ( | float * | VolumeSource, |
long | Nx, | ||
long | Ny, | ||
long | Nz, | ||
long * | HistogramLength, | ||
int * | Status | ||
) |
Get size of histogram. Determination of the number of differing data values in a volume. VolumeSource is a (float)volume of size (Nx x Ny x Nz).
success: return(!ERROR); failure: return(ERROR)
int HistogramKMeans | ( | double | Frequency[], |
float | Value[], | ||
float | QuantizedValue[], | ||
long | HistogramLength, | ||
long * | NumberOfClasses, | ||
double | Tolerance, | ||
int * | Status | ||
) |
Histogram K means. Construction of the lookup table: Value[k] <-> QuantizedValue[k]. Minimization of sum(k) Frequency[k] * (Value[k] - QuantizedValue[k])^2. under the constraint DistinctElements(QuantizedValue[]) == NumberOfClasses.
Frequency[] is a (double)array of length HistogramLength. The content of Frequency[] must be strictly positive. The content of Frequency[] must have unit sum. Value[] is a (float)array of length HistogramLength. The content of Value[] must be sorted in strictly ascending order. QuantizedValue[] is a returned (float)array of length HistogramLength.
On input, NumberOfClasses indicates the desired number of classes. On output, NumberOfClasses returns the effective number of classes. NumberOfClasses never increases.
Important cases that go undetected (unfortunately):
success: return(!ERROR); failure: return(ERROR)