26#include "../io/file.hpp"
27#include "../utils/tools.hpp"
28#include "../ParserLib/muParserDef.h"
69 inline double pow2(
double val)
83 inline double pow3(
double val)
85 return val * val * val;
97 inline double pow4(
double val)
99 return val * val * val * val;
497 std::vector<size_t> vWindowSizes;
500 for (
long long int j = 0; j < _view.
getCols(); j++)
516 for (
long long int j = 0; j < vWindowSizes.size(); j++)
541 else if (
m_windowSize.first > vWindowSizes[j] && j+1 == vWindowSizes.size())
716 double I = (int)i -
floor(m/2.0);
718 if (nthDerivative == 1)
720 / (m * (
pow2(m) - 1.0)*(3.0*
pow4(m) - 39.0*
pow2(m) + 108.0));
721 else if (nthDerivative == 2)
724 else if (nthDerivative == 3)
726 / (m * (
pow2(m) - 1.0)*(3.0*
pow4(m) - 39.0*
pow2(m) + 108.0));
729 / (m * (
pow2(m) - 1.0)*(3.0*
pow4(m) - 39.0*
pow2(m) + 108.0));
816 switch (_settings.
type)
1151 void setBoundaries(
const std::vector<mu::value_type>&
left,
const std::vector<mu::value_type>&
right,
const std::vector<mu::value_type>&
top = std::vector<mu::value_type>(),
const std::vector<mu::value_type>&
bottom = std::vector<mu::value_type>())
This is an abstract base class for any type of a data filter. Requires some methods to be implemented...
virtual mu::value_type apply(size_t i, size_t j, const mu::value_type &val) const =0
Virtual method for applying the filter to a distinct value. Has to be implemented in all child classe...
virtual double operator()(size_t i, size_t j) const =0
Virtual operator() override. Has to be implemented in the child classes and shall return the kernel v...
Filter(size_t row, size_t col)
Filter base constructor. Will set the used window sizes.
FilterSettings::FilterType getType() const
This method returns the type of the current filter as a value of the FilterType enumeration.
FilterBuffer2D m_buffer2D
FilterBuffer2D & get2DBuffer()
This method returns the internal filtering buffer queue for 2D data to store already smoothed points ...
virtual ~Filter()
Empty virtual abstract destructor.
FilterSettings::FilterType m_type
bool isConvolution() const
This method returns, whether the current filter is a convolution, ie. whether the returned value may ...
std::pair< size_t, size_t > m_windowSize
FilterBuffer & getBuffer()
This method returns the internal filtering buffer queue to store already smoothed points avoiding lea...
std::pair< size_t, size_t > getWindowSize() const
This method returns the window size of the current filter as a std::pair in the order (row,...
This class implements a gaussian smoothing or blurring filter.
void createKernel(double sigma)
This method will create the filter's kernel for the selected window size.
virtual mu::value_type apply(size_t i, size_t j, const mu::value_type &val) const override
Override for the abstract apply method of the base class. Applies the filter to the value at the sele...
virtual double operator()(size_t i, size_t j) const override
Override for the operator(). Returns the filter kernel at the desired position.
GaussianFilter(size_t row, size_t col, double sigma)
Filter constructor. Will automatically create the filter kernel.
std::vector< std::vector< double > > m_filterKernel
virtual ~GaussianFilter() override
Filter destructor. Will clear the previously calculated filter kernel.
Template class representing a generic file. This class may be specified for the main data type contai...
virtual bool read()=0
Pure virtual declaration of the read access method. Has to be implemented in all derived classes and ...
This class is a facet for an arbitrary GenericFile instance. It can be used to read the contents of t...
mu::value_type getElement(long long int row, long long int col) const
Returns the value stored at the passed positions. A default constructed mu::value_type object instanc...
long long int getCols() const
Returns the number of columns in the internally stored GenericFile instance.
std::string getColumnHead(long long int col) const
Returns the column heading stored for the passed column. Returns an empty string, if the column does ...
This class is a specialized WeightedLinearFilter used to retouch missing data values.
mu::value_type bottomright(size_t i, size_t j) const
This method will return the correct value for the bottomright diagonal interval boundary.
mu::value_type bottom(size_t i, size_t j) const
This method will return the correct value for the bottom interval boundary.
mu::value_type retouch(size_t i, size_t j, const mu::value_type &val, const mu::value_type &med)
This method is a wrapper to retouch only invalid values. The default value of invalid values is the m...
void createKernel()
This method will create the filter's kernel for the selected window size.
mu::value_type validize(mu::value_type val) const
This method checks, whether the passed value is a valid value and returns it. If it is not,...
std::vector< mu::value_type > m_right
mu::value_type m_fallback
void setBoundaries(const std::vector< mu::value_type > &left, const std::vector< mu::value_type > &right, const std::vector< mu::value_type > &top=std::vector< mu::value_type >(), const std::vector< mu::value_type > &bottom=std::vector< mu::value_type >())
This method is used to update the internal filter boundaries.
mu::value_type topright(size_t i, size_t j) const
This method will return the correct value for the topright diagonal interval boundary.
mu::value_type top(size_t i, size_t j) const
This method will return the correct value for the top interval boundary.
virtual ~RetouchRegion() override
Filter destructor. Will clear the previously calculated filter kernel.
std::vector< std::vector< double > > m_filterKernel
mu::value_type topleft(size_t i, size_t j) const
This method will return the correct value for the topleft diagonal interval boundary.
std::vector< mu::value_type > m_left
std::vector< mu::value_type > m_bottom
virtual mu::value_type apply(size_t i, size_t j, const mu::value_type &val) const override
Override for the abstract apply method of the base class. Applies the filter to the value at the sele...
mu::value_type left(size_t i, size_t j) const
This method will return the correct value for the left interval boundary.
virtual double operator()(size_t i, size_t j) const override
Override for the operator(). Returns the filter kernel at the desired position.
mu::value_type bottomleft(size_t i, size_t j) const
This method will return the correct value for the bottomleft diagonal interval boundary.
mu::value_type right(size_t i, size_t j) const
This method will return the correct value for the right interval boundary.
std::vector< mu::value_type > m_top
RetouchRegion(size_t _row, size_t _col, const mu::value_type &_dMedian)
Filter constructor. Will automatically create the filter kernel.
This class implements a Savitzky-Golay filter for differentiation providing a derivative up to degree...
std::vector< double > m_filterKernel
void createKernel(size_t nthDerivative)
This method will create the filter's kernel for the selected window size.
SavitzkyGolayDiffFilter(size_t row, size_t nthDerivative)
Filter constructor. Will automatically create the filter kernel.
virtual mu::value_type apply(size_t i, size_t j, const mu::value_type &val) const override
Override for the abstract apply method of the base class. Applies the filter to the value at the sele...
virtual double operator()(size_t i, size_t j) const override
Override for the operator(). Returns the filter kernel at the desired position.
virtual ~SavitzkyGolayDiffFilter() override
Filter destructor. Will clear the previously calculated filter kernel.
This class implements a Savitzky-Golay filter, which is a polynomial smoothing filter.
void createKernel()
This method will create the filter's kernel for the selected window size.
virtual double operator()(size_t i, size_t j) const override
Override for the operator(). Returns the filter kernel at the desired position.
SavitzkyGolayFilter(size_t row, size_t col)
Filter constructor. Will automatically create the filter kernel.
virtual ~SavitzkyGolayFilter() override
Filter destructor. Will clear the previously calculated filter kernel.
long long int findColumn(const FileView &_view)
This private member function finds the column, which either fits perfectly or is the nearest possibil...
virtual mu::value_type apply(size_t i, size_t j, const mu::value_type &val) const override
Override for the abstract apply method of the base class. Applies the filter to the value at the sele...
std::vector< std::vector< double > > m_filterKernel
This class implements a weighted linear smoothing filter, which applies something like a "convergent ...
std::vector< std::vector< double > > m_filterKernel
void createKernel()
This method will create the filter's kernel for the selected window size.
virtual ~WeightedLinearFilter() override
Filter destructor. Will clear the previously calculated filter kernel.
WeightedLinearFilter(size_t row, size_t col, bool force2D=false)
Filter constructor. Will automatically create the filter kernel.
virtual mu::value_type apply(size_t i, size_t j, const mu::value_type &val) const override
Override for the abstract apply method of the base class. Applies the filter to the value at the sele...
virtual double operator()(size_t i, size_t j) const override
Override for the operator(). Returns the filter kernel at the desired position.
GenericFile * getFileByType(const string &filename)
This function determines the correct class to be used for the filename passed to this function....
std::queue< mu::value_type > FilterBuffer
Typedef for simplifying the usage of the buffer.
std::queue< std::vector< mu::value_type > > FilterBuffer2D
double pow4(double val)
This function is a simple helper to implement a power of four.
Filter * createFilter(const FilterSettings &_settings)
This function creates an instance of the filter specified by the passed FilterSettings structure.
double pow2(double val)
This function is a simple helper to implement a power of two.
double pow3(double val)
This function is a simple helper to implement a power of three.
CONSTCD14 std::enable_if< detail::no_overflow< Period, typenameTo::period >::value, To >::type floor(const std::chrono::duration< Rep, Period > &d)
MUP_BASETYPE value_type
The numeric datatype used by the parser.
bool isnan(const value_type &v)
int StrToInt(const std::string &)
Converts a string into an integer.
This structure contains the necessary information to create an instance of one of the following filte...
FilterSettings(FilterType _type=FILTER_NONE, size_t _row=1u, size_t _col=1u, double _alpha=NAN)