OpendTect  6.3
marchingcubes.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: K. Tingdahl
8  Date: March 2006
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "geometrymod.h"
14 #include "task.h"
15 #include "notify.h"
16 #include "multidimstorage.h"
17 #include "ranges.h"
18 #include "refcount.h"
19 #include "threadlock.h"
20 
21 #include "od_iosfwd.h"
22 
23 template <class T> class Array3D;
24 template <class T> class DataInterpreter;
25 
26 class Executor;
27 class MarchingCuebs2ImplicitFloodFiller;
28 class SeedBasedFloodFiller;
29 
49 {
50 public:
51  MarchingCubesModel();
52  MarchingCubesModel(const MarchingCubesModel&);
53 
54  MarchingCubesModel& operator=(const MarchingCubesModel&);
55  bool operator==(const MarchingCubesModel&) const;
56 
57  bool set(const Array3D<float>& arr,
58  int i0,int i1, int i2,float threshold);
59 
60  bool isEmpty() const;
61 
62  static unsigned char determineModel( bool c000, bool c001, bool c010,
63  bool c011, bool c100, bool c101,
64  bool c110, bool c111 );
65 
66  static bool getCornerSign(unsigned char model, int corner);
67  bool writeTo(od_ostream&,bool binary=true) const;
68  bool readFrom(od_istream&,bool binary=true);
69 
70  static const unsigned char cUdfAxisPos;
71  static const unsigned char cMaxAxisPos;
72  static const unsigned char cAxisSpacing;
73 
74  unsigned char model_; //Don't change the order of these
75  unsigned char submodel_; //since they are written to
76  unsigned char axispos_[3]; //the stream in this order
77 };
78 
79 
80 mExpClass(Geometry) MarchingCubesSurface : public RefCount::Referenced
81  , public CallBacker
82 {
83 public:
85 
86  bool setVolumeData(int xorigin,int yorigin,int zorigin,
87  const Array3D<float>&,float threshold,
88  TaskRunner* = 0);
95  void removeAll();
96  bool isEmpty() const;
97 
98  bool getModel(const int* pos, unsigned char& model,
99  unsigned char& submodel) const;
100 
101  Executor* writeTo(od_ostream&,bool binary=true) const;
102  Executor* readFrom(od_istream&,
104 
107 
111  Interval<int> changepos_[3];
113 protected:
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("Flood fills performed"); }
168  { return tr("Processing MarchingCubes2Implicit."); }
169 
170 protected:
171  od_int64 nrDone() const;
172  od_int64 nrIterations() const;
173 
174  bool doPrepare(int);
175  bool doWork(od_int64,od_int64,int);
176  bool processSeeds( const od_int64*, int nr );
177 
178  friend class MarchingCubes2ImplicitDistGen;
179 
180  bool shouldSetValue(od_int64 offset, int newval );
181  void setValue(od_int64 offset,int newval,bool checkval);
182 
184  int originx_;
185  int originy_;
186  int originz_;
187 
188  int size_[3];
189 
191 
195 
198 };
unsigned char submodel_
Definition: marchingcubes.h:75
#define mExpClass(module)
Definition: commondefs.h:157
Definition: marchingcubes.h:150
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:182
OD class for stream write common access to the user log file, or std::cout in batch progs...
Definition: od_ostream.h:25
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:51
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:51
unsigned char model_
Definition: marchingcubes.h:74
#define mODTextTranslationClass(clss)
Definition: uistring.h:37
#define od_int64
Definition: plftypes.h:34
int originx_
Definition: marchingcubes.h:184
bool * newfloodfillers_
Definition: marchingcubes.h:196
bool allchanged_
set when change is trig.
Definition: marchingcubes.h:109
Definition: marchingcubes.h:48
Definition: marchingcubes.h:118
Definition: uistring.h:88
int xorigin_
Definition: marchingcubes.h:138
const MarchingCubesSurface & surface_
Definition: marchingcubes.h:183
OD class for stream read.
Definition: od_istream.h:23
Generalization of a task that can be run in parallel.
Definition: paralleltask.h:64
const Array3D< float > & array_
Definition: marchingcubes.h:135
Byte-level data interpreter.
Definition: cbvswriter.h:20
Definition: marchingcubes.h:80
void removeAll()
od_int64 nrdefined_
Definition: marchingcubes.h:194
Class that can execute a task.
Definition: task.h:193
MarchingCubesSurface & surface_
Definition: marchingcubes.h:133
uiString message() const
Definition: marchingcubes.h:128
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:244
int zorigin_
Definition: marchingcubes.h:140
int originy_
Definition: marchingcubes.h:185
bool isEmpty(const char *)
Notifier< MarchingCubesSurface > change
Definition: marchingcubes.h:108
static const unsigned char cMaxAxisPos
Definition: marchingcubes.h:71
MultiDimStorage< MarchingCubesModel > models_
Definition: marchingcubes.h:105
int yorigin_
Definition: marchingcubes.h:139
Threads::Barrier barrier_
Definition: marchingcubes.h:192
uiString nrDoneText() const
Definition: marchingcubes.h:165
bool nodistance_
Definition: marchingcubes.h:190
float threshold_
Definition: marchingcubes.h:136
static const unsigned char cUdfAxisPos
Definition: marchingcubes.h:70
Threads::Lock modelslock_
Definition: marchingcubes.h:106
Array3D ( Subclass of ArrayND ) is a three dimensional array.
Definition: arraynd.h:149
TypeSet< od_int64 > activefloodfillers_
Definition: marchingcubes.h:197
static const unsigned char cAxisSpacing
Definition: marchingcubes.h:72
Definition: arraytesselator.h:19
int originz_
Definition: marchingcubes.h:186
Array3D< int > & result_
Definition: marchingcubes.h:193
Specification to enable chunkwise execution of a process.
Definition: executor.h:38
uiString message() const
Definition: marchingcubes.h:167

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