OpendTect-6_4  6.4
marchingcubes.h
Go to the documentation of this file.
1 #ifndef marchingcubes_h
2 #define marchingcubes_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: K. Tingdahl
9  Date: March 2006
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "geometrymod.h"
16 #include "task.h"
17 #include "callback.h"
18 #include "multidimstorage.h"
19 #include "ranges.h"
20 #include "refcount.h"
21 #include "threadlock.h"
22 
23 #include "od_iosfwd.h"
24 
25 template <class T> class Array3D;
26 template <class T> class DataInterpreter;
27 
28 class Executor;
29 class MarchingCuebs2ImplicitFloodFiller;
30 class SeedBasedFloodFiller;
31 
51 {
52 public:
53  MarchingCubesModel();
54  MarchingCubesModel(const MarchingCubesModel&);
55 
56  MarchingCubesModel& operator=(const MarchingCubesModel&);
57  bool operator==(const MarchingCubesModel&) const;
58 
59  bool set(const Array3D<float>& arr,
60  int i0,int i1, int i2,float threshold);
61 
62  bool isEmpty() const;
63 
64  static unsigned char determineModel( bool c000, bool c001, bool c010,
65  bool c011, bool c100, bool c101,
66  bool c110, bool c111 );
67 
68  static bool getCornerSign(unsigned char model, int corner);
69  bool writeTo(od_ostream&,bool binary=true) const;
70  bool readFrom(od_istream&,bool binary=true);
71 
72  static const unsigned char cUdfAxisPos;
73  static const unsigned char cMaxAxisPos;
74  static const unsigned char cAxisSpacing;
75 
76  unsigned char model_; //Don't change the order of these
77  unsigned char submodel_; //since they are written to
78  unsigned char axispos_[3]; //the stream in this order
79 };
80 
81 
84 public:
85 
87 
88  bool setVolumeData(int xorigin,int yorigin,int zorigin,
89  const Array3D<float>&,float threshold,
90  TaskRunner* = 0);
97  void removeAll();
98  bool isEmpty() const;
99 
100  bool getModel(const int* pos, unsigned char& model,
101  unsigned char& submodel) const;
102 
103  Executor* writeTo(od_ostream&,bool binary=true) const;
104  Executor* readFrom(od_istream&,
106 
109 
113  Interval<int> changepos_[3];
115 };
116 
117 
120 public:
121  Implicit2MarchingCubes(int posx, int posy, int posz,
122  const Array3D<float>&, float threshold,
125 
126  od_int64 nrIterations() const;
127  bool doWork(od_int64,od_int64,int);
129  { return tr("Implicit body to MarchingCubes: Contouring"); }
130 
131 
132 protected:
134 
136  float threshold_;
137 
138  int xorigin_;
139  int yorigin_;
140  int zorigin_;
141 };
142 
143 
144 
152 public:
154  Array3D<int>&,
155  int originx,int originy,int originz,
156  bool nodistance);
163 
164  float threshold() const { return 0; }
166  { return tr("Processing MarchingCubes2Implicit."); }
167 
168 protected:
169  od_int64 nrDone() const;
170  od_int64 nrIterations() const;
171 
172  bool doPrepare(int);
173  bool doWork(od_int64,od_int64,int);
174  bool processSeeds( const od_int64*, int nr );
175 
176  friend class MarchingCubes2ImplicitDistGen;
177 
178  bool shouldSetValue(od_int64 offset, int newval );
179  void setValue(od_int64 offset,int newval,bool checkval);
180 
182  int originx_;
183  int originy_;
184  int originz_;
185 
186  int size_[3];
187 
189 
193 
196 };
197 
198 
199 #endif
unsigned char submodel_
Definition: marchingcubes.h:77
#define mRefCountImpl(ClassName)
Macro to setup a class with destructor for reference counting.
Definition: refcount.h:163
#define mExpClass(module)
Definition: commondefs.h:160
Definition: marchingcubes.h:150
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
OD class for stream write common access to the user log file, or std::cout in batch progs...
Definition: od_ostream.h:26
float threshold() const
Definition: marchingcubes.h:164
A lock of a type that (hopefully) suits your needs. To use it, you need the Locker class...
Definition: threadlock.h:53
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
unsigned char model_
Definition: marchingcubes.h:76
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
#define od_int64
Definition: plftypes.h:36
int originx_
Definition: marchingcubes.h:182
bool * newfloodfillers_
Definition: marchingcubes.h:194
bool allchanged_
set when change is trig.
Definition: marchingcubes.h:111
Definition: marchingcubes.h:50
Definition: marchingcubes.h:118
Definition: uistring.h:89
int xorigin_
Definition: marchingcubes.h:138
const MarchingCubesSurface & surface_
Definition: marchingcubes.h:181
OD class for stream read.
Definition: od_istream.h:24
Generalization of a task that can be run in parallel.
Definition: paralleltask.h:66
const Array3D< float > & array_
Definition: marchingcubes.h:135
Byte-level data interpreter.
Definition: cbvswriter.h:22
Definition: marchingcubes.h:82
void removeAll()
od_int64 nrdefined_
Definition: marchingcubes.h:192
Class that can execute a task.
Definition: task.h:169
MarchingCubesSurface & surface_
Definition: marchingcubes.h:133
uiString uiMessage() const
will be message() again in 7.x
Definition: marchingcubes.h:165
Waits for a number of threads to reach a certain point (i.e. the call to Barrier::waitForAll). Once everyone has arrived, everyone is released.
Definition: thread.h:240
int zorigin_
Definition: marchingcubes.h:140
int originy_
Definition: marchingcubes.h:183
Notifier< MarchingCubesSurface > change
Definition: marchingcubes.h:110
static const unsigned char cMaxAxisPos
Definition: marchingcubes.h:73
MultiDimStorage< MarchingCubesModel > models_
Definition: marchingcubes.h:107
int yorigin_
Definition: marchingcubes.h:139
Threads::Barrier barrier_
Definition: marchingcubes.h:190
bool nodistance_
Definition: marchingcubes.h:188
bool isEmpty(const NLAModel *mdl)
float threshold_
Definition: marchingcubes.h:136
static const unsigned char cUdfAxisPos
Definition: marchingcubes.h:72
Threads::Lock modelslock_
Definition: marchingcubes.h:108
Array3D ( Subclass of ArrayND ) is a three dimensional array.
Definition: arraynd.h:153
TypeSet< od_int64 > activefloodfillers_
Definition: marchingcubes.h:195
static const unsigned char cAxisSpacing
Definition: marchingcubes.h:74
Definition: arraytesselator.h:21
int originz_
Definition: marchingcubes.h:184
uiString uiMessage() const
will be message() again in 7.x
Definition: marchingcubes.h:128
Array3D< int > & result_
Definition: marchingcubes.h:191
Specification to enable chunkwise execution of a process.
Definition: executor.h:39

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