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

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