Xmipp  v3.23.11-Nereus
Macros | Functions
histogram.cpp File Reference
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include "histogram.h"
#include "metadata_vec.h"
#include "metadata_row_vec.h"
Include dependency graph for histogram.cpp:

Go to the source code of this file.

Macros

#define INTERP(x, x0, y0, xF, yF)   (y0+(x-x0)*(yF-y0)/(xF-x0))
 
#define COMPUTEHIST(type)   compute_hist(MULTIDIM_ARRAY_TYPE(v,type),hist,min,max,no_steps);
 

Functions

std::ostream & operator<< (std::ostream &o, const Histogram1D &hist)
 
double detectability_error (const Histogram1D &h1, const Histogram1D &h2)
 
double KLDistance (const Histogram1D &h1, const Histogram1D &h2)
 
std::ostream & operator<< (std::ostream &_out, const IrregularHistogram1D &_hist)
 
std::ostream & operator<< (std::ostream &o, const Histogram2D &hist)
 
void compute_hist (const MultidimArrayGeneric &array, Histogram1D &hist, int no_steps)
 
void compute_hist (const MultidimArrayGeneric &v, Histogram1D &hist, double min, double max, int no_steps)
 

Macro Definition Documentation

◆ COMPUTEHIST

#define COMPUTEHIST (   type)    compute_hist(MULTIDIM_ARRAY_TYPE(v,type),hist,min,max,no_steps);

◆ INTERP

#define INTERP (   x,
  x0,
  y0,
  xF,
  yF 
)    (y0+(x-x0)*(yF-y0)/(xF-x0))

Definition at line 278 of file histogram.cpp.

Function Documentation

◆ operator<<() [1/3]

std::ostream& operator<< ( std::ostream &  o,
const Histogram1D hist 
)

Show an histogram

The first column is the value associated to each histogram measure. The second one is the histogram measure.

Definition at line 115 of file histogram.cpp.

116 {
118  aux.resize(hist.stepNo(), 2);
120  {
121  hist.index2val(i, A2D_ELEM(aux, i, 0));
122  A2D_ELEM(aux, i, 1) = A1D_ELEM(hist, i);
123  }
124  o << aux;
125  return o;
126 }
#define A2D_ELEM(v, i, j)
void resize(size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true)
#define A1D_ELEM(v, i)
#define i
int stepNo() const
Definition: histogram.h:339
void index2val(double i, double &v) const
Definition: histogram.h:295
#define FOR_ALL_ELEMENTS_IN_ARRAY1D(v)

◆ operator<<() [2/3]

std::ostream& operator<< ( std::ostream &  _out,
const IrregularHistogram1D _hist 
)

Definition at line 457 of file histogram.cpp.

459 {
460  for (size_t i = 0; i < XSIZE(_hist.__binsRightLimits); i++)
461  _out << "\t" << _hist.__binsRightLimits(i) << "\t\t" << _hist.__hist(i)
462  << std::endl;
463  return _out;
464 }
#define i
#define XSIZE(v)
MultidimArray< double > __binsRightLimits
Definition: histogram.h:390
Histogram1D __hist
Definition: histogram.h:389

◆ operator<<() [3/3]

std::ostream& operator<< ( std::ostream &  o,
const Histogram2D hist 
)

Show an histogram

The first column and second column are the (X,Y) coordinates of each histogram measure. The third one is the histogram measure.

Definition at line 545 of file histogram.cpp.

546 {
548  aux.resize(hist.IstepNo() * hist.JstepNo(), 3);
549  int n = 0;
551  {
552  hist.index2val(i, j, A2D_ELEM(aux, n, 0), A2D_ELEM(aux, n, 1));
553  A2D_ELEM(aux, n, 2) = A2D_ELEM(hist, i, j);
554  n++;
555  }
556  o << aux;
557  return o;
558 }
#define A2D_ELEM(v, i, j)
void resize(size_t Ndim, size_t Zdim, size_t Ydim, size_t Xdim, bool copy=true)
int IstepNo() const
Definition: histogram.h:888
int JstepNo() const
Definition: histogram.h:932
void index2val(double i, double j, double &v, double &u) const
Definition: histogram.h:843
#define i
#define FOR_ALL_ELEMENTS_IN_ARRAY2D(m)
#define j
int * n