OpendTect 8.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
DataClipper Class Reference

A DataClipper gets a bunch of data and determines at what value to clip if a certain clip percentage is desired. More...

#include <dataclipper.h>

Public Member Functions

 DataClipper ()
 
 DataClipper (const DataClipper &)
 
 ~DataClipper ()
 
bool calculateRange (float cliprate, Interval< float > &)
 
bool calculateRange (float lowcliprate, float highcliprate, Interval< float > &)
 
bool fullSort ()
 
bool getRange (float cliprate, Interval< float > &) const
 
bool getRange (float lowcliprate, float highcliprate, Interval< float > &) const
 
bool getSymmetricRange (float cliprate, float midval, Interval< float > &) const
 
bool isEmpty () const
 
DataClipperoperator= (const DataClipper &)
 
void putData (const ArrayND< float > &)
 
void putData (const float *, od_int64 sz)
 
void putData (const ValueSeries< float > &, od_int64 sz)
 
void putData (float)
 
void reset ()
 
void setApproxNrValues (od_int64 nrsamples, int statsize=2000)
 
const LargeValVec< float > & statPts () const
 

Static Public Member Functions

static bool calculateRange (float *vals, od_int64 nrvals, float lowcliprate, float highcliprate, Interval< float > &)
 

Protected Attributes

Interval< float > absoluterg_
 
int approxstatsize_ = 2000
 
Stats::RandomGeneratorgen_
 
float sampleprob_ = 1.f
 
LargeValVec< float > samples_
 
bool subselect_ = false
 

Detailed Description

A DataClipper gets a bunch of data and determines at what value to clip if a certain clip percentage is desired.

For simple cases, where no subselection is needed (i.e. the stats will be performed on all values, and only one dataset is used) the static function calculateRange is good enough:

DataClipper::calculateRange( mydata.arr(), mydata.size(), 0.05, 0.05,
range );
bool calculateRange(float cliprate, Interval< float > &)
Interval of values.
Definition ranges.h:112
virtual T * arr()
3rd party access
Definition typeset.h:91
size_type size() const
Definition typeset.h:324
Sets of (small) copyable elements.
Definition typeset.h:188

If there are more than one dataset, or if a subselection is wanted, the class is used as follows:

  1. Create object
  2. If subselection is wanted, set total nr of samples and statsize with setApproxNrValues
  3. Add all your sources putData
  4. If you only want a fixed range, call calculateRange.
  5. If you want to come back an get multiple ranges, call fullSort. After fullSort, the getRange functions can be called, any number of times.
  6. To prepare the object for a new set of data, call reset.

Example

Array3D<float> somedata;
TypeSet<float> moredata;
float otherdata;
DataClipper clipper;
setApproxNrValues( somedata.info().getTotalSz()+moredata.size()+1, 2000 );
clipper.putData( somedata );
clipper.putData( moredata.arr(), moredata.size() );
clipper.putData( otherdata );
clipper.fullSort();
clipper.getRange( 0.01, clip99 );
clipper.getRange( 0.05, clip95 );
clipper.getRange( 0.10, clip90 );
Array3D ( Subclass of ArrayND ) is a three dimensional array.
Definition arraynd.h:170
const Array3DInfo & info() const override=0
virtual od_uint64 getTotalSz() const
A DataClipper gets a bunch of data and determines at what value to clip if a certain clip percentage ...
Definition dataclipper.h:72
bool getRange(float cliprate, Interval< float > &) const
void putData(float)
void setApproxNrValues(od_int64 nrsamples, int statsize=2000)
bool fullSort()

<>

Constructor & Destructor Documentation

◆ DataClipper() [1/2]

DataClipper::DataClipper ( )

cliprate is between 0 and 0.5, cliprate0 is the bottom cliprate, cliprate1 is the top cliprate, when cliprate1 is -1, it will get the value of cliprate0

◆ DataClipper() [2/2]

DataClipper::DataClipper ( const DataClipper & )

◆ ~DataClipper()

DataClipper::~DataClipper ( )

Member Function Documentation

◆ calculateRange() [1/3]

static bool DataClipper::calculateRange ( float * vals,
od_int64 nrvals,
float lowcliprate,
float highcliprate,
Interval< float > &  )
static

Does not do a full sort.

Note
vals are modified.

◆ calculateRange() [2/3]

bool DataClipper::calculateRange ( float cliprate,
Interval< float > &  )

Does not do a full sort. Also performes reset

◆ calculateRange() [3/3]

bool DataClipper::calculateRange ( float lowcliprate,
float highcliprate,
Interval< float > &  )

Does not do a full sort. Also performes reset

◆ fullSort()

bool DataClipper::fullSort ( )

◆ getRange() [1/2]

bool DataClipper::getRange ( float cliprate,
Interval< float > &  ) const

◆ getRange() [2/2]

bool DataClipper::getRange ( float lowcliprate,
float highcliprate,
Interval< float > &  ) const

◆ getSymmetricRange()

bool DataClipper::getSymmetricRange ( float cliprate,
float midval,
Interval< float > &  ) const

◆ isEmpty()

bool DataClipper::isEmpty ( ) const
inline

◆ operator=()

DataClipper & DataClipper::operator= ( const DataClipper & )

◆ putData() [1/4]

void DataClipper::putData ( const ArrayND< float > & )

◆ putData() [2/4]

void DataClipper::putData ( const float * ,
od_int64 sz )

◆ putData() [3/4]

void DataClipper::putData ( const ValueSeries< float > & ,
od_int64 sz )

◆ putData() [4/4]

void DataClipper::putData ( float )

◆ reset()

void DataClipper::reset ( )

◆ setApproxNrValues()

void DataClipper::setApproxNrValues ( od_int64 nrsamples,
int statsize = 2000 )

Will make it faster if large amount of data is used. The Object will then randomly subselect on the input to get about statsize samples to do the stats on.

◆ statPts()

const LargeValVec< float > & DataClipper::statPts ( ) const
inline

Member Data Documentation

◆ absoluterg_

Interval<float> DataClipper::absoluterg_
protected

◆ approxstatsize_

int DataClipper::approxstatsize_ = 2000
protected

◆ gen_

Stats::RandomGenerator& DataClipper::gen_
protected

◆ sampleprob_

float DataClipper::sampleprob_ = 1.f
protected

◆ samples_

LargeValVec<float> DataClipper::samples_
protected

◆ subselect_

bool DataClipper::subselect_ = false
protected

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