OpendTect-6_4  6.4
seistrctr.h
Go to the documentation of this file.
1 #ifndef seistrctr_h
2 #define seistrctr_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: A.H. Bril
9  Date: 10-5-1995
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 Translators for seismic traces.
14 
15 -*/
16 
17 #include "seismod.h"
18 #include "transl.h"
19 #include "ctxtioobj.h"
20 #include "samplingdata.h"
21 #include "basiccompinfo.h"
22 #include "seisinfo.h"
23 #include "seistype.h"
24 #include "linekey.h"
25 
26 class SeisTrc;
27 class LinScaler;
28 class SeisTrcBuf;
29 class SeisTrcInfo;
30 class TraceData;
31 class TrcKeyZSampling;
32 class SeisPacketInfo;
33 class BufferStringSet;
34 namespace PosInfo { class CubeData; }
35 namespace Seis { class SelData; }
36 
37 
38 
80 public:
82 
83  static const char* sKeyDefault3D() { return "Cube"; }
84  static const char* sKeyDefault2D() { return "2D Cube"; }
85  static const char* sKeyDefaultAttrib() { return "Attribute"; }
86  const char* getSurveyDefaultKey(const IOObj*) const;
87 };
88 
89 
92 public:
93 
102  {
103  friend class SeisTrcTranslator;
104 
105  protected:
106  ComponentData( const char* nm="Seismic Data" )
107  : BasicComponentInfo(nm) {}
109  : BasicComponentInfo(cd) {}
110  ComponentData(const SeisTrc&,int icomp=0,
111  const char* nm="Seismic Data");
112  void operator=(const ComponentData&);
114  };
115 
116 
126  {
127  friend class SeisTrcTranslator;
128 
129  public:
130 
131  int destidx;
132  const ComponentData& org;
133 
134  protected:
135 
136  TargetComponentData( const ComponentData& c,
137  int idx )
138  : ComponentData(c), org(c), destidx(idx) {}
139 
140  void operator=(const TargetComponentData&);
142  };
143 
144  SeisTrcTranslator(const char*,const char*);
145  virtual ~SeisTrcTranslator();
146 
154  bool initWrite(Conn*,const SeisTrc&);
160  virtual Conn* curConn() { return conn_; }
161 
163  const Seis::SelData* selData() const { return seldata_; }
166  componentInfo() const { return tarcds_; }
168  inputComponentData() const { return cds_; }
169  const SamplingData<float>& inpSD() const { return insd_; }
170  int inpNrSamples() const { return innrsamples_; }
171  const SamplingData<float>& outSD() const { return outsd_; }
172  int outNrSamples() const { return outnrsamples_;}
173 
174  void setSelData( const Seis::SelData* t ) { seldata_ = t; }
176  bool commitSelections();
180  virtual bool readInfo(SeisTrcInfo&) { return false; }
181  virtual bool read(SeisTrc&);
182  virtual bool skip( int nrtrcs=1 ) { return false; }
183  virtual bool write(const SeisTrc&);
184  // overrule if you don't need sorting/buffering
185 
186  virtual bool close();
187  uiString errMsg() const { return errmsg_; }
188 
189  virtual bool inlCrlSorted() const { return true; }
190  virtual int bytesOverheadPerTrace() const { return 240; }
191 
192  virtual void usePar(const IOPar&);
193 
194  inline int selComp( int nr=0 ) const { return inpfor_[nr]; }
195  inline int nrSelComps() const { return nrout_; }
196  SeisTrc* getEmpty();
199  SeisTrc* getFilled(const BinID&);
202  virtual bool supportsGoTo() const { return false; }
203  virtual bool goTo(const BinID&) { return false; }
204 
205  virtual void cleanUp();
207 
208  static bool getRanges(const MultiID&,TrcKeyZSampling&,
209  const char* linekey=0);
210  static bool getRanges(const IOObj&,TrcKeyZSampling&,
211  const char* linekey=0);
212 
213  virtual bool getGeometryInfo(PosInfo::CubeData&) const
214  { return false; }
215 
216  static bool is2D(const IOObj&,bool only_internal=false);
217  static bool isPS(const IOObj&);
218  bool isPS() const { return is_prestack; }
219  static bool isLineSet(const IOObj&);
223  static const char* sKeyIs2D();
224  static const char* sKeyIsPS();
225  static const char* sKeyRegWrite();
226  static const char* sKeySIWrite();
227 
228  // Use the following fns only if you _really_ know
229  // what you're doing.
230  void enforceRegularWrite( bool yn )
231  { enforce_regular_write = yn; }
232  void enforceSurvinfoWrite( bool yn )
233  { enforce_survinfo_write = yn; }
234 
235  const LineKey& curLineKey() const { return curlinekey_; }
236  void setCurLineKey( const LineKey& lk ) { curlinekey_ = lk; }
237  Pos::GeomID curGeomID() const { return geomid_; }
238  void setCurGeomID( Pos::GeomID gid ) { geomid_ = gid; }
239 
240  virtual bool isUserSelectable(bool) const { return false; }
241  virtual int estimatedNrTraces() const { return -1; }
242 
243  void setComponentNames(const BufferStringSet&);
244  void getComponentNames(BufferStringSet&) const;
245 
246  bool haveWarnings() const;
247  const BufferStringSet& warnings() const { return warnings_; }
248 
249 protected:
250 
255 
257  bool is_2d;
261 
277 
278  virtual bool forRead() const;
279  void addComp(const DataCharacteristics&,
280  const char* nm=0,int dtype=0);
281 
282  void setDataType( int icomp, int d )
283  { cds_[icomp]->datatype = tarcds_[icomp]->datatype = d;}
284 
285  /* Subclasses will need to implement the following: */
286  virtual bool initRead_() { return true; }
287  virtual bool initWrite_(const SeisTrc&) { return true; }
288  virtual bool commitSelections_() { return true; }
289  virtual bool readData(TraceData* extbuf=0) { return false; }
290 
291  // These are called from the default write()
293  { return true; }
294  virtual bool dumpBlock();
295  virtual void blockDumped(int nrtrcs) {}
296  virtual bool writeTrc_(const SeisTrc&) { return false; }
297  // Buffer to be written when writeBlock() is called
299 
300  void prepareComponents(SeisTrc&,int actualsz) const;
301 
302  // Quick access to selected, like selComp() etc.
305 
308  virtual void addWarn(int,const char*);
309 
310 private:
311 
312  int* inpfor_;
313  int nrout_;
314  int prevnr_;
316 
317  bool initConn(Conn*);
318  void enforceBounds();
319  bool writeBlock();
320  bool copyDataToTrace(SeisTrc&);
321 
322  friend class SeisTrcReader;
323 
324 public:
325 
326  void setIs2D( bool yn ) { is_2d = yn; }
327  void setIsPS( bool yn ) { is_prestack = yn; }
328 };
329 
330 
331 #endif
virtual bool isUserSelectable(bool) const
Definition: seistrctr.h:240
#define mExpClass(module)
Definition: commondefs.h:160
Seismic Trace translator.
Definition: seistrctr.h:78
BufferStringSet & warnings_
Definition: seistrctr.h:307
ComponentData ** inpcds_
Definition: seistrctr.h:303
Summary for a Seismic object.
Definition: segydirectdef.h:23
void getComponentNames(BufferStringSet &) const
virtual void cleanUp()
Prepare for new initialisation.
void setComponentNames(const BufferStringSet &)
bool initWrite(Conn *, const SeisTrc &)
ComponentData(const char *nm="Seismic Data")
Definition: seistrctr.h:106
static bool getRanges(const MultiID &, TrcKeyZSampling &, const char *linekey=0)
TargetComponentData ** outcds_
Definition: seistrctr.h:304
int nrSelComps() const
Definition: seistrctr.h:195
Definition: ioobj.h:58
const LinScaler * curtrcscalebase_
Definition: seistrctr.h:276
const ObjectSet< ComponentData > & inputComponentData() const
Definition: seistrctr.h:168
Info on one component.
Definition: basiccompinfo.h:23
virtual int bytesOverheadPerTrace() const
Definition: seistrctr.h:190
void setIs2D(bool yn)
Definition: seistrctr.h:326
bool is_prestack
Definition: seistrctr.h:258
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
const BufferStringSet & warnings() const
Definition: seistrctr.h:247
bool is_2d
Definition: seistrctr.h:257
TraceData * storbuf_
Definition: seistrctr.h:274
Information for a packet of seismics, AKA tape header info.
Definition: seispacketinfo.h:25
int outnrsamples_
Definition: seistrctr.h:268
void prepareComponents(SeisTrc &, int actualsz) const
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:188
static const char * sKeySIWrite()
ObjectSet< TargetComponentData > tarcds_
Definition: seistrctr.h:265
void enforceSurvinfoWrite(bool yn)
Definition: seistrctr.h:232
Interval< int > samprg_
Definition: seistrctr.h:269
virtual bool read(SeisTrc &)
virtual bool supportsGoTo() const
Definition: seistrctr.h:202
virtual bool close()
virtual bool skip(int nrtrcs=1)
Definition: seistrctr.h:182
const ObjectSet< TargetComponentData > & componentInfo() const
Definition: seistrctr.h:166
virtual ~SeisTrcTranslator()
LineKey curlinekey_
Definition: seistrctr.h:271
Definition: uistring.h:89
static bool isLineSet(const IOObj &)
virtual bool initWrite_(const SeisTrc &)
Definition: seistrctr.h:287
Conn * conn_
Definition: seistrctr.h:251
SamplingData< float > insd_
Definition: seistrctr.h:262
Set of BufferString objects.
Definition: bufstringset.h:28
void setSelData(const Seis::SelData *t)
Definition: seistrctr.h:174
bool writeBlock(std::ostream &, const void *, uint64_t)
const char * sKeyIs2D()
Definition: segybatchio.h:34
Definition: seistype.h:31
int innrsamples_
Definition: seistrctr.h:263
int inpNrSamples() const
Definition: seistrctr.h:170
int outNrSamples() const
Definition: seistrctr.h:172
Pos::GeomID curGeomID() const
Definition: seistrctr.h:237
static const char * sKeyDefaultAttrib()
Definition: seistrctr.h:85
int * inpfor_
Definition: seistrctr.h:312
Set of pointers to objects.
Definition: commontypes.h:32
const Seis::SelData * seldata_
Definition: seistrctr.h:266
BufferStringSet * compnms_
Definition: seistrctr.h:254
Key for a line in a line set.
Definition: linekey.h:22
int nrout_
Definition: seistrctr.h:313
#define mDefEmptyTranslatorGroupConstructor(clss)
Definition: transl.h:255
bool isPS(GeomType gt)
Definition: seistype.h:38
reads from a seismic data store.
Definition: seisread.h:50
Group of Translators. Has a static factory.
Definition: transl.h:56
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
Definition: seistrctr.h:90
virtual Conn * curConn()
Definition: seistrctr.h:160
const ComponentData & org
Definition: seistrctr.h:132
byte-level data characteristics of stored data.
Definition: datachar.h:37
int lastinlwritten_
Definition: seistrctr.h:315
void addComp(const DataCharacteristics &, const char *nm=0, int dtype=0)
static const char * sKeyRegWrite()
TargetComponentData(const ComponentData &c, int idx)
Definition: seistrctr.h:136
virtual bool prepareWriteBlock(StepInterval< int > &, bool &)
Definition: seistrctr.h:292
bool initRead(Conn *, Seis::ReadMode rt=Seis::Prod)
Hor+Vert sampling in 3D surveys.
Definition: trckeyzsampling.h:35
const SamplingData< float > & outSD() const
Definition: seistrctr.h:171
isTranslatorGroup(SeisTrc) public
Definition: seistrctr.h:79
Information for one component.
Definition: seistrctr.h:101
void setCurGeomID(Pos::GeomID gid)
Definition: seistrctr.h:238
virtual bool commitSelections_()
Definition: seistrctr.h:288
Information for a seismic trace, AKA trace header info.
Definition: seisinfo.h:27
LinScaler * trcscalebase_
Definition: seistrctr.h:275
void setCurLineKey(const LineKey &lk)
Definition: seistrctr.h:236
SeisTrcBuf & trcblock_
Definition: seistrctr.h:298
const SamplingData< float > & inpSD() const
Definition: seistrctr.h:169
virtual bool inlCrlSorted() const
Definition: seistrctr.h:189
bool enforce_survinfo_write
Definition: seistrctr.h:260
contains input (sub-)selection data from a cube or lineset
Definition: seisselection.h:82
static const char * sKeyDefault2D()
Definition: seistrctr.h:84
void setIsPS(bool yn)
Definition: seistrctr.h:327
Index_Type GeomID
Definition: commontypes.h:52
I/O Interpreter class for a certain object type.
Definition: transl.h:123
Data connection.
Definition: conn.h:30
virtual bool readData(TraceData *extbuf=0)
Definition: seistrctr.h:289
ComponentData as it should be when the Translator puts it away.
Definition: seistrctr.h:125
SeisPacketInfo & packetInfo()
Definition: seistrctr.h:162
bool initConn(Conn *)
SamplingData< float > outsd_
Definition: seistrctr.h:267
virtual bool getGeometryInfo(PosInfo::CubeData &) const
Definition: seistrctr.h:213
Position info, often segmented.
Definition: posinfo.h:40
void enforceRegularWrite(bool yn)
Definition: seistrctr.h:230
SeisPacketInfo & pinfo_
Definition: seistrctr.h:252
virtual bool goTo(const BinID &)
Definition: seistrctr.h:203
const Seis::SelData * selData() const
Definition: seistrctr.h:163
ReadMode
Definition: seistype.h:31
virtual bool write(const SeisTrc &)
bool datareaddone_
Definition: seistrctr.h:273
static const char * sKeyIsPS()
uiString errmsg_
Definition: seistrctr.h:253
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:30
Seismic trace.
Definition: seistrc.h:34
BufferString errmsg_
Definition: horizontracker.h:119
SeisTrc * getFilled(const BinID &)
bool is2D(const PicksType &picks)
Definition: pickset.h:142
uiString errMsg() const
Definition: seistrctr.h:187
virtual void addWarn(int, const char *)
SeisTrc * getEmpty()
set of seismic traces.
Definition: seisbuf.h:31
ComponentData(const ComponentData &cd)
Definition: seistrctr.h:108
SeisTrcTranslator(const char *, const char *)
bool haveWarnings() const
virtual bool initRead_()
Definition: seistrctr.h:286
virtual bool readInfo(SeisTrcInfo &)
Definition: seistrctr.h:180
int prevnr_
Definition: seistrctr.h:314
void setDataType(int icomp, int d)
Definition: seistrctr.h:282
bool enforce_regular_write
Definition: seistrctr.h:259
Seis::ReadMode read_mode
Definition: seistrctr.h:256
Pos::GeomID geomid_
Definition: seistrctr.h:270
A set of data buffers and their interpreters.
Definition: tracedata.h:32
virtual bool dumpBlock()
will call blockDumped()
bool headerdonenew_
Definition: seistrctr.h:272
virtual void blockDumped(int nrtrcs)
Definition: seistrctr.h:295
Position info for an entire 3D cube. The LineData&#39;s are not sorted.
Definition: posinfo.h:95
virtual bool writeTrc_(const SeisTrc &)
Definition: seistrctr.h:296
TypeSet< int > warnnrs_
Definition: seistrctr.h:306
virtual bool forRead() const
ObjectSet< ComponentData > cds_
Definition: seistrctr.h:264
ObjectSet< TargetComponentData > & componentInfo()
Definition: seistrctr.h:164
bool isPS() const
Definition: seistrctr.h:218
virtual int estimatedNrTraces() const
Definition: seistrctr.h:241
bool copyDataToTrace(SeisTrc &)
Linear scaling.
Definition: scaler.h:55
Compound key consisting of ints.
Definition: multiid.h:25
int selComp(int nr=0) const
Definition: seistrctr.h:194
const LineKey & curLineKey() const
Definition: seistrctr.h:235
int destidx
Definition: seistrctr.h:131

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