Class SoVRSegyFileReader
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.misc.SoBase
-
- com.openinventor.inventor.fields.SoFieldContainer
-
- com.openinventor.ldm.readers.SoVolumeReader
-
- com.openinventor.volumeviz.readers.SoVRSegyFileReader
-
- All Implemented Interfaces:
SafeDisposable
public class SoVRSegyFileReader extends SoVolumeReader
SEGY file format reader. Reader for SEGY files (SEG Y revision 1). The following data types are supported: unsigned or signed byte, short, int32, and float.SEGY is a widely used format for storing seismic trace data, defined by the Society of Exploration Geophysicists publication "Digital Tape Standards" (
http://www.seg.org ). The VolumeViz reader supports all sizes of integer and float data, and can correctly determine the number of samples per trace in most cases.The data will be mapped to the Open Inventor axes as follows:
- The trace length is mapped onto the Inventor X axis (time).
- The number of trace sensors per line is mapped onto the Inventor Y axis (inlines).
- Z is the number of lines (crosslines).
Although in most cases the SEGY reader can automatically detect if the number of traces per line in a SEGY file is not uniform, in some cases it cannot. However, be aware that the initialization for file reading will take longer when this environment variable is set. Missing data is assigned the value zero.
Although in most cases the SEGY reader can automatically detect if the length of traces in a SEGY data file is not uniform, in some cases it cannot. However, be aware that the initialization for file reading will take significantly longer when this environment variable is set. Missing data is assigned the value zero.
In most cases the SEGY reader can automatically detect if the values in the file need to be "byte swapped", for example if the data was written on a "big-endian" machine (e.g., SPARC) and is being read on a "little-endian" machine (e.g., Intel). If necessary you can force byte swapping on or off using the environment variable IVVR_SEGY_SWAPBYTES.
A value of 1 in the format field of the SEGY header normally means that the data values were written in IBM floating point format. But in some cases the values were actually written in IEEE floating point format (which should be indicated by format = 5). Normally the SEGY reader is able to detect this, but if necessary you can specify that float values are in IEEE format by setting environment variable IVVR_SEGY_FLOATISIEEE.
If the SEGY reader fails to read the file correctly, you can set the following environment variables:
- IVVR_SEGY_DEBUG=1 This outputs information of what the reader is actually doing.
- IVVR_SEGY_DUMP=filename This requests that some information of the file and trace headers be written to the specified file while processing the SEGY data file. All these information can be sent to the VSG support for assitance.
Limitations: In some circontances few first traces might be skipped, typically when the first line contains only one trace (this trace might be skipped). In such a case a message warns the application of how many traces are actually skipped (throught
SoDebugError
).See
SoPreferences
for information on using environment variables.In some cases information such as line numbers and crossline numbers will be stored in non-standard locations in the header. Applications can specify the byte position of values within the header using the
setSegyTraceHeaderBytePosition()
method.
Example :SoVRSegyFileReader reader = new SoVRSegyFileReader(); SoVRSegyTraceHeaderBytePosition bytePos = new SoVRSegyTraceHeaderBytePosition(); bytePos.setBytePosition(SoVRSegyTraceHeaderBytePosition.TraceAttributes.SEGY_INLINE , 189); bytePos.setBytePosition(SoVRSegyTraceHeaderBytePosition.TraceAttributes.SEGY_CROSSLINE, 193); reader.setSegyTraceHeaderBytePosition(bytePos); reader.setFilename(theFilePath); Information about the range of inline / crossline numbers and the range of time values can be queried using the
getInlineRange()
,getCrosslineRange()
andgetZRange()
methods.Applications can use this class to open a SEGY file and extract information from the file directly (in other words without necessarily creating a volume data node). To get the SEGY text file header call
getSegyTextHeader()
. To get the SEGY binary file header callgetSegyFileHeader()
. To get the header of a specific trace callgetSegyTraceHeader()
. To get the values in a specific trace call getSegyTraceData().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SoVRSegyFileReader.SegyAxisOrders
SegY axis order mode.static class
SoVRSegyFileReader.SegyByteOrders
Segy byte order mode.static class
SoVRSegyFileReader.SegyScanningResps
SoSegyScanningCB return code.-
Nested classes/interfaces inherited from class com.openinventor.ldm.readers.SoVolumeReader
SoVolumeReader.Axis, SoVolumeReader.CoordinateTypes, SoVolumeReader.DataInfo, SoVolumeReader.ReadErrors, SoVolumeReader.ReaderTypes
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoVRSegyFileReader()
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]
getCrosslineRange()
Gets the crossline range.int[]
getInlineRange()
Gets the inline range.int
getNumTraces()
Returns the number of traces.SbVec2d[]
getP1P2P3Coordinates()
Gets the P1, P2, P3 and P4 coordinates.SoVRSegyFileReader.SegyAxisOrders
getSegyAxisOrder()
Get the storage order for X, Y, and Z axis.SoVRSegyFileReader.SegyByteOrders
getSegyByteOrder()
Gets the byte ordering to use when reading the SEGY file.SoVRSegyFileHeader
getSegyFileHeader()
Calls getSegyFileHeader((boolean)false).SoVRSegyFileHeader
getSegyFileHeader(boolean readFile)
Gets the SEGY file header.java.lang.String
getSegyTextHeader()
Retreives the textual header (the first 3200-bytes) of the SEGY file.SoVRSegyTraceIdHeader
getSegyTraceHeader(int traceNumber)
Gets the SEGY trace header of the given trace traceNumber .SoVRSegyTraceHeaderBytePosition
getSegyTraceHeaderBytePosition()
Gets the byte positions within the trace header.SbVec2d
getTraceCoord(int i, int j)
int[]
getZRange()
Gets the Z (time axis range.boolean
isSegyRegular()
Sets the trace header of a specific trace used to read the SEGY file [OPTIONAL].void
setCrosslineRange(int from, int to, int step)
Sets the crossline range.void
setInlineRange(int from, int to, int step)
Sets the inline range.void
setSegyAxisOrder(SoVRSegyFileReader.SegyAxisOrders axisOrder)
Sets the storage order for X, Y, and Z axes.void
setSegyByteOrder(SoVRSegyFileReader.SegyByteOrders byteOrder)
Sets the byte ordering to use when reading the SEGY file.boolean
setSegyFileHeader(SoVRSegyFileHeader fileHeader)
Specifies the header used to read the SEGY file.void
setSegyTextHeaderAscii(boolean ascii)
Tells whether the textual header format is ASCII or not.void
setSegyTraceHeaderBytePosition(SoVRSegyTraceHeaderBytePosition traceHeaderBytePosition)
Tells the file reader where the fields are actually located (i.e., the byte positions) within the trace header.static void
setVolumeSizeVoxels(boolean flag)
If true, the volume extent (bounds in world coordinates) is set to 0 to dimension-1 on each axis.void
setZRange(int from, int to, int step)
Sets the Z (time axis) range.-
Methods inherited from class com.openinventor.ldm.readers.SoVolumeReader
closeAllHandles, getAppropriateReader, getBorderFlag, getConfiguredWriter, getCoordinateType, getDataChar, getDirectCoordSys, getDirectCoordSysAutoDetection, getDoubleMinMax, getFilename, getIntMinMax, getMinMax, getNumSignificantBits, getNumVoxels, getOriginalFilename, getReaderType, getSizeToAllocate, getSubSlice, getTileMinMax, getTileSize, isDataConverted, isIgnoredFile, isRGBA, isThreadSafe, readTile, readTile, reloadTileMinMax, restoreAllHandles, setDirectCoordSysAutoDetection, setDirectCoorSys, setFilename, setInputDataRange, setOutputDataType, setRectilinearCoordinates, setRGBA
-
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
-
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable, touch
-
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
-
-
-
Method Detail
-
getSegyFileHeader
public SoVRSegyFileHeader getSegyFileHeader()
Calls getSegyFileHeader((boolean)false).
-
isSegyRegular
public boolean isSegyRegular()
Sets the trace header of a specific trace used to read the SEGY file [OPTIONAL]. Indicates if SEGY file is regular. A file with the same number of traces in each inline and with the same number of samples for each trace is considered as regular.
-
setVolumeSizeVoxels
public static void setVolumeSizeVoxels(boolean flag)
If true, the volume extent (bounds in world coordinates) is set to 0 to dimension-1 on each axis. Else the volume extent is normalized to fit inside a unit cube centered at the origin. In other words, the size will be -.5 to +.5 along the longest dimension. false by default. The application can also set the volume extent to whatever is appropriate by setting theSoVolumeData
node's extent field.
-
getCrosslineRange
public int[] getCrosslineRange()
Gets the crossline range. This method returns the actual values from the file if the corresponding set method has not been called previously. Otherwise, the values previously specified withsetCrosslineRange
are returned.
-
getSegyTraceHeaderBytePosition
public SoVRSegyTraceHeaderBytePosition getSegyTraceHeaderBytePosition()
Gets the byte positions within the trace header.
-
setSegyTraceHeaderBytePosition
public void setSegyTraceHeaderBytePosition(SoVRSegyTraceHeaderBytePosition traceHeaderBytePosition)
Tells the file reader where the fields are actually located (i.e., the byte positions) within the trace header. Only the field SEGY_CDP is used (Xline position).
-
getSegyFileHeader
public SoVRSegyFileHeader getSegyFileHeader(boolean readFile)
Gets the SEGY file header. If you use this class to read a SEGY file directly, you will have to call the methodSoVolumeReader.setFilename()
first. Returns false if the operation fails, for example, ifSoVolumeReader.setFilename()
was not called first. If readFile is true the file header is read from the file, otherwise the value set bysetSegyFileHeader()
is returned instead. If readFile is false butsetSegyFileHeader()
was never called, the file header is read from the file anyway.
-
getInlineRange
public int[] getInlineRange()
Gets the inline range. This method returns the actual values from the file if the corresponding set method has not been called previously. Otherwise, the values previously specified withsetInlineRange
are returned.
NOTE: If the inline values are incorrect in the file, or are not retrieved correctly for any reason, getInlineRange returns (1, numLines, 1).
-
getSegyTraceHeader
public SoVRSegyTraceIdHeader getSegyTraceHeader(int traceNumber)
Gets the SEGY trace header of the given trace traceNumber . traceNumber can range from zero to the number of traces minus one. If you use this class to read a SEGY file directly, you will have to call the methodSoVolumeReader.setFilename()
first. Returns false if the operation fails, for example, ifSoVolumeReader.setFilename()
was not called first.
-
setCrosslineRange
public void setCrosslineRange(int from, int to, int step)
Sets the crossline range. Note that this setting does not limit the amount of data read from the file (although a subclass could do that). It just specifies the range values that will be returned bygetCrosslineRange()
.
-
setInlineRange
public void setInlineRange(int from, int to, int step)
Sets the inline range. Note that this setting does not limit the amount of data read from the file (although a subclass could do that). It just specifies the range values that will be returned bygetInlineRange()
.
-
setZRange
public void setZRange(int from, int to, int step)
Sets the Z (time axis) range. Note that this setting does not limit the amount of data read from the file (although a subclass could do that). It just specifies the range values that will be returned bygetZRange()
.
-
getNumTraces
public int getNumTraces()
Returns the number of traces. If the file is not regular (seeisSegyRegular()
), an approximate number (considering it as regular) is returned (to avoid scanning the whole file).
-
getSegyAxisOrder
public SoVRSegyFileReader.SegyAxisOrders getSegyAxisOrder()
Get the storage order for X, Y, and Z axis. SeesetSegyAxisOrder()
.
-
setSegyByteOrder
public void setSegyByteOrder(SoVRSegyFileReader.SegyByteOrders byteOrder)
Sets the byte ordering to use when reading the SEGY file. The default value is SEGY_LITTLE_ENDIAN. In most cases, even when the SEGY file is big endian, the SEGY file reader is able to detect this and read the file accordingly. This method is for the very rare case when the automatic byte order detection fails.
-
getSegyTextHeader
public java.lang.String getSegyTextHeader()
Retreives the textual header (the first 3200-bytes) of the SEGY file.
-
setSegyTextHeaderAscii
public void setSegyTextHeaderAscii(boolean ascii)
Tells whether the textual header format is ASCII or not. The default value is false, i.e., the textual header format is EBCDIC
-
getTraceCoord
public SbVec2d getTraceCoord(int i, int j)
-
setSegyFileHeader
public boolean setSegyFileHeader(SoVRSegyFileHeader fileHeader)
Specifies the header used to read the SEGY file. If this method is called, the reader uses the binary file header you pass rather than the actual binary file header. The following fields from the binary file header are used:- formatRevisionNumber
- numTextHeaderExt
- format
- fixedLengthTraceFlag
- hns (number of samples per trace)
Returns false if the operation fails, for example, if
SoVolumeReader.setFilename()
was not called first.
-
getZRange
public int[] getZRange()
Gets the Z (time axis range. This method returns the actual values from the file if the corresponding set method has not been called previously. Otherwise, the values previously specified withsetZRange
are returned.
-
getP1P2P3Coordinates
public SbVec2d[] getP1P2P3Coordinates()
Gets the P1, P2, P3 and P4 coordinates. P1, P2 are on the corners corresponding to the first line. P4, P3 are on the corners corresponding to the last line. If these points do not exist, the crossline and inline values are used instead. Returns true for a right-handed coordinate system (Xline/Inline/Time).
-
setSegyAxisOrder
public void setSegyAxisOrder(SoVRSegyFileReader.SegyAxisOrders axisOrder)
Sets the storage order for X, Y, and Z axes.
For example, XYZ_AS_INLINE_CROSSLINE_SAMPLE means lines along X, crosslines along Y, and samples along Z axis.The default value is XYZ_AS_SAMPLE_INLINE_CROSSLINE, meaning samples along X, lines along Y, and crosslines along Z axis.
Note: You must call this method before:
- Calling getDataChar()
- Calling setFilename(), or
- Setting the reader in an
SoVolumeData
node.
(Because the last two operations indirectly cause getDataChar() to be called.)
-
getSegyByteOrder
public SoVRSegyFileReader.SegyByteOrders getSegyByteOrder()
Gets the byte ordering to use when reading the SEGY file.
-
-