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

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