OpendTect-6_4  6.4
segytr.h
Go to the documentation of this file.
1 #ifndef segytr_h
2 #define segytr_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: 2-4-1996
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 Translators for SEGY files traces.
14 
15 -*/
16 
17 #include "seismod.h"
18 #include "segyfiledef.h"
19 #include "seistrctr.h"
20 #include "tracedata.h"
21 #include "strmdata.h"
22 #include "uistring.h"
23 #include "coordsystem.h"
24 
25 class LinScaler;
26 class BendPoints2Coords;
27 namespace SEGY { class TxtHeader; class BinHeader; class TrcHeader; }
28 
29 #define mSEGYTraceHeaderBytes 240
30 
31 
34 public:
35 
36  SEGYSeisTrcTranslator(const char*,const char*);
38  virtual const char* defExtension() const { return "sgy"; }
39 
40  virtual bool readInfo(SeisTrcInfo&);
41  virtual bool read(SeisTrc&);
42  virtual bool skip(int);
43  bool goToTrace(int);
44  int traceSizeOnDisk() const;
45  bool getFullTrcAsBuf(unsigned char*);
46 
47  bool isRev0() const;
48  int numberFormat() const { return filepars_.fmt_; }
49  int estimatedNrTraces() const { return estnrtrcs_; }
50 
51  void toSupported(DataCharacteristics&) const;
52  void usePar(const IOPar&);
53 
54  const SEGY::TxtHeader* txtHeader() const { return txthead_; }
55  const SEGY::BinHeader& binHeader() const { return binhead_; }
56  const SEGY::TrcHeader& trcHeader() const { return trchead_; }
57  void setTxtHeader(SEGY::TxtHeader*);
58  void setForcedRev( int rev ) { forcedrev_ = rev; }
59  void setForceRev0( bool yn ) { forcedrev_ = yn ? 0 : 1; }
60 
61  int dataBytes() const;
62  int forcedRev() const { return forcedrev_; }
63  bool rev0Forced() const { return forcedrev_ == 0; }
64  SEGY::FilePars& filePars() { return filepars_; }
65  SEGY::FileReadOpts& fileReadOpts() { return fileopts_; }
66  const unsigned char* blockBuf() const { return blockbuf_; }
67 
68  virtual bool implManagesObjects( const IOObj* ) const
69  { return true; }
70  void cleanUp();
71 
73  { coordsys_.set( crs ); }
74 
75 protected:
76 
81  SEGY::TrcHeader& trchead_; // must be *after* fileopts_
85 
86  bool useinpsd_;
87  TraceDataInterpreter* storinterp_; //Will be removed after 6.2
88  unsigned char headerbuf_[mSEGYTraceHeaderBytes];
89  bool headerdone_; //Will be in base class after 6.2
90 
91  // Following variables are inited by commitSelections
92  unsigned char* blockbuf_; //Will be removed after 6.2
94  TargetComponentData* outcd_;
95 
96  inline StreamConn& sConn() { return *(StreamConn*)conn_; }
97 
98  bool commitSelections_();
99  virtual bool initRead_();
100  virtual bool initWrite_(const SeisTrc&);
101  virtual bool writeTrc_(const SeisTrc&);
102 
103  bool readTraceHeadBuffer();
104  bool readDataToBuf();
105  bool readData(SeisTrc&);
106  bool writeData(const SeisTrc&);
107  virtual bool readTapeHeader();
108  virtual void updateCDFromBuf();
109  virtual void interpretBuf(SeisTrcInfo&);
110  virtual bool writeTapeHeader();
111  virtual void fillHeaderBuf(const SeisTrc&);
112  void selectWriteDataChar(DataCharacteristics&) const;
113  void fillErrMsg(const uiString&, bool);
114  bool noErrMsg();
115 
116  DataCharacteristics getDataChar(int) const;
117  int nrFormatFor(const DataCharacteristics&) const;
118  void addWarn(int,const char*);
119  const char* getTrcPosStr() const;
120  bool tryInterpretBuf(SeisTrcInfo&);
121  bool skipThisTrace(SeisTrcInfo&,int&);
122 
123  int curtrcnr_, prevtrcnr_;
124  BinID curbid_, prevbid_;
125  float curoffs_, prevoffs_;
132 
133 private:
134 
136 
137  virtual bool readData(TraceData* externalbuf);
138 
139 };
140 
141 
142 #endif
#define mExpClass(module)
Definition: commondefs.h:160
Definition: segyhdr.h:148
SEGY::FileReadOpts & fileReadOpts()
Definition: segytr.h:65
Summary for a Seismic object.
Definition: segydirectdef.h:23
Definition: ioobj.h:58
unsigned char * blockbuf_
Definition: segytr.h:92
SEGY::OffsetCalculator offsetcalc_
Definition: segytr.h:126
400 byte SEG-Y binary header
Definition: segyhdr.h:80
void setForceRev0(bool yn)
Definition: segytr.h:59
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
virtual bool readData(TraceData *externalbuf)
RefMan< Coords::CoordSystem > coordsys_
Definition: segytr.h:131
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:188
TargetComponentData * outcd_
Definition: segytr.h:94
bool headerdone_
Definition: segytr.h:89
bool rev0Forced() const
Definition: segytr.h:63
SEGY::TxtHeader * txthead_
Definition: segytr.h:79
Definition: segyfiledef.h:104
#define mSEGYTraceHeaderBytes
Definition: segytr.h:29
const unsigned char * blockBuf() const
Definition: segytr.h:66
SEGY::BinHeader & binhead_
Definition: segytr.h:80
SEGY::FileReadOpts fileopts_
Definition: segytr.h:78
const LinScaler * curtrcscale_
Definition: segytr.h:83
Definition: segytr.h:32
Definition: uistring.h:89
A cartesian coordinate in 2D space.
Definition: coord.h:25
Definition: coordsystem.h:31
ComponentData * inpcd_
Definition: segytr.h:93
BinID prevbid_
Definition: segytr.h:124
Definition: segyfiledef.h:55
void setCoordSys(Coords::CoordSystem *crs)
Definition: segytr.h:72
Byte-level data interpreter.
Definition: cbvswriter.h:22
Definition: segydirecttr.h:150
SEGY::FilePars & filePars()
Definition: segytr.h:64
int estimatedNrTraces() const
Definition: segytr.h:49
BendPoints2Coords * bp2c_
Definition: segytr.h:128
const SEGY::BinHeader & binHeader() const
Definition: segytr.h:55
int estnrtrcs_
Definition: segytr.h:129
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
Definition: seistrctr.h:90
void setForcedRev(int rev)
Definition: segytr.h:58
byte-level data characteristics of stored data.
Definition: datachar.h:37
bool useinpsd_
Definition: segytr.h:86
Information for one component.
Definition: seistrctr.h:101
Information for a seismic trace, AKA trace header info.
Definition: seisinfo.h:27
bool othdomain_
Definition: segytr.h:130
SEGY::FilePars filepars_
Definition: segytr.h:77
Coord curcoord_
Definition: segytr.h:127
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:30
Seismic trace.
Definition: seistrc.h:34
float prevoffs_
Definition: segytr.h:125
TraceDataInterpreter * storinterp_
Definition: segytr.h:87
3200 byte SEG-Y text header.
Definition: segyhdr.h:40
const SEGY::TrcHeader & trcHeader() const
Definition: segytr.h:56
virtual const char * defExtension() const
Definition: segytr.h:38
LinScaler * trcscale_
Definition: segytr.h:82
Keys that should be used with od_process_segyio.cc.
Definition: segybatchio.h:22
virtual bool implManagesObjects(const IOObj *) const
Definition: segytr.h:68
Definition: segyfiledef.h:166
const SEGY::TxtHeader * txtHeader() const
Definition: segytr.h:54
SEGY::TrcHeader & trchead_
Definition: segytr.h:81
Inter/Extra-polate bendpoints to get the coordinates.
Definition: bendpoints2coords.h:31
Connection with an underlying iostream.
Definition: streamconn.h:26
int forcedrev_
Definition: segytr.h:84
A set of data buffers and their interpreters.
Definition: tracedata.h:32
StreamConn & sConn()
Definition: segytr.h:96
int numberFormat() const
Definition: segytr.h:48
int prevtrcnr_
Definition: segytr.h:123
int forcedRev() const
Definition: segytr.h:62
Linear scaling.
Definition: scaler.h:55
#define isTranslator(spec, clss)
Definition: transl.h:230

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