OMF-VTK¶
A VTK interface for the Open Mining Format package (omf
) providing
Python 3D visualization.
Installation¶
Installation is simply:
pip install omfvista
All necessary dependencies will be installed alongside omfvista
. Please
note that this package heavily leverages the vista package.
Questions & Support¶
For general use questions, please join @OpenGeoVis on our Slack workspace
under the #omfvista
channel. To inquire with the creators of omfvista
,
please email info@opengeovis.org.
Example Use¶
Be sure to check out the Example Notebook that demos omfvista
!
Here’s an example using the sample data hosted in the OMF repository.
import vista
import omfvista
project = omfvista.load_project('test_file.omf')
project

Once the data is loaded as a vista.MultiBlock
dataset from omfvista
, then
that object can be directly used for interactive 3D visualization from vista
:
project.plot(notebook=False)
Or an interactive scene can be created and manipulated to create a compelling figure directly in a Jupyter notebook. First, grab the elements from the project:
# Grab a few elements of interest and plot em up!
vol = project['Block Model']
assay = project['wolfpass_WP_assay']
topo = project['Topography']
dacite = project['Dacite']
Then apply a filtering tool from vista
to the volumetric data:
thresher = vista.Threshold(vol)

Then you can put it all in one environment!
# Grab the active plotting window
# from the thresher tool
p = thresher.plotter
# Add our datasets
p.add_mesh(topo, cmap='gist_earth', opacity=0.5)
p.add_mesh(assay, color='blue', line_width=3)
p.add_mesh(dacite, color='yellow', opacity=0.6)
# Add the bounds axis
p.show_bounds()

And once you like what the render view displays, you can save a screenshot:
p.screenshot('wolfpass.png')

About OMF-VTK¶
- Author: Bane Sullivan
- License: BSD-3-Clause
- Copyright: 2019, Bane Sullivan
- Version: 0.1.0
omfvista
: 3D visualization for the Open Mining Format (omf)
Line Set¶
Methods to convert line set objects to VTK data objects
Line Set to VTK¶
-
omfvista.lineset.
line_set_to_vtk
(lse)[source]¶ Convert the line set to a
vista.PolyData
data object.Parameters: lse ( omf.lineset.LineSetElement
) – The line set to convertReturns: vista.PolyData
Point Set¶
Methods to convert point set objects to VTK data objects
Point Set to VTK¶
-
omfvista.pointset.
point_set_to_vtk
(pse)[source]¶ Convert the point set to a
vista.PolyData
data object.Parameters: pse ( omf.pointset.PointSetElement
) – The point set to convertReturns: vista.PolyData
Surface¶
Methods to convert surface objects to VTK data objects
Surface Geometry to VTK¶
-
omfvista.surface.
surface_geom_to_vtk
(surfgeom)[source]¶ Convert the triangulated surface to a
vista.UnstructuredGrid
objectParameters: surfgeom ( omf.surface.SurfaceGeometry
) – the surface geomotry to convert
Surface Grid Geometry to VTK¶
-
omfvista.surface.
surface_grid_geom_to_vtk
(surfgridgeom)[source]¶ Convert the 2D grid to a
vista.StructuredGrid
object.Parameters: surfgridgeom ( omf.surface.SurfaceGridGeometry
) – the surface grid geometry to convert
Surface to VTK¶
-
omfvista.surface.
surface_to_vtk
(surfel)[source]¶ Convert the surface to a its appropriate VTK data object type.
Parameters: surfel ( omf.surface.SurfaceElement
) – the surface element to convert
Volume¶
Methods for converting volumetric data objects
Volume Grid Geometry to VTK¶
-
omfvista.volume.
volume_grid_geom_to_vtk
(volgridgeom)[source]¶ Convert the 3D gridded volume to a
vista.StructuredGrid
(or avista.RectilinearGrid
when apprropriate) object contatining the 2D surface.Parameters: volgridgeom ( omf.volume.VolumeGridGeometry
) – the grid geometry to convert
Volume to VTK¶
-
omfvista.volume.
volume_to_vtk
(volelement)[source]¶ Convert the volume element to a VTK data object.
Parameters: volelement ( omf.volume.VolumeElement
) – The volume element to convert
Wrapper¶
This module provides a wrapper that will work for any OMF data object or project files.
Example Use¶
Use the wrapper provided in omfvista
to wrap any omf
data object:
import omfvista
omfvista.wrap(data)
Here’s an example using the sample data hosted in the OMF repository.
import omf
import omfvista
# Read all elements
reader = omf.OMFReader('test_file.omf')
project = reader.get_project()
# Iterate over the elements and add converted VTK objects to dictionary:
data = dict()
for e in project.elements:
d = omfvista.wrap(e)
data[e.name] = d
Or better yet, just use the project loader:
import omfvista
data = omfvista.load_project('test_file.omf')
Load Project File¶
Project to VTK¶
-
omfvista.wrapper.
project_to_vtk
(project)[source]¶ Converts an OMF project (
omf.base.Project
) to avista.MultiBlock
data boject
The Wrapper¶
-
omfvista.wrapper.
wrap
(data)[source]¶ Wraps the OMF data object/project as a VTK data object. This is the primary function that an end user will harness.
Parameters: data – any OMF data object Example
>>> import omf >>> import omfvista
>>> # Read all elements >>> reader = omf.OMFReader('test_file.omf') >>> project = reader.get_project()
>>> # Iterate over the elements and add converted VTK objects to dictionary: >>> data = dict() >>> for e in project.elements: >>> d = omfvista.wrap(e) >>> data[e.name] = d