OpendTect  6.6
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...

Public Member Functions

 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
 
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_
 
float sampleprob_
 
LargeValVec< float > samples_
 
bool subselect_
 

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 > &)
virtual T * arr()
3rd party access
Definition: typeset.h:94
size_type size() const
Definition: typeset.h:322

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 );
virtual const Array3DInfo & info() const =0
virtual uint64_t getTotalSz() const
A DataClipper gets a bunch of data and determines at what value to clip if a certain clip percentage ...
Definition: dataclipper.h:73
bool getRange(float cliprate, Interval< float > &) const
void putData(float)
void setApproxNrValues(od_int64 nrsamples, int statsize=2000)
bool fullSort()

<>

Constructor & Destructor Documentation

◆ DataClipper()

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

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

◆ 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_
protected

◆ sampleprob_

float DataClipper::sampleprob_
protected

◆ samples_

LargeValVec<float> DataClipper::samples_
protected

◆ subselect_

bool DataClipper::subselect_
protected

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