Voxel Math Expression Builder

Use the Voxel > Voxel Math menu option (geogxnet.dll(Geosoft.GX.MathExpressionBuilder.MathExpressionBuilder;RunVoxel)*) to create, save, load, and execute math expressions for voxel data.  This easy-to-use, standardised dialog provides all the math expression options within a single, tabbed interface.

See the Application Notes below for details on "master voxels" and utilizing spatial coordinates (X, Y, Z) as voxel math variables.

Voxel Math dialog options

Step 1:Enter a mathematical expression manually or build one using the buttons and tabs below the Expression window.

Expression

Enter your mathematical expression in this field. The syntax is straightforward and follows C programming language conventions. The expression can include any combination of functions and operators, absolute and variable grid names, reserved variables, DUMMY values, and numbers, spanning multiple equations. For guidance, refer to the Application Notes, which provide a few examples.

You can enter the expression manually or construct it using the Variables and Operators and Functions tabs. For further details, see the Expression section in the Application Notes.

Click this button to expand and display the available Operators and Functions for building your Voxel Math expression. Use the keyboard to enter numerical values.

For detailed information on operators and functions in this expanded section, click on the links below:

  • Common Keys: Frequently used operations and values, grouped on the left below Operators and Functions.

  • Frequent Tab: Frequently used conditional and logarithmic operators and functions.

  • Special Tab: Specialized limit and mathematical functions.

  • Trig Tab: Trigonometry functions.

  • Statistics Tab: Statistical properties of one or more lines.

  • Surfaces Tab: Surface operators—grids are now supported like open surfaces and can be used in the same way.

Click this button to add a new grid variable at the cursor's location in the Expression box. The variable grid naming convention is G#, where # is the next available number.

Click this button to add a voxel variable at the cursor's location in the Expression box. The variable voxel naming convention is V#, where # is the next available number.

Click this button to add a surface variable at the cursor's location in the Expression box. The variable surface naming convention is S#, where # is the next available number.

For more details on using surfaces in expressions, see Use Surfaces in Voxel Math Expressions.

Step 2: Assign grids, surfaces, and voxels to the variable names used in the expression.

Assign voxels, grids, and surfaces:

This section is populated with all the variables present in the Expression box. Each variable can be assigned either by selecting a file from the drop-down list of recently used files in the current project or by clicking the Browse button to locate and select the appropriate file(s).

The tool distinguishes between input and output voxels:

  • Input files must exist and are prefixed with a character.

  • Output files can be manually entered.

To introduce a vector voxel in the mathematical expression, follow the same process as a regular voxel, but use the Vector Voxel filter to display the relevant file types.

For further details, see the Applications Notes below.

Common tasks

Use the drop-down list to select from frequently used voxel math expressions:

  • Add 2 voxels: V0 = V1 + V2;

  • Divide 2 voxels: V0 = V1 / V2;

  • Multiply 2 voxels: V0 = V1 * V2;

  • Multiply voxel by factor 2: V0 = V1 * 2;

  • Remove 5000 from voxel: V0 = V1 - 5000;

  • Subtract 2 voxels: V0 = V1 - V2;

  • True/False statement: V0 = (V1>5000) ? (V2) : (V3); 

You can select an expression from the list and modify it as needed.

Expression file

Once the expression is created, you can save it for future use. Previously saved expressions can also be loaded from a file.

Expression files are simple ASCII text files and can be opened in any text editor outside of Oasis montaj.

Click on Clear to remove all entries, including the expression, grid assignments, and expression file.

Click on Apply to apply the expression without exiting the dialog, allowing multiple grids to use the same expression.

Applications Notes

If an equation produces a value outside the data range, the output is set to DUMMY.

In Geosoft conventions, the DUMMY value depends on the data type:

  • Signed integer data types: The DUMMY value is set to the minimum value of the corresponding data range.

  • Unsigned integer data types: The DUMMY value is set to the maximum value of the corresponding data range.

  • Floating-point data types: The DUMMY values and data ranges for floating data types do not follow the above conventions. Instead, their values are set outside typical geophysical processing ranges.

ClosedClick the link below to expand and view the Geosoft data ranges and DUMMY values for different data types.

Expression

Expressions are parsed from right to left. For example, in the conditional expression G0 = (condition)?G2:G3, the data type of the rightmost channel, G3, determines the data type of the output.

Longer, more complex expressions spanning multiple lines remain visible as you work. When new rows are added to the Expression box, its height automatically expands to display up to 12 lines. Beyond this, a scroll bar appears along the right margin for navigation.

To further increase the height of the box, while the focus is on the Expression box, hover over the top or bottom edge of the dialog until the double arrow appears. Click and drag the edge of the dialog to resize the box accordingly.

When working with long expressions, the dialog can also be widened. Hover over the left or right edge of the dialog until the double arrow appears, then click and drag to adjust the width as needed.

Assign Voxels, Grids, and Surfaces

To further increase the vertical height of the Assign voxels, grids, and surfaces box, click on an editable entry within the box until it becomes underlined, indicating it is in focus. Then, hover the cursor over the top or bottom edge of the dialog until a double arrow appears. Click and drag the edge to resize the dialog, which will also adjust the height of the Assign voxels, grids, and surfaces box. Note that clicking elsewhere inside the box will not activate the desired resizing function.

You will not see the temporary variable listed in this window.

Voxel Math Example

The nested equation below generates the output VO voxel, where all elements that intercept the five section grids are set to 1, while all other voxels are set to DUMMY.

This type of equation can be used to generate VOXI constraint models.

VO=(G1.intersect)?1:
((G2.intersect)?1:
((G3.intersect)?1:
((G4.intersect)?1:
((G5.intersect)?1:
((G6.intersect)?1:
((G7.intersect)?1:0))))));

Input Section Grids and Overlapping Voxel

Output Voxel Intersection with Section Grids

Master Voxel

The master voxel is required to define the geometry (size, projection, and data type) of the output voxel. Any input voxels, grids and/or surfaces that do not match the master voxel will be sampled and reprojected accordingly.

By default, the master voxel is the first input voxel, displayed in bold (e.g. V1) in the Assign voxels, grids and surfaces window. When you hover over the bolded variable, a popup message appears: "This input is the master input."

For example:

Special case:

If you do not want the first input voxel to be the master, you can explicitly assign a different master voxel by appending its name to the end of the expression.

For example, in the voxel expression:

V0 = V1 + V2

By default, V1 will be the master voxel (bolded). However, to specify a different master voxel, use:

V0 = V1 + V2; VM;

In this case, VM becomes the new master voxel (bolded).

Only certain operations are logically possible on vector voxels. If you attempt an unsupported operation, you will receive an error message, and the operation will not be performed.

Permissible operations:

VV0 = C * VV1
VV0 = VV1 /C
VV0 = C1 * VV1 + C2 * VV2
VV0 = C1 * VV1 - C2 * VV2
VV0 = VV1 * VV2  (dot product = VV1x*VV2x+VV1y*VV2y+VV1z*VV2z)
VV0 =V1 * VV1   (multiply all 3 components by V1)
VV0 = in (VV1, S)?VV1:VV2

Where:

C --> constant
G --> grid
S --> surface
VV --> vector voxel
V --> voxel

Expressions similar to the one below are not supported:

VV0 = VV1 / VV2

Using Spatial Coordinates (X, Y, Z) as Voxel Math Variables

Oasis montaj is spatially aware, providing direct access to location coordinates via the reserved variables X, Y, and Z.

The following expression uses these coordinates to generate a voxel (3D grid) that tapers linearly—starting at a value of 3 at the center (0, 25000, -7350) and decreasing to zero at the voxel's edges.

//V0=.\New_Voxel.geosoft_voxel
//VM=.\Top_Salt.geosoft_voxel
V0 = 3*(1-abs(X)/25000)*(1-abs(Y-25000)/25000)*(1-abs(Z+7350)/7300);
VM;

The image below illustrates the resulting voxel. Similar expressions can be used to modify voxel values or seamlessly merge two voxels.

../image/spatialcoordinates.png

Temporary Variable Definition

Temporary variables can be defined in a math expression. These variables exist only during the computation stage and are not saved in the output. To define a temporary variable, precede it with the "@" symbol (e.g., @Var1). Multiple temporary variables can be incorporated into an expression.

*The GX.NET tools are embedded in the geogxnet.dll file located in the "...\Geosoft\Desktop Applications \bin" folder. If running this GX interactively, bypassing the menu, first change the folder to point to the "bin" directory, then supply the GX.NET tool in the specified format. See the topic Run GX for more details on running a GX.NET interactively.