 |
OpendTect
6.6
|
Go to the documentation of this file.
14 #include "generalmod.h"
22 #define mUndefColIdx (nrsteps_)
38 enum Type { Fixed, Auto, HistEq };
60 static const
char* sKeyClipRate() {
return "Clip Rate"; }
93 int nrsteps,
int udfval);
130 const float* unmapped,
131 T* mappedvals,
int mappedvalspacing=1,
132 T* mappedundef=0,
int mappedundefspacing=1);
140 T* mappedvals,
int mappedvalspacing=1,
141 T* mappedundef=0,
int mappedundefspacing=1);
153 {
return tr(
"Data values mapped"); }
169 template <
class T>
inline
171 const float* unmapped,
172 T* mappedvals,
int mappedvalsspacing,
173 T* mappedudfs,
int mappedudfspacing )
177 , nrsteps_( nrsteps )
178 , unmapped_( unmapped )
180 , mappedvals_( mappedvals )
181 , mappedudfs_( mappedudfs )
182 , mappedvalsspacing_( mappedvalsspacing )
183 , mappedudfspacing_( mappedudfspacing )
184 , histogram_( new unsigned int[nrsteps+1] )
190 template <
class T>
inline
193 T* mappedvals,
int mappedvalsspacing,
194 T* mappedudfs,
int mappedudfspacing )
198 , nrsteps_( nrsteps )
199 , unmapped_( unmapped.arr() )
200 , unmappedvs_( unmapped.arr() ? 0 : &unmapped )
201 , mappedvals_( mappedvals )
202 , mappedudfs_( mappedudfs )
203 , mappedvalsspacing_( mappedvalsspacing )
204 , mappedudfspacing_( mappedudfspacing )
205 , histogram_( new unsigned int[nrsteps+1] )
211 template <
class T>
inline
214 delete [] histogram_;
218 template <
class T>
inline
223 template <
class T>
inline
228 OD::memZero( histogram, (
mUndefColIdx+1)*
sizeof(
unsigned int) );
230 T* valresult = mappedvals_+start*mappedvalsspacing_;
231 T* udfresult = mappedudfs_ ? mappedudfs_+start*mappedudfspacing_ : 0;
232 const float* inp = unmapped_+start;
235 const int mappedvalsspacing = mappedvalsspacing_;
236 const int mappedudfspacing = mappedudfspacing_;
237 const int nrsteps = nrsteps_;
240 const int nrsegs = mapper_.setup_.nrsegs_;
241 const bool flipseq = mapper_.setup_.flipseq_;
242 const float rangewidth = mapper_.setup_.range_.width(
false );
244 const float rangestart = mapper_.setup_.range_.start;
247 for (
od_int64 idx=start; idx<=stop; idx++ )
249 const float input = unmappedvs ? unmappedvs->
value(idx) : *inp++;
251 float position = 0.0f;
259 position = (input-rangestart) / rangewidth;
261 position = (0.5f + ((int) (position*nrsegs))) / nrsegs;
263 if ( position > 1.0f )
265 else if ( position < 0.0f )
269 position = 1.0f - position;
273 if ( position > nrsteps-0.9f )
274 position = nrsteps - 0.9f;
275 else if ( position < 0.0f )
280 const T res = (T) ( isudf ? udfcolidx : (
int) position );
283 valresult += mappedvalsspacing;
287 *udfresult = (T) (isudf ? 0 : udfcolidx);
288 udfresult += mappedudfspacing;
293 if ( nrdone > 100000 )
295 addToNrDone( nrdone );
297 if ( !shouldContinue() )
303 addToNrDone( nrdone );
307 histogram_[idx] += histogram[idx];
const float * unmapped_
Definition: coltabmapper.h:157
const ValueSeries< float > * vs_
Definition: coltabmapper.h:114
void setData(const ValueSeries< float > *, od_int64 sz, TaskRunner *=0)
If data changes, call update()
void triggerAutoscaleChange()
Notifier< MapperSetup > rangeChange
Definition: coltabmapper.h:69
T * mappedudfs_
Definition: coltabmapper.h:161
Locks the lock, shutting out access from other threads if needed.
Definition: threadlock.h:85
Color Table
Definition: coltab.h:22
od_int64 nrIterations() const
Definition: coltabmapper.h:219
static const char * sKeyAutoSym()
Definition: coltabmapper.h:61
virtual T value(int64_t) const =0
od_int64 vssz_
Definition: coltabmapper.h:115
void setRange(const Interval< float > &rg)
DataClipper & clipper_
Definition: coltabmapper.h:112
#define od_int64
Definition: plftypes.h:35
bool isFlipped() const
Definition: coltabmapper.h:95
Setup class for colortable Mapper.
Definition: coltabmapper.h:35
const ValueSeries< float > * data() const
Definition: coltabmapper.h:96
#define mExpClass(module)
Definition: commondefs.h:177
T nrsteps_
Definition: coltabmapper.h:163
Threads::Lock lock_
Definition: coltabmapper.h:165
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:187
#define mDefEps
Definition: commondefs.h:71
const Interval< float > & range() const
Type
Definition: coltabmapper.h:38
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:185
Notifier< MapperSetup > autoscaleChange
Definition: coltabmapper.h:70
od_int64 totalsz_
Definition: coltabmapper.h:156
static int snappedPosition(const Mapper *, float val, int nrsteps, int udfval)
#define mODTextTranslationClass(clss)
Definition: uistring.h:40
Mapper()
defaults maps from [0,1] to [0,1]
static const char * sKeyStarWidth()
Definition: coltabmapper.h:63
void setFlipped(bool yn)
Definition: coltabmapper.h:99
Takes a Mapper, unmapped data and maps it.
Definition: coltabmapper.h:126
A DataClipper gets a bunch of data and determines at what value to clip if a certain clip percentage ...
Definition: dataclipper.h:73
bool doWork(od_int64 start, od_int64 stop, int)
Definition: coltabmapper.h:224
#define mIsZero(x, eps)
Definition: commondefs.h:66
#define mClass(module)
Definition: commondefs.h:181
const ColTab::Mapper & mapper_
Definition: coltabmapper.h:155
Maps data values to colortable positions: [0,1].
Definition: coltabmapper.h:84
const ValueSeries< float > * unmappedvs_
Definition: coltabmapper.h:158
Class that can execute a task.
Definition: task.h:170
Class to help setup a callback handling.
Definition: notify.h:126
od_int64 dataSize() const
Definition: coltabmapper.h:97
unsigned int * histogram_
Definition: coltabmapper.h:164
static const char * sKeySymMidVal()
Definition: coltabmapper.h:62
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:174
Generalization of a task that can be run in parallel.
Definition: paralleltask.h:66
~MapperTask()
Definition: coltabmapper.h:212
void triggerRangeChange()
mDefSetupClssMemb(MapperSetup, Type, type) mDefSetupClssMemb(MapperSetup
#define mUndefColIdx
Definition: coltabmapper.h:22
static const char * sKeyFlipSeq()
Definition: coltabmapper.h:65
String that is able to hold international (UTF-8) strings for the user interface.
Definition: uistring.h:121
void update(bool full=true, TaskRunner *=0)
If !full, will assume data is unchanged.
int mappedvalsspacing_
Definition: coltabmapper.h:160
static const char * sKeyRange()
Definition: coltabmapper.h:64
#define mAllocVarLenArr(type, varnm, __size)
Definition: varlenarray.h:53
float position(float val) const
returns position in ColorTable
T * mappedvals_
Definition: coltabmapper.h:159
MapperSetup setup_
Definition: coltabmapper.h:108
#define mDefSetupClssMemb(clss, typ, memb)
Definition: commondefs.h:150
uiString uiNrDoneText() const
will be nrDoneText() in 7.x
Definition: coltabmapper.h:152
A lock of a type that (hopefully) suits your needs. To use it, you need the Locker class.
Definition: threadlock.h:53
const unsigned int * getHistogram() const
Definition: coltabmapper.h:148
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:55
int mappedudfspacing_
Definition: coltabmapper.h:162
mODTextTranslationClass(MapperTask) public MapperTask(const ColTab::Mapper &map, od_int64 sz, T nrsteps, const ValueSeries< float > &unmapped, T *mappedvals, int mappedvalspacing=1, T *mappedundef=0, int mappedundefspacing=1)
Definition: coltabmapper.h:170
#define mFastIsFloatDefined(fval)
Definition: undefval.h:297
Generated at
for the OpendTect
seismic interpretation project.
Copyright (C): dGB Beheer B.V. 1995-2021