OpendTect  6.3
dataclipper.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: Kristofer Tingdahl
8  Date: 09-02-2002
9 ________________________________________________________________________
10 
11 
12 -*/
13 
14 #include "algomod.h"
15 #include "typeset.h"
16 #include "ranges.h"
17 template <class T> class ValueSeries;
18 template <class T> class ArrayND;
19 
72 {
73 public:
74  DataClipper();
80  bool operator ==(const DataClipper&) const;
81  inline bool isEmpty() const { return samples_.isEmpty(); }
82 
83  void setApproxNrValues(od_int64 nrsamples,
84  int statsize=2000);
90  void putData(float);
91  void putData(const float*,od_int64 sz);
92  void putData(const ValueSeries<float>&,od_int64 sz);
93  void putData(const ArrayND<float>&);
94 
95  bool calculateRange(float cliprate,Interval<float>&);
98  bool calculateRange(float lowcliprate,
99  float highcliprate,
100  Interval<float>&);
103  static bool calculateRange(float* vals, od_int64 nrvals,
104  float lowcliprate,
105  float highcliprate,
106  Interval<float>&);
109  bool fullSort();
110  bool getRange(float cliprate,Interval<float>&) const;
111  bool getRange(float lowcliprate,float highcliprate,
112  Interval<float>&) const;
113  bool getSymmetricRange(float cliprate,float midval,
114  Interval<float>&) const;
115  void reset();
116 
117  const LargeValVec<float>& statPts() const { return samples_; }
118 
119 protected:
120 
122  float sampleprob_;
126 };
127 
128 
134 {
135 public:
136  DataClipSampler(int bufsz=10000);
137  ~DataClipSampler() { delete [] vals_; }
138 
139  void reset() { count_ = 0; }
140 
141  void add(float);
142  void add(const float*,od_int64);
143  void finish() const;
144 
145  od_int64 nrVals() const;
146  const float* vals() const { return vals_; }
147 
148  void report(IOPar&) const;
149  Interval<float> getRange(float clipratio) const;
150 
151 
152 protected:
153 
154  float* vals_;
155  const int maxnrvals_;
158  bool finished_;
159 
160  void doAdd(float);
161  BufferString getClipRgStr(float) const;
162 };
#define mExpClass(module)
Definition: commondefs.h:157
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:51
#define od_int64
Definition: plftypes.h:34
int approxstatsize_
Definition: dataclipper.h:121
Interval< float > rg_
Definition: dataclipper.h:157
bool subselect_
Definition: dataclipper.h:123
float sampleprob_
Definition: dataclipper.h:122
bool isEmpty() const
Definition: dataclipper.h:81
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:53
const float * vals() const
Definition: dataclipper.h:146
Interface to a series of values.
Definition: odmemory.h:15
od_int64 count_
Definition: dataclipper.h:156
void reset()
Definition: dataclipper.h:139
An ArrayND is an array with a given number of dimensions and a size.
Definition: arraynd.h:29
Data clipping sampler.
Definition: dataclipper.h:133
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:38
const int maxnrvals_
Definition: dataclipper.h:155
Interval< float > absoluterg_
Definition: dataclipper.h:125
LargeValVec< float > samples_
Definition: dataclipper.h:124
float * vals_
Definition: dataclipper.h:154
bool finished_
Definition: dataclipper.h:158
const LargeValVec< float > & statPts() const
Definition: dataclipper.h:117
~DataClipSampler()
Definition: dataclipper.h:137
A DataClipper gets a bunch of data and determines at what value to clip if a certain clip percentage ...
Definition: dataclipper.h:71

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2017