Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoVRSegyFileReader.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2023 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : G. SEGUIN (Oct 2001)
22**=======================================================================*/
23#ifndef _SO_VR_SEGY_FILE_READER_
24#define _SO_VR_SEGY_FILE_READER_
25
26#include <LDM/readers/SoVolumeReader.h>
27#include <VolumeViz/readers/SoVRSegyReader.h>
28#include <Inventor/STL/vector>
29#include <VolumeViz/nodes/SoVolumeData.h>
30
31#ifdef _WIN32
32#pragma warning( push )
33#pragma warning(disable:4251)
34#endif
35
152{
153 SO_FIELDCONTAINER_HEADER(SoVRSegyFileReader);
154
155 public:
160
164 virtual ReadError getDataChar( SbBox3f &size, SoDataSet::DataType &type, SbVec3i32 &dim ) override;
165
169 virtual void getSubSlice( const SbBox2i32& subSlice, int sliceNumber, void * data );
170
177
185 static void setVolumeSizeVoxels(SbBool flag);
186
192
193
196 // Reader Settings - Step 0
197 //
198
203 virtual int setFilename( const SbString& filename );
204
210
214 typedef SegyScanningResp SoSegyScanningCB( void *data, float percent, SoVRSegyFileReader *reader );
215
225
228 // Reader Settings - Step 1
229 //
230
235 virtual void setSegyTextHeaderAscii( bool ascii );
236
241
244 // Reader Settings - Step 2
245 //
246
253 };
262 virtual void setSegyByteOrder( SegyByteOrder byteOrder );
267
281 virtual SbBool setSegyFileHeader( const SoVRSegyFileHeader &fileHeader );
282
294 virtual SbBool getSegyFileHeader( SoVRSegyFileHeader& fileHeader, bool readFile = false );
295
298 // Reader Settings - Step 3
299 //
300
305 virtual void setSegyTraceHeaderBytePosition( const SoVRSegyTraceHeaderBytePosition &traceHeaderBytePosition );
310
317 virtual int getNumTraces();
318
327 virtual SbBool getSegyTraceHeader( int traceNumber, SoVRSegyTraceIdHeader& traceHeader );
328
332 //void setSegyTraceHeader(int traceNumber, SoVRSegyTraceIdHeader &traceHeader)
333 //{;}
334
337 // Reader Settings - Step 4
338 //
339
346
353 virtual void setCrosslineRange( int from, int to, int step );
360 virtual void setInlineRange( int from, int to, int step );
367 virtual void setZRange( int from, int to, int step );
374 virtual void getCrosslineRange( int &from, int &to, int &step );
383 virtual void getInlineRange( int &from, int &to, int &step );
390 virtual void getZRange( int &from, int &to, int &step );
391
394 // Reader Settings - Step 5
395 //
396
405
416 virtual SbBool setDirectCoorSys( SbBool directCoord );
417
425
440 virtual void setSegyAxisOrder( SegyAxisOrder axisOrder );
441
447
450 // Reader Settings - Step 6
451 //
452
470 virtual int getSegyTraceData( int traceNumber, void* &traceData, int start = 0, int size = -1 );
471
472 /*
473 * Return the (X,Y) coordinates of trace(i,j).
474 */
475 bool getTraceCoord(const int i, const int j, SbVec2d & P );
476
479 // Reader Settings - Step 7
480 //
481
489
498 virtual SbBool setInputDataRange( SbBool doChange, double min, double max );
499
500 //
501 // End Reader Settings
504
505private:
506
507 /*
508 * Converts numValues IBM float values in IEEE float values into the same in/out buffer.
509 */
510 static void ibm2ieee( int numValues, void* ibm2ieeeBuffer );
511
512 private:
513 // settings parameters - step 0
514 SoSegyScanningCB *m_scanningCBfunc;
515 void *m_scanningCBdata;
516
517 // settings parameters - step 1
518 bool m_textHeaderAscii;
519
520 // settings parameters - step 2
521 SegyByteOrder m_byteOrder;
522 bool m_byteOrderSet;
523 bool m_swapBytes; // True if we need to swap the bytes of headers
524 bool m_swapBytesData; // True if we need to swap the bytes of the data samples. Equal to m_swapBytes most of the cases.
525 SoVRSegyFileHeader m_binHeader;
526 bool m_binHeaderSet;
527
528 // settings parameters - step 3
529 SoVRSegyTraceHeaderBytePosition m_trHdrBytePos;
530 bool m_trHdrBytePosSet;
531
532 // settings parameters - step 4
533 bool m_crosslineRangeSet;
534 int m_crosslineFrom, m_crosslineTo, m_crosslineStep;
535 bool m_inlineRangeSet;
536 int m_inlineFrom, m_inlineTo, m_inlineStep;
537 bool m_zRangeSet;
538 int m_zFrom, m_zTo, m_zStep;
539
540 // settings parameters - step 5
541 SegyAxisOrder m_axisOrder;
542
543 // settings parameters - step 7
544 bool m_changeFormat;
545 SoDataSet::DataType m_typeOut;
546 bool m_dataRangeSet;
547 double m_dataRangeMin, m_dataRangeMax;
548
549 // getDataChar1
550 SoVolumeReader::ReadError getDataChar1();
551 bool m_dataChar1;
552 SoVRSegyFileHeader m_wkHeader;
553 int m_headerSize;
554 int m_format;
555 SbString m_typeStr;
556 SoDataSet::DataType m_type;
557 bool m_constantTraceLength;
558 unsigned int m_numSamplesPerTrace;
559 unsigned int m_numTracesPerLine;
560 unsigned int m_numLines;
561 int64_t m_numTraces;
562
563 // getDataChar2
564 SoVolumeReader::ReadError getDataChar2(int t = -1);
565 bool m_dataChar2;
566 std::vector<int64_t> m_traceOffset;
567 std::vector<int> m_traceLength;
568 //int64_t m_numTraces;
569 //unsigned int m_numSamplesPerTrace;
570 SbVec3i32 m_dim; // [0]
571
572 // getDataChar3
573 SoVolumeReader::ReadError getDataChar3();
574 bool m_dataChar3;
575 bool m_regularTraceNum;
576
577 private:
580
581 // True if format=1 in the file header means IEEE float format.
582 // Officially 1 means IBM float format and 5 means IEEE.
583 SbBool m_floatIsIEEE;
584 static bool m_isVolumeSizeVoxels ;
585
586 int getTraceNum( const int, const int );
587 void resetObject();
588 bool searchForPoint( const int which, int & i, int & j, SbVec2d & P );
589 void extrapolatePoint( SbVec2d & P0, int & i0, int & j0,
590 const SbVec2d & Px, int ix, int jx,
591 const SbVec2d & Py, int iy, int jy,
592 int newi0, int newj0 );
593 float evaluateValuesValidity( const int num_values, const float *values );
594 float evaluateValuesCorrelation( const int trace, const int format1, const bool swap1, const int format2, const bool swap2 );
595
596 int m_crosslineMin;
597
598 // For each inline, a list of crossline start/stop pairs.
599 // Only computed if there are missing traces.
600 std::vector<std::vector<int>> m_traceMap;
601};
602
603#ifdef _WIN32
604#pragma warning( pop )
605#endif
606
607#endif // _SO_VR_SEGY_FILE_READER_
608
609
2D box class.
Definition SbBox.h:2383
3D box class.
Definition SbBox.h:649
Class for smart character strings.
Definition SbString.h:202
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 2D vector class ...
Definition SbVec.h:314
3D vector class.
Definition SbVec.h:1517
DataType
Supported data type.
Definition SoDataSet.h:664
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> SEGY file format read...
virtual SoVRSegyTraceHeaderBytePosition getSegyTraceHeaderBytePosition()
Gets the byte positions within the trace header.
virtual void setSegyTextHeaderAscii(bool ascii)
Tells whether the textual header format is ASCII or not.
virtual void setSegyByteOrder(SegyByteOrder byteOrder)
Sets the byte ordering to use when reading the SEGY file.
SoVRSegyFileReader()
Constructor.
virtual int getSegyTraceData(int traceNumber, void *&traceData, int start=0, int size=-1)
Gets the SEGY trace data of the specified trace traceNumber.
virtual SbBool getP1P2P3Coordinates(SbVec2d &P1, SbVec2d &P2, SbVec2d &P3, SbVec2d &P4)
Gets the P1, P2, P3 and P4 coordinates.
virtual SoVolumeReader::ReaderType getReaderType()
Returns the reader type, in this case, the enum value SoVolumeReader::SEGY.
virtual void setCrosslineRange(int from, int to, int step)
Sets the crossline range.
virtual int setFilename(const SbString &filename)
Specifies the path of the file.
virtual SbBool setSegyFileHeader(const SoVRSegyFileHeader &fileHeader)
Specifies the header used to read the SEGY file.
virtual SbBool setInputDataRange(SbBool doChange, double min, double max)
Requests that the input be converted from the specified range to the range depending on the output da...
virtual SegyAxisOrder getSegyAxisOrder()
Get the storage order for X, Y, and Z axis.
virtual void getZRange(int &from, int &to, int &step)
Gets the Z (time axis range.
static void setVolumeSizeVoxels(SbBool flag)
If TRUE, the volume extent (bounds in world coordinates) is set to 0 to dimension-1 on each axis.
virtual void getCrosslineRange(int &from, int &to, int &step)
Gets the crossline range.
virtual SbBool setDirectCoordSysAutoDetection(SbBool autoValue)
Sets whether or not the reader should automatically try to detect if the coordinate system used is di...
virtual SegyByteOrder getSegyByteOrder()
Gets the byte ordering to use when reading the SEGY file.
SegyScanningResp
SoSegyScanningCB return code.
SegyByteOrder
Segy byte order mode.
@ SEGY_LITTLE_ENDIAN
Little endian.
void setScanningProgressCallback(SoSegyScanningCB *func, void *data)
Sets a progress callback when the SEGY file is scanned.
virtual SbBool isSegyRegular()
Sets the trace header of a specific trace used to read the SEGY file [OPTIONAL].
virtual SbBool getSegyFileHeader(SoVRSegyFileHeader &fileHeader, bool readFile=false)
Gets the SEGY file header.
virtual SbString getSegyTextHeader()
Retreives the textual header (the first 3200-bytes) of the SEGY file.
SegyScanningResp SoSegyScanningCB(void *data, float percent, SoVRSegyFileReader *reader)
SoSegyScanningCB Callback type.
SegyAxisOrder
SegY axis order mode.
@ XYZ_AS_INLINE_CROSSLINE_SAMPLE
XYZ_AS_INLINE_CROSSLINE_SAMPLE.
@ XYZ_AS_SAMPLE_INLINE_CROSSLINE
XYZ_AS_SAMPLE_INLINE_CROSSLINE.
virtual SbBool setOutputDataType(SbBool doChange, SoDataSet::DataType type)
Requests that the input be converted (if necessary) to the specified data type.
bool getTraceCoord(const int i, const int j, SbVec2d &P)
virtual ReadError getDataChar(SbBox3f &size, SoDataSet::DataType &type, SbVec3i32 &dim) override
Gets the characteristics (file header) of the data volume.
virtual SbBool setDirectCoorSys(SbBool directCoord)
Specifies if the coordinate system used is direct (right-handed) or not.
virtual void setInlineRange(int from, int to, int step)
Sets the inline range.
virtual void setSegyAxisOrder(SegyAxisOrder axisOrder)
Sets the storage order for X, Y, and Z axes.
virtual void setZRange(int from, int to, int step)
Sets the Z (time axis) range.
virtual SbBool getSegyTraceHeader(int traceNumber, SoVRSegyTraceIdHeader &traceHeader)
Gets the SEGY trace header of the given trace traceNumber .
virtual void setSegyTraceHeaderBytePosition(const SoVRSegyTraceHeaderBytePosition &traceHeaderBytePosition)
Tells the file reader where the fields are actually located (i.e., the byte positions) within the tra...
virtual int getNumTraces()
Returns the number of traces.
virtual void getSubSlice(const SbBox2i32 &subSlice, int sliceNumber, void *data)
Must copy the rectangular part defined by subSlice of the XY slice sliceNumber to the memory refe...
virtual void getInlineRange(int &from, int &to, int &step)
Gets the inline range.
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> SEGY file trace heade...
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Abstract...
virtual ReadError getDataChar(SbBox3f &size, SoDataSet::DataType &type, SbVec3i32 &dim)=0
Gets the characteristics (file header) of the data volume.
ReaderType
Available reader type.
virtual void getSubSlice(const SbBox2i32 &subSlice, int sliceNumber, void *data)
Must copy the rectangular part defined by subSlice of the XY slice sliceNumber to the memory refe...
ReadError
Read error.
int SbBool
Boolean type.
Definition SbBase.h:87
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> SEGY file header.
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> SEGY trace identifica...