OpendTect-6_4  6.4
array2dbitmap.h
Go to the documentation of this file.
1 #ifndef array2dbitmap_h
2 #define array2dbitmap_h
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: A.H. Bril
8  Date: Sep 2006
9  RCS: $Id$
10 ________________________________________________________________________
11 
12 -*/
13 
14 #include "generalmod.h"
15 #include "generalmod.h"
16 #include "ranges.h"
17 #include "arraynd.h"
18 #include "dataclipper.h"
19 
20 
22 #define A2DBitMapImpl Array2DImpl<char>
23 
28 mStruct(General) A2DBitMapGenPars
29 {
30  A2DBitMapGenPars()
31  : nointerpol_(false)
32  , autoscale_(true)
33  , clipratio_(0.025,0.025)
34  , midvalue_( mUdf(float) )
35  , scale_(0,1) {}
36 
37  bool nointerpol_;
38  bool autoscale_;
39  Interval<float> clipratio_;
40  float midvalue_;
42  Interval<float> scale_;
43 
44  static char cNoFill();
45 
46 };
47 
48 
54 {
55 public:
56 
58  : data_(d) { collectData(); }
59  virtual ~A2DBitMapInpData() {}
60 
61  const Array2D<float>& data() const { return data_; }
62  Interval<float> scale(const Interval<float>& clipratio,
63  float midval) const;
64  virtual float midVal() const;
65 
66  void collectData();
67 
68 protected:
70 
72 };
73 
74 
110 {
111 public:
112 
113  A2DBitMapPosSetup(const Array2DInfo&,float* dim0pos=0);
114  // If passed, dim0pos becomes mine
115  virtual ~A2DBitMapPosSetup();
116 
117  void setDim0Positions(float* dim0positions);
119  void setDim1Positions(float,float);
121  inline const float* dim0Positions() const
122  { return dim0pos_; }
123  inline const Interval<float>& dim1Positions() const
124  { return dim1pos_; }
125  int dimSize( int dim ) const
126  { return dim ? szdim1_ : szdim0_; }
127 
128  void setDimRange( int dim, const Interval<float>& r )
129  { (dim ? dim1rg_ : dim0rg_) = r; }
130  inline const Interval<float>& dimRange( int dim ) const
131  { return dim ? dim1rg_ : dim0rg_; }
132  inline float dim0MedianDist() const { return dim0mediandist_; }
133 
134  void setBitMapSizes(int,int) const;
135  inline int nrXPix() const { return nrxpix_; }
136  inline int nrYPix() const { return nrypix_; }
137  void setPixSizes(int,int);
138  int availableXPix() const { return availablenrxpix_; }
139  int availableYPix() const { return availablenrypix_; }
140 
141  inline float getPixPerDim( int dim ) const
142  { return dim ? pixperdim1_ : pixperdim0_; }
143  inline float getPixOffs( int dim, float pos ) const
144  { return (pos - (dim ? dim1rg_ : dim0rg_).start)
145  * getPixPerDim( dim ); }
146 
147  int getPix(int dim,float) const;
148  // Nr of pixels from (0,0), always inside bitmap
149  bool isInside(int dim,float) const;
150  // Is position in dim inside bitmap?
151 
152 protected:
153 
154  float* dim0pos_;
156  int szdim0_;
157  int szdim1_;
158 
162 
163  // Vars for current bitmap
164  int nrxpix_;
165  int nrypix_;
168  float pixperdim0_;
169  float pixperdim1_;
170 
171 };
172 
173 
179 {
180 public:
181 
182  virtual ~A2DBitMapGenerator() { delete &pars_; }
183 
184  void setBitMap(A2DBitMap&);
185  A2DBitMap& bitmap() { return *bitmap_; }
186  const A2DBitMap& bitmap() const { return *bitmap_; }
187  int bitmapSize(int dim) const;
188 
189  static void initBitMap(A2DBitMap&);
190  void initBitMap()
191  { if ( bitmap_ ) initBitMap( *bitmap_ ); }
192  void setPixSizes(int,int);
193 
194  void fill();
195 
196  A2DBitMapGenPars& pars() { return pars_; }
197  const A2DBitMapGenPars& pars() const { return pars_; }
198  const A2DBitMapInpData& data() const { return data_; }
199  const A2DBitMapPosSetup& setup() const { return setup_; }
200 
201  const Interval<float> getScaleRange() const { return scalerg_; }
202 
203 protected:
204 
205  A2DBitMapGenerator(const A2DBitMapInpData&,
206  const A2DBitMapPosSetup&,
207  A2DBitMapGenPars&);
210 
213  A2DBitMapGenPars& pars_;
215 
216  // handy, duplicated from respective objects
217  int szdim0_;
218  int szdim1_;
219  const float* dim0pos_;
223  float dim0perpix_;
224  float dim1perpix_;
226  float scalewidth_;
227 
228  virtual void doFill() = 0;
229 };
230 
231 
232 #endif
const Array2D< float > & data_
Definition: array2dbitmap.h:71
int szdim0_
Definition: array2dbitmap.h:156
#define mExpClass(module)
Definition: commondefs.h:160
int nrypix_
Definition: array2dbitmap.h:165
virtual ~A2DBitMapGenerator()
Definition: array2dbitmap.h:182
const A2DBitMapInpData & data_
Definition: array2dbitmap.h:211
const float * dim0pos_
Definition: array2dbitmap.h:219
Interval< float > dim1rg_
Definition: array2dbitmap.h:222
float getPixPerDim(int dim) const
Definition: array2dbitmap.h:141
int szdim0_
Definition: array2dbitmap.h:217
int nrxpix_
Definition: array2dbitmap.h:164
const A2DBitMapGenPars & pars() const
Definition: array2dbitmap.h:197
const Interval< float > & dimRange(int dim) const
Definition: array2dbitmap.h:130
float pixperdim1_
Definition: array2dbitmap.h:169
#define mStruct(module)
Definition: commondefs.h:165
int nrYPix() const
Definition: array2dbitmap.h:136
A2DBitMapGenPars & pars_
Definition: array2dbitmap.h:213
const A2DBitMap & bitmap() const
Definition: array2dbitmap.h:186
Interval< float > scalerg_
Definition: array2dbitmap.h:225
A2DBitMap & bitmap()
Definition: array2dbitmap.h:185
int availableYPix() const
Definition: array2dbitmap.h:139
float dim0MedianDist() const
Definition: array2dbitmap.h:132
Interval< float > dim0rg_
Definition: array2dbitmap.h:159
virtual ~A2DBitMapInpData()
Definition: array2dbitmap.h:59
int availableXPix() const
Definition: array2dbitmap.h:138
A2DBitMapInpData(const Array2D< float > &d)
Definition: array2dbitmap.h:57
A2DBitMap * bitmap_
Definition: array2dbitmap.h:214
float dim1perpix_
Definition: array2dbitmap.h:224
float pixperdim0_
Definition: array2dbitmap.h:168
Array2D Bitmap generation setup.
Definition: array2dbitmap.h:109
void setDimRange(int dim, const Interval< float > &r)
&#39;zooming&#39;
Definition: array2dbitmap.h:128
const A2DBitMapInpData & data() const
Definition: array2dbitmap.h:198
Interval< float > dim1rg_
Definition: array2dbitmap.h:160
void initBitMap()
Definition: array2dbitmap.h:190
A2DBitMapGenPars & pars()
Definition: array2dbitmap.h:196
const float * dim0Positions() const
Definition: array2dbitmap.h:121
int szdim1_
Definition: array2dbitmap.h:218
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
float dim0perpix_
Definition: array2dbitmap.h:223
int dimSize(int dim) const
Definition: array2dbitmap.h:125
const A2DBitMapPosSetup & setup_
Definition: array2dbitmap.h:212
int availablenrxpix_
Definition: array2dbitmap.h:166
const Interval< float > getScaleRange() const
Definition: array2dbitmap.h:201
Contains the information about the size of Array2D, and in what order the data is stored (if accessab...
Definition: arrayndinfo.h:95
Array2D< char > A2DBitMap
Definition: array2dbitmap.h:21
float getPixOffs(int dim, float pos) const
Definition: array2dbitmap.h:143
Array2D<float>& + statistics.
Definition: array2dbitmap.h:53
float * dim0pos_
Definition: array2dbitmap.h:154
float scalewidth_
Definition: array2dbitmap.h:226
float dim0mediandist_
Definition: array2dbitmap.h:161
Interval< float > dim0rg_
Definition: array2dbitmap.h:221
const Array2D< float > & data() const
Definition: array2dbitmap.h:61
Interval< float > dim1pos_
Definition: array2dbitmap.h:155
DataClipper clipper_
Definition: array2dbitmap.h:69
const Interval< float > & dim1Positions() const
Definition: array2dbitmap.h:123
int szdim1_
Definition: array2dbitmap.h:157
const A2DBitMapPosSetup & setup() const
Definition: array2dbitmap.h:199
int nrXPix() const
Definition: array2dbitmap.h:135
int availablenrypix_
Definition: array2dbitmap.h:167
Interval< float > dim1pos_
Definition: array2dbitmap.h:220
Generates Array2D bitmap from Array2D<float>.
Definition: array2dbitmap.h:178
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