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 your voxel data.  This easy-to-use standardised dialog provides all the math expression options on a single tabbed dialog.

See the Application Notes below for information on 'master voxels', and how to use spatial coordinates (i.e. X,Y,Z) as voxel math variables.

Voxel Math dialog options

Step 1: Enter a mathematical expression, alternatively build the expression through the use of the buttons and tabs located below the expression box.

Expression

Enter the math expression in this box. The syntax is straightforward and based on the C programming language. The expression can contain any combination of functions and operators, absolute and/or variable voxel names, dummies and numbers, spanning over multiple equations. The expression can either be directly typed in, or built using the supplied Variables, Operators and Functions tabs.

For further details see Expression Box under Application Notes.

Click this button to expand and display the available Operators and Functions with which to build the Voxel Math Expression.

Use the keyboard to enter numerical values.

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

Common Keys - Buttons consisting of the most commonly used operations and values are groups along the left, right below Operators and Functions.

Frequent Tab - Frequently used conditional and logarithmic operators and functions.

Special Tab - Special limit and mathematical functions.

Trig Tab - Trigonometry functions.

Statistics Tab - Statistical properties of one or more lines.

Surfaces Tab - Surfaces operators. Grids are now supported in the same manner as open surfaces and can similarly be used.

Click this button to add a new grid variable at the location of the cursor 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 location of the cursor in the Expression box. The variable voxel naming convention is V#, where the # is the next available number.

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

See Use Surfaces in Voxel Math Expressions for more information on using this feature.

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

Assign voxels, grids and surfaces:

This box is populated with all the variables present in the Expression. Each variable can be set either by choosing a file from the drop-down list of the recently used files in the current project, or through the browse button you can navigate and select the appropriate file(s).

The tool distinguishes between input and output Voxels. Input files must exist and are preceded by , while you can enter the output file name.

To introduce a Vector Voxel in the math equation, simply proceed as with a Voxel but use the "Vector Voxel filter" to list the files of the desired type.

For further details, see the Applications Notes below.

Common tasks

Use his drop-down list to select from the most common 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 then if needed continue to further edit it.

Expression file

Once you have built the expression you can save it to file for future use. Similarly if you have previously saved expressions, you can load them from file.

The expression files are simple ASCII text files and can be viewed outside of Oasis montaj using a text editor.

Click on Clear to clear all the entries, expression, grids, surfaces, voxels and expression file.

Click on Apply to apply the expression without exiting the dialog. This button is useful when you intend to apply the same expression to multiple voxels.

Applications Notes

*The GX tool will search in the "...\Geosoft\Desktop Applications \gx" folder. The GX.Net tools, however, are embedded in the geogxnet.dll 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" folder, then supply the GX.Net tool in the specified format.

Expressions are parsed from right to left, for example, in the conditional expression V0 = (condition)?V2:V3, it is the data type of the rightmost channel, V3, that defines the data type of the output.

Expression

Longer more complex expressions spanning over multiple lines will remain in view. As you add new rows to the Expression box, the height of the box automatically increases to show up to 12 lines, upon which a scroll bar appears along the right margin of the expression box.

To further increase the vertical height of the box, while the focus is on the expression box, hover the cursor over the top or bottom edge of the dialog until you see the double arrows. Then, click and drag the edge of the dialog, and the expression box will grow accordingly.

When working with long expressions you can widen the dialog by hovering the cursor over the left or right edge of the dialog until you see the double arrow. Then, click and drag the edge of the dialog to the appropriate size.

Assign Voxels, Grids, and Surfaces

To further increase the vertical height of this box, while the focus is on it, hover the cursor over the top or bottom edge of the dialog until you see the double arrows. Then, click and drag the side of the dialog, and the Assign grids box will grow accordingly.

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

Voxel Math Example

The nested equation below results in the output voxel VO where all elements that intercept the 5 section grids are set to 1, while all other voxels are set to DUMMY. Such an equation could 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 and is used to determine the geometry (size, projection and data type) of the output voxel. All other input voxels, grids and/or surfaces will be sampled and reprojected if they do not match the Master Voxel. The Master Voxel is typically the first input Voxel and can be identified as bolded (e.g. V1) in the Assign voxels, grids and surfaces window. When you mouse over the bolded variable the popup message, "This input is the master input" appears.

For example:

Special Case:

If you do not want the first input Voxel to be the Master you can specify a separate Master Voxel by appending its name to the end of the expression. For example, if you have the Voxel expression, V0 = V1 + V2; then V1 will typically be the Master Voxel (bolded). However, if you want to specify your own Master Voxel you can specify, V0 = V1 + V2; VM; and the VM will be your new Master Voxel (bolded).

Only certain operations are logically possible on vector voxels. If you attempt to perform an impermissible operation on a vector voxel, you will receive a message indicating it and the operation will not be performed.

The permissible operations are:

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

An expression similar to the one below is not supported:

VV0 = VV1 / VV2
Using Spatial Coordinates (i.e. X,Y,Z) as Voxel Math Variables

The following Voxel Math Expression generates a Voxel (3D grid) that tapers linearly from a value of 3 in the center (0, 25000, -7350) to values of zero at the edges of the Voxel. The image below shows the resulting Voxel. You can use similar expressions to edit the values in a Voxel or to smoothly merge two voxels.

//V0=.\demo2.geosoft_voxel
//vm=.\top_salt.geosoft_voxel
V0 = 3*(1-abs(x)/25000)*(1-abs(y-25000)/25000)*(1-abs(z+7350)/7300);
vm;

../image/spatialcoordinates.png

Temporary Variable Definition

You can define temporary variables in a math expression. These only exist during the computation stage and are not saved on output. Temporary variables are defined by preceding them with the @ symbol (i.e @Var1). Multiple temporary variables can be added to an expression. To define grid, voxel and surface variables, simply precede them with the @ symbol.