OpendTect  6.6
segyuiscandata.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: July 2015
9  RCS: $Id: $
10 ________________________________________________________________________
11 
12 -*/
13 
14 #include "uisegycommon.h"
15 #include "ranges.h"
16 #include "bufstring.h"
17 #include "datachar.h"
18 #include "namedobj.h"
19 #include "survinfo.h"
20 #include "refcount.h"
21 
22 class SeisTrcInfo;
23 class DataClipSampler;
24 class uiParent;
25 class TaskRunner;
26 namespace Coords { class CoordSystem; }
27 namespace PosInfo { class Detector; }
28 
29 
30 namespace SEGY
31 {
32 
33 class FilePars;
34 class TrcHeader;
35 class TrcHeaderDef;
36 class FileReadOpts;
37 class HdrEntryKeyData;
38 class OffsetCalculator;
39 
40 
45 public:
46 
48  void init();
49 
50  int revision_;
51  int binns_; // nr samples binary header
52  int binsr_; // sample rate (us or mm)
53  int ns_; // nr samples trace header
54  short format_;
58 
59  bool isValid() const { return ns_ > 0; }
60  bool isRev0() const { return revision_ < 1;}
61  int bytesPerSample() const;
62  int traceDataBytes() const;
65  { return sampling_.interval(ns_); }
66 
68  int nrTracesIn(const od_istream&,od_stream_Pos p=-1) const;
70  uiString getFrom(od_istream&,bool& zinft,
71  const bool* knownhdrswap=0);
74 
75  virtual void getFilePars(FilePars&) const;
76 
77 protected:
78 
79  virtual const TrcHeaderDef& getHDef() const; // returns default
80 
81 };
82 
83 
86 mExpClass(uiSEGYTools) LoadDef : public BasicFileInfo
87 {
88 public:
89 
92  LoadDef(const LoadDef&);
93  LoadDef& operator =(const LoadDef&);
94  void reInit(bool alsohdef);
95 
96  float coordscale_;
105 
107 
109  bool getData(od_istream&,char*,float* vals=0) const;
110  TrcHeader* getTrace(od_istream&,char*,float*) const;
111  bool skipData(od_istream&) const;
113  const OffsetCalculator&) const;
114 
115  virtual void getFilePars(FilePars&) const;
117  void usePar(const IOPar&);
119  { coordsys_ = crs; }
121  { return coordsys_; }
122  bool needXY() const;
123 
124 protected:
125 
126  virtual const TrcHeaderDef& getHDef() const { return *hdrdef_; }
128 
129 };
130 
131 
135 {
136 public:
137  ScanRangeInfo() { reInit(); }
138 
147 
148  void reInit();
149  void use(const PosInfo::Detector&);
150  void merge(const ScanRangeInfo&);
151 };
152 
153 
156 mExpClass(uiSEGYTools) ScanInfo
157 {
158 public:
159 
160  ScanInfo(const char* fnm,bool is2d);
162 
163  BasicFileInfo& basicInfo() { return basicinfo_; }
164 
165  void getFromSEGYBody(od_istream&,const LoadDef&,bool surv,
168 
169  void merge(const ScanInfo&);
170 
171  const char* fileName() const { return filenm_; }
172  bool is2D() const;
173  bool isEmpty() const { return nrtrcs_ < 1; }
174  int nrTraces() const { return nrtrcs_; }
175  bool isFull() const { return full_; }
176 
177  const HdrEntryKeyData& keyData() const { return keydata_; }
178  const ScanRangeInfo& ranges() const { return rgs_; }
179  const PosInfo::Detector& piDetector() const { return *pidetector_; }
180  const BasicFileInfo& basicInfo() const { return basicinfo_; }
181 
182 protected:
183 
189  int nrtrcs_;
191  bool full_;
192 
194 
195  void reInit() { init( is2D() ); }
196  void addTrace(TrcHeader&,const float*,const LoadDef&,
198  int trcidx);
199  void addTraces(od_istream&,Interval<int>,char*,float*,
200  const LoadDef&,DataClipSampler&,
201  const OffsetCalculator&);
202  bool addNextTrace(od_istream&,char*,float*,
203  const LoadDef&,DataClipSampler&,
204  const OffsetCalculator&);
205  void ensureStepsFound(od_istream&,char*,float*,
206  const LoadDef&,DataClipSampler&,
207  const OffsetCalculator&);
208  void addValues(DataClipSampler&,const float*,int);
209 
210 private:
211 
212  void init(bool);
214 
215  friend class FullUIScanner;
216 
217 };
218 
219 
222 mExpClass(uiSEGYTools) ScanInfoSet : public NamedObject
223 {
224 public:
225 
226  ScanInfoSet(bool is2d,bool isps);
228 
229  void setEmpty();
230  ScanInfo& add(const char* fnm);
231  void removeLast();
232  void setInFeet( bool yn ) { infeet_ = yn; }
233  void finish();
234 
235  bool is2D() const { return is2d_; }
236  bool isEmpty() const { return size() < 1; }
237  int nrTraces() const { return nrtrcs_; }
238  bool inFeet() const { return infeet_; }
239  bool isFull() const;
240  const BasicFileInfo& basicInfo() const;
241  const PosInfo::Detector& piDetector() const { return detector_; }
242  const HdrEntryKeyData& keyData() const { return keydata_; }
243  const ScanRangeInfo& ranges() const { return rgs_; }
244 
245  int size() const { return sis_.size(); }
246  const ScanInfo& scanInfo( int i ) const { return *sis_[i]; }
247 
248 protected:
249 
251  bool is2d_;
252  bool isps_;
253  bool infeet_;
254  int nrtrcs_;
258 
259 };
260 
261 
262 } // namespace SEGY
263 
264 
SEGY::LoadDef::LoadDef
LoadDef(const LoadDef &)
SEGY::ScanInfoSet::rgs_
ScanRangeInfo rgs_
Definition: segyuiscandata.h:256
ConstRefMan< Coords::CoordSystem >
SEGY::ScanInfoSet::detector_
PosInfo::Detector & detector_
Definition: segyuiscandata.h:257
NamedObject
object with a name.
Definition: namedobj.h:42
SEGY::OffsetCalculator
Definition: segyfiledef.h:166
SEGY::BasicFileInfo::sampling_
SamplingData< float > sampling_
Definition: segyuiscandata.h:55
Strat::init
void init()
SEGY::ScanInfoSet::~ScanInfoSet
~ScanInfoSet()
SEGY::ScanInfo::basicInfo
BasicFileInfo & basicInfo()
Definition: segyuiscandata.h:163
SEGY::LoadDef::hdrdef_
TrcHeaderDef * hdrdef_
Definition: segyuiscandata.h:106
SEGY::ScanInfoSet::removeLast
void removeLast()
SEGY::BasicFileInfo::format_
short format_
Definition: segyuiscandata.h:54
SeisTrcInfo
Information for a seismic trace, AKA trace header info.
Definition: seisinfo.h:27
datachar.h
SEGY::BasicFileInfo::dataswapped_
bool dataswapped_
Definition: segyuiscandata.h:57
SEGY::ScanInfoSet::is2D
bool is2D() const
Definition: segyuiscandata.h:235
SEGY::ScanInfo::nrTraces
int nrTraces() const
Definition: segyuiscandata.h:174
SEGY::LoadDef::usenrsampsinfile_
bool usenrsampsinfile_
Definition: segyuiscandata.h:102
SEGY::HdrEntryKeyData
header key info collected by scanning SEG-Y file
Definition: segyhdrkeydata.h:80
ObjectSet
Set of pointers to objects.
Definition: commontypes.h:31
SEGY::ScanRangeInfo::crls_
Interval< int > crls_
Definition: segyuiscandata.h:142
SEGY::ScanInfo::pidetector_
PosInfo::Detector * pidetector_
Definition: segyuiscandata.h:185
SEGY::ScanRangeInfo::inls_
Interval< int > inls_
Definition: segyuiscandata.h:141
SEGY::ScanInfo::basicinfo_
BasicFileInfo basicinfo_
Definition: segyuiscandata.h:187
SEGY::ScanInfo::addValues
void addValues(DataClipSampler &, const float *, int)
SEGY::FilePars
Definition: segyfiledef.h:55
SEGY::ScanInfo::reInit
void reInit()
Definition: segyuiscandata.h:195
SEGY::ScanInfo::keydata_
HdrEntryKeyData & keydata_
Definition: segyuiscandata.h:186
SEGY::ScanRangeInfo::xrg_
Interval< double > xrg_
Definition: segyuiscandata.h:139
SEGY::BasicFileInfo::isValid
bool isValid() const
Definition: segyuiscandata.h:59
SEGY::BasicFileInfo::getDataChar
DataCharacteristics getDataChar() const
SEGY::LoadDef::trcnrdef_
SamplingData< int > trcnrdef_
Definition: segyuiscandata.h:99
SEGY::ScanInfo::ScanInfo
ScanInfo(const char *fnm, bool is2d)
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
SEGY::ScanInfo::merge
void merge(const ScanInfo &)
SEGY::ScanInfo::isFull
bool isFull() const
Definition: segyuiscandata.h:175
od_istream
OD class for stream read common access to the std::cin.
Definition: od_istream.h:24
SamplingData::interval
StepInterval< T > interval(IT nrsamples) const
Definition: samplingdata.h:117
namedobj.h
SEGY::ScanInfoSet::infeet_
bool infeet_
Definition: segyuiscandata.h:253
SEGY::LoadDef::getUserCoordSys
ConstRefMan< Coords::CoordSystem > getUserCoordSys()
Definition: segyuiscandata.h:120
SEGY::LoadDef
definition for SEG-Y loading
Definition: segyuiscandata.h:87
SEGY::FileReadOpts::PSDefType
PSDefType
Definition: segyfiledef.h:113
PosInfo::Detector
Determines many geometry parameters from a series of Coords with corresponding BinID or trace numbers...
Definition: posinfodetector.h:53
SEGY::BasicFileInfo::nrTracesIn
int nrTracesIn(const od_istream &, od_stream_Pos p=-1) const
SEGY::BasicFileInfo::mODTextTranslationClass
mODTextTranslationClass(BasicFileInfo)
SEGY::ScanRangeInfo::ScanRangeInfo
ScanRangeInfo()
Definition: segyuiscandata.h:137
uisegycommon.h
SEGY::ScanInfo::~ScanInfo
~ScanInfo()
SEGY::LoadDef::setUserCoordSys
void setUserCoordSys(Coords::CoordSystem *crs)
Definition: segyuiscandata.h:118
SEGY::BasicFileInfo::BasicFileInfo
BasicFileInfo()
Definition: segyuiscandata.h:47
SEGY::ScanInfoSet::sis_
ObjectSet< ScanInfo > sis_
Definition: segyuiscandata.h:250
SEGY::ScanInfo::basicInfo
const BasicFileInfo & basicInfo() const
Definition: segyuiscandata.h:180
SEGY::ScanInfoSet::setEmpty
void setEmpty()
SEGY::ScanInfo::fileName
const char * fileName() const
Definition: segyuiscandata.h:171
SEGY::LoadDef::getTrace
TrcHeader * getTrace(od_istream &, char *, float *) const
od_stream_Pos
od_int64 od_stream_Pos
Definition: od_iosfwd.h:20
SEGY::ScanInfoSet::setInFeet
void setInFeet(bool yn)
Definition: segyuiscandata.h:232
SEGY::ScanInfo::nrtrcs_
int nrtrcs_
Definition: segyuiscandata.h:189
SEGY::ScanRangeInfo::use
void use(const PosInfo::Detector &)
bufstring.h
SEGY::ScanRangeInfo::azims_
Interval< float > azims_
Definition: segyuiscandata.h:146
SEGY::BasicFileInfo::hdrsswapped_
bool hdrsswapped_
Definition: segyuiscandata.h:56
SEGY::LoadDef::havetrcnrs_
bool havetrcnrs_
Definition: segyuiscandata.h:98
SEGY::BasicFileInfo::bytesPerSample
int bytesPerSample() const
SEGY::LoadDef::psoffsdef_
SamplingData< float > psoffsdef_
Definition: segyuiscandata.h:101
SEGY::LoadDef::~LoadDef
~LoadDef()
SEGY::ScanInfo::finishGet
void finishGet(od_istream &)
SEGY::LoadDef::getTrcInfo
void getTrcInfo(TrcHeader &, SeisTrcInfo &, const OffsetCalculator &) const
SEGY::BasicFileInfo::isRev0
bool isRev0() const
Definition: segyuiscandata.h:60
SEGY::ScanInfoSet::isFull
bool isFull() const
StepInterval< float >
SEGY::BasicFileInfo::ns_
int ns_
Definition: segyuiscandata.h:53
SEGY::ScanInfo::startpos_
od_stream_Pos startpos_
Definition: segyuiscandata.h:193
SEGY::ScanInfo::init
void init(bool)
SEGY::ScanInfoSet::ScanInfoSet
ScanInfoSet(bool is2d, bool isps)
SEGY::ScanInfo::ensureStepsFound
void ensureStepsFound(od_istream &, char *, float *, const LoadDef &, DataClipSampler &, const OffsetCalculator &)
SEGY::ScanInfoSet::nrTraces
int nrTraces() const
Definition: segyuiscandata.h:237
SEGY::BasicFileInfo::getHDef
virtual const TrcHeaderDef & getHDef() const
SEGY::TrcHeaderDef
stores HdrEntry info of the needed fields from the trace header.
Definition: segythdef.h:30
SEGY::ScanRangeInfo::merge
void merge(const ScanRangeInfo &)
SEGY::LoadDef::reInit
void reInit(bool alsohdef)
SEGY::LoadDef::getHDef
virtual const TrcHeaderDef & getHDef() const
Definition: segyuiscandata.h:126
SEGY::ScanInfoSet::ranges
const ScanRangeInfo & ranges() const
Definition: segyuiscandata.h:243
SEGY::LoadDef::usePar
void usePar(const IOPar &)
SEGY::BasicFileInfo::getFilePars
virtual void getFilePars(FilePars &) const
SEGY::ScanInfo
info collected by scanning a SEG-Y file
Definition: segyuiscandata.h:157
SEGY::BasicFileInfo::init
void init()
SEGY::TrcHeader
Definition: segyhdr.h:149
SEGY::BasicFileInfo::getFrom
uiString getFrom(od_istream &, bool &zinft, const bool *knownhdrswap=0)
SEGY::ScanInfoSet::is2d_
bool is2d_
Definition: segyuiscandata.h:251
SEGY::LoadDef::coordsys_
ConstRefMan< Coords::CoordSystem > coordsys_
Definition: segyuiscandata.h:127
SEGY::BasicFileInfo::binsr_
int binsr_
Definition: segyuiscandata.h:52
SamplingData< float >
SEGY::ScanInfoSet::keyData
const HdrEntryKeyData & keyData() const
Definition: segyuiscandata.h:242
SEGY::ScanInfo::rgs_
ScanRangeInfo rgs_
Definition: segyuiscandata.h:188
Coords::CoordSystem
Definition: coordsystem.h:31
TaskRunner
Class that can execute a task.
Definition: task.h:170
SEGY::LoadDef::useformatinfile_
bool useformatinfile_
Definition: segyuiscandata.h:104
SEGY::BasicFileInfo::binns_
int binns_
Definition: segyuiscandata.h:51
SEGY::ScanInfoSet::isps_
bool isps_
Definition: segyuiscandata.h:252
SEGY::ScanInfoSet::finish
void finish()
SEGY::ScanRangeInfo::reInit
void reInit()
SEGY::LoadDef::getPrepared
LoadDef getPrepared(od_istream &) const
SEGY::ScanInfoSet
set of SEG-Y Scan Infos
Definition: segyuiscandata.h:223
Coords
Definition: coordsystem.h:22
DataClipSampler
Data clipping sampler.
Definition: dataclipper.h:134
SEGY::BasicFileInfo::getZRange
StepInterval< float > getZRange() const
Definition: segyuiscandata.h:64
SEGY::ScanInfo::filenm_
BufferString filenm_
Definition: segyuiscandata.h:184
SEGY::ScanInfo::keyData
const HdrEntryKeyData & keyData() const
Definition: segyuiscandata.h:177
SEGY::BasicFileInfo::revision_
int revision_
Definition: segyuiscandata.h:50
BufferString
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size.
Definition: bufstring.h:40
SEGY::ScanInfoSet::piDetector
const PosInfo::Detector & piDetector() const
Definition: segyuiscandata.h:241
SEGY::BasicFileInfo::traceDataBytes
int traceDataBytes() const
SEGY::LoadDef::getData
bool getData(od_istream &, char *, float *vals=0) const
survinfo.h
SEGY::ScanInfo::ranges
const ScanRangeInfo & ranges() const
Definition: segyuiscandata.h:178
SEGY::ScanRangeInfo::trcnrs_
Interval< int > trcnrs_
Definition: segyuiscandata.h:143
SEGY::ScanInfoSet::isEmpty
bool isEmpty() const
Definition: segyuiscandata.h:236
uiString
String that is able to hold international (UTF-8) strings for the user interface.
Definition: uistring.h:121
SEGY::BasicFileInfo::getTrcHdr
TrcHeader * getTrcHdr(od_istream &) const
PosInfo
Position info, often segmented.
Definition: posinfo.h:40
SEGY::ScanInfoSet::inFeet
bool inFeet() const
Definition: segyuiscandata.h:238
SEGY::ScanInfo::addTrace
void addTrace(TrcHeader &, const float *, const LoadDef &, DataClipSampler &, const OffsetCalculator &, int trcidx)
SEGY::ScanInfo::addTraces
void addTraces(od_istream &, Interval< int >, char *, float *, const LoadDef &, DataClipSampler &, const OffsetCalculator &)
SEGY::FileReadOpts
Definition: segyfiledef.h:104
SEGY::LoadDef::usezsamplinginfile_
bool usezsamplinginfile_
Definition: segyuiscandata.h:103
SEGY::BasicFileInfo::goToTrace
bool goToTrace(od_istream &, od_stream_Pos, int) const
SEGY::ScanInfo::isEmpty
bool isEmpty() const
Definition: segyuiscandata.h:173
SEGY::ScanInfoSet::basicInfo
const BasicFileInfo & basicInfo() const
SEGY::ScanInfo::is2D
bool is2D() const
SEGY
Keys that should be used with od_process_segyio.cc.
Definition: segybatchio.h:22
SEGY::ScanRangeInfo::offs_
Interval< float > offs_
Definition: segyuiscandata.h:145
SEGY::LoadDef::coordscale_
float coordscale_
Definition: segyuiscandata.h:96
SEGY::ScanRangeInfo::refnrs_
Interval< float > refnrs_
Definition: segyuiscandata.h:144
SEGY::FileReadOpts::ICvsXYType
ICvsXYType
Definition: segyfiledef.h:112
refcount.h
SEGY::LoadDef::getFileReadOpts
void getFileReadOpts(FileReadOpts &) const
Pick::is2D
bool is2D(const PicksType &picks)
ObjectSet of Pick::Location's. Does not manage.
Definition: pickset.h:163
SEGY::LoadDef::getFilePars
virtual void getFilePars(FilePars &) const
SEGY::ScanRangeInfo::yrg_
Interval< double > yrg_
Definition: segyuiscandata.h:140
SEGY::ScanInfoSet::size
int size() const
Definition: segyuiscandata.h:245
SEGY::LoadDef::LoadDef
LoadDef()
uiParent
Definition: uiparent.h:26
SEGY::ScanInfo::idxfirstlive_
int idxfirstlive_
Definition: segyuiscandata.h:190
SEGY::ScanInfo::piDetector
const PosInfo::Detector & piDetector() const
Definition: segyuiscandata.h:179
SEGY::BasicFileInfo
Basic data from a SEG-Y fle.
Definition: segyuiscandata.h:44
ranges.h
SEGY::ScanInfo::getFromSEGYBody
void getFromSEGYBody(od_istream &, const LoadDef &, bool surv, DataClipSampler &, TaskRunner *t=0)
will do full scan if TaskRunner passed
SEGY::ScanInfo::full_
bool full_
Definition: segyuiscandata.h:191
SEGY::ScanInfo::addNextTrace
bool addNextTrace(od_istream &, char *, float *, const LoadDef &, DataClipSampler &, const OffsetCalculator &)
Interval< double >
SEGY::ScanInfoSet::nrtrcs_
int nrtrcs_
Definition: segyuiscandata.h:254
SEGY::ScanRangeInfo
range info collected by scanning SEG-Y file
Definition: segyuiscandata.h:135
SEGY::LoadDef::icvsxytype_
FileReadOpts::ICvsXYType icvsxytype_
Definition: segyuiscandata.h:97
SEGY::LoadDef::needXY
bool needXY() const
SEGY::LoadDef::psoffssrc_
FileReadOpts::PSDefType psoffssrc_
Definition: segyuiscandata.h:100
SEGY::ScanInfoSet::add
ScanInfo & add(const char *fnm)
does not open anything
IOPar
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:55
SEGY::LoadDef::skipData
bool skipData(od_istream &) const
DataCharacteristics
byte-level data characteristics of stored data.
Definition: datachar.h:37
SEGY::ScanInfoSet::scanInfo
const ScanInfo & scanInfo(int i) const
Definition: segyuiscandata.h:246
SEGY::ScanInfoSet::keydata_
HdrEntryKeyData & keydata_
Definition: segyuiscandata.h:255

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