OpendTect-6_4  6.4
segyfiledef.h
Go to the documentation of this file.
1 #ifndef segyfiledef_h
2 #define segyfiledef_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert
9  Date: Sep 2008
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "seismod.h"
16 #include "filespec.h"
17 #include "coord.h"
18 #include "samplingdata.h"
19 #include "seistype.h"
20 #include "segythdef.h"
21 #include "binid.h"
22 #include "coordsystem.h"
23 #include "survinfo.h"
24 
25 class IOObj;
26 class Scaler;
27 class SeisTrcInfo;
28 
29 
30 namespace SEGY
31 {
32 class TrcHeader;
33 
34 
35 /*\brief Definition of input / output file(s) */
36 
38 {
39 public:
40 
41  FileSpec( const char* fnm=0 )
42  : ::FileSpec(fnm) {}
43  FileSpec( const IOPar& iop )
44  : ::FileSpec(iop) {}
45 
46  IOObj* getIOObj(bool temporary) const;
47 
48  static void fillParFromIOObj(const IOObj&,IOPar&);
49 
50 };
51 
52 
53 /*\brief Parameters that control the primary read/write process */
54 
56 {
57 public:
58  FilePars( bool forread=true )
59  : ns_(0)
60  , fmt_(forread?0:1)
61  , byteswap_(0)
62  , forread_(forread)
63  , coordsys_(SI().getCoordSystem()) {}
64 
65  int ns_;
66  int fmt_;
67  int byteswap_;
68 
69  bool swapHdrs() const { return byteswap_ > 1; }
70  bool swapData() const
71  { return byteswap_ == 1 || byteswap_ == 2; }
72  void setSwap( bool hdr, bool data )
73  { byteswap_ = hdr ? (data?2:3) : (data?1:0); }
74 
75  static int nrFmts( bool forread ) { return forread ? 6 : 5; }
76  static const char** getFmts(bool forread);
77  static const char* nameOfFmt(int fmt,bool forread);
78  static int fmtOf(const char*,bool forread);
79 
80  static const char* sKeyForceRev0();
81  static const char* sKeyRevision();
82  static const char* sKeyNrSamples();
83  static const char* sKeyNumberFormat();
84  static const char* sKeyByteSwap();
85 
86  void setForRead(bool);
87 
88  void fillPar(IOPar&) const;
89  bool usePar(const IOPar&);
90  void getReport(IOPar&,bool isrev0) const;
92  { coordsys_ = crs; }
93  ConstRefMan<Coords::CoordSystem> getCoordSys() const { return coordsys_; }
94 protected:
95 
96  bool forread_;
98 
99 };
100 
101 
102 /*\brief Options that control the actual read process */
103 
105 {
106 public:
107 
108  FileReadOpts(Seis::GeomType gt=Seis::Vol);
109 
110  Seis::GeomType geomType() const { return geom_; }
111  void setGeomType(Seis::GeomType);
112 
113  enum ICvsXYType { Both=0, ICOnly=1, XYOnly=2 };
114  enum PSDefType { InFile=0, SrcRcvCoords=1, UsrDef=2 };
115  enum CoordDefType { Present=0, ReadFile=1, Generate=2 };
116 
117  bool forread_;
119  float coordscale_;
120  float timeshift_;
121  float sampleintv_;
123 
126 
129 
134 
135  void scaleCoord(Coord&,const Scaler* s=0) const;
136  float timeShift(float) const;
137  float sampleIntv(float) const;
138 
139  static const char* sKeyCoordScale();
140  static const char* sKeyTimeShift();
141  static const char* sKeySampleIntv();
142  static const char* sKeyICOpt();
143  static const char* sKeyHaveTrcNrs();
144  static const char* sKeyTrcNrDef();
145  static const char* sKeyPSOpt();
146  static const char* sKeyOffsDef();
147  static const char* sKeyCoordOpt();
148  static const char* sKeyCoordStart();
149  static const char* sKeyCoordStep();
150  static const char* sKeyCoordFileName();
151 
152  void fillPar(IOPar&) const;
153  bool usePar(const IOPar&);
154  void getReport(IOPar&,bool isrev0) const;
155  static void shallowClear(IOPar&);
156 
157 protected:
158 
160 
161 };
162 
163 
164 /*\brief Determines offset as specified by user */
165 
167 {
168 public:
170  : type_(FileReadOpts::InFile)
171  , def_(0.f,1.f)
172  , is2d_(false)
173  , coordscale_(1.0f) { reset(); }
174  void set(const FileReadOpts&);
175 
176  void reset();
177 
180  bool is2d_;
181  float coordscale_;
182 
183  void setOffset(SeisTrcInfo&,const TrcHeader&) const;
184 
185 protected:
186 
187  mutable float curoffs_;
188  mutable BinID prevbid_;
189 
190 };
191 
192 
193 
194 } // namespace SEGY
195 
196 
197 #endif
float coordscale_
Definition: segyfiledef.h:181
stores HdrEntry info of the needed fields from the trace header.
Definition: segythdef.h:30
#define mExpClass(module)
Definition: commondefs.h:160
Definition: segyhdr.h:148
Summary for a Seismic object.
Definition: segydirectdef.h:23
ICvsXYType icdef_
Definition: segyfiledef.h:122
Definition: ioobj.h:58
SamplingData< float > def_
Definition: segyfiledef.h:179
BufferString coordfnm_
Definition: segyfiledef.h:133
SamplingData< float > offsdef_
Definition: segyfiledef.h:128
ConstRefMan< Coords::CoordSystem > coordsys_
Definition: segyfiledef.h:97
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:188
bool swapData() const
Definition: segyfiledef.h:70
Seis::GeomType geom_
Definition: segyfiledef.h:159
Definition: segyfiledef.h:104
bool havetrcnrs_
Definition: segyfiledef.h:124
int ns_
Definition: segyfiledef.h:65
TrcHeaderDef thdef_
Definition: segyfiledef.h:118
A cartesian coordinate in 2D space.
Definition: coord.h:25
PSDefType
Definition: segyfiledef.h:114
Definition: coordsystem.h:31
Definition: segyfiledef.h:55
GeomType
Definition: seistype.h:33
static int nrFmts(bool forread)
Definition: segyfiledef.h:75
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
PSDefType psdef_
Definition: segyfiledef.h:127
FileSpec(const IOPar &iop)
Definition: segyfiledef.h:43
ConstRefMan< Coords::CoordSystem > getCoordSys() const
Definition: segyfiledef.h:93
float coordscale_
Definition: segyfiledef.h:119
FilePars(bool forread=true)
Definition: segyfiledef.h:58
Information for a seismic trace, AKA trace header info.
Definition: seisinfo.h:27
Scaling of floating point numbers.
Definition: scaler.h:33
FileReadOpts::PSDefType type_
Definition: segyfiledef.h:178
int fmt_
Definition: segyfiledef.h:66
BinID prevbid_
Definition: segyfiledef.h:188
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:175
const SurveyInfo & SI()
bool swapHdrs() const
, 0=no 1=data only 2=all 3=only hdrs
Definition: segyfiledef.h:69
CoordDefType
Definition: segyfiledef.h:115
Coord startcoord_
Definition: segyfiledef.h:131
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
bool forread_
Definition: segyfiledef.h:117
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:30
ICvsXYType
Definition: segyfiledef.h:113
Definition: seistype.h:33
void setCoordSys(const Coords::CoordSystem *crs)
Definition: segyfiledef.h:91
FileSpec(const char *fnm=0)
Definition: segyfiledef.h:41
Seis::GeomType geomType() const
Definition: segyfiledef.h:110
bool forread_
Definition: segyfiledef.h:96
Coord stepcoord_
Definition: segyfiledef.h:132
OffsetCalculator()
Definition: segyfiledef.h:169
Keys that should be used with od_process_segyio.cc.
Definition: segybatchio.h:22
float sampleintv_
Definition: segyfiledef.h:121
Definition: segyfiledef.h:166
void setSwap(bool hdr, bool data)
Definition: segyfiledef.h:72
float timeshift_
Definition: segyfiledef.h:120
CoordDefType coorddef_
Definition: segyfiledef.h:130
int byteswap_
Definition: segyfiledef.h:67
float curoffs_
Definition: segyfiledef.h:187
Definition: segyfiledef.h:37
bool is2d_
Definition: segyfiledef.h:180
SamplingData< int > trcnrdef_
Definition: segyfiledef.h:125

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