LCOV - code coverage report
Current view: top level - render - Histogram.h (source / functions) Hit Total Coverage
Test: Lexis Lines: 1 1 100.0 %
Date: 2017-10-26 03:19:55 Functions: 1 3 33.3 %

          Line data    Source code
       1             : /* Copyright (c) 2016-2017, Human Brain Project
       2             :  *                          Ahmet.Bilgili@epfl.ch
       3             :  */
       4             : 
       5             : #pragma once
       6             : 
       7             : #include <lexis/api.h>
       8             : #include <lexis/render/detail/histogram.h> // base class
       9             : #include <vmmlib/types.hpp>
      10             : 
      11             : namespace lexis
      12             : {
      13             : namespace render
      14             : {
      15             : 
      16           5 : class Histogram : public detail::Histogram
      17             : {
      18             : public:
      19             :     /** The minimum value is set to -inf and maximum value is set to -inf. */
      20             :     LEXIS_API Histogram();
      21             : 
      22             :     /**
      23             :      * Computes the addition of two histograms and modifies the object.
      24             :      *
      25             :      * If the histogram is empty this operator behaves the same as the
      26             :      * assignment operator.
      27             :      * @param histogram is the histogram to add
      28             :      * @return the modified histogram
      29             :      */
      30             :     LEXIS_API Histogram& operator+=( const Histogram& histogram );
      31             : 
      32             :     /** @return true if two histograms are identical. */
      33             :     LEXIS_API bool operator==( const Histogram& rhs ) const;
      34             : 
      35             :     /** @return true if two histograms are not identical. */
      36             :     LEXIS_API bool operator!=( const Histogram& rhs ) const;
      37             : 
      38             :     /**
      39             :      * @return the index with the minimum value (if there are multiple indices
      40             :      *         for min value, the smallest index is returned).
      41             :      */
      42             :     LEXIS_API size_t getMinIndex() const;
      43             : 
      44             :     /**
      45             :      * @return the index with the maximum value (if there are multiple indices
      46             :      *         for max value, the smallest index is returned).
      47             :      */
      48             :     LEXIS_API size_t getMaxIndex() const;
      49             : 
      50             :     /** @return true if histogram has no values. */
      51             :     LEXIS_API bool isEmpty() const;
      52             : 
      53             :     /** @return the sum of the histogram. */
      54             :     LEXIS_API uint64_t getSum() const;
      55             : 
      56             :     /** @return the data range of the histogram. */
      57             :     LEXIS_API vmml::Vector2f getRange() const;
      58             : 
      59             :     /**
      60             :      * Computes the ratio of the value at a given index.
      61             :      *
      62             :      * @param index the index of the histogram value
      63             :      * @return the ratio at given index. If histogram is empty or index exceeds
      64             :      *         the histogram bin count, returns 0.0.
      65             :      */
      66             :     LEXIS_API double getRatio( size_t index ) const;
      67             : 
      68             :     /** Sets the number of bins to newSize and clears the histogram. */
      69             :     LEXIS_API void resize( size_t newSize );
      70             : 
      71             :     /**
      72             :      * Linear sampling of the histogram.
      73             :      *
      74             :      * @param logScale use log for the y-values
      75             :      * @param range the range in [0..1] to use bins from
      76             :      * @return list of points from [0..1] in both axis.
      77             :      */
      78             :     LEXIS_API std::vector< vmml::Vector2f >
      79             :     sampleCurve( bool logScale, const vmml::Vector2f& range ) const;
      80             : };
      81             : 
      82             : }
      83             : }

Generated by: LCOV version 1.11