Explore the unlimited possibilities for processing your data with Amira-Avizo Software and PerGeos Software Python Integration
Amira-Avizo Software and PerGeos Software integrate python 3.5. Many packages are available including Numpy and Scipy. Numpy is an extension for handling multi-dimensional array, which allows for elementwise operations, comparisons, logical operations, and statistics among others. Scipy is an extension that provides a toolbox for scientific computing such as interpolation, integration, image processing, linear algebra, signal processing, and statistics. Creating additional GUIs is also supported for e.g. viewing plots with Matplotlib or creating your own interface with PyQt. For advanced image analysis, scientific packages such as opencv, keras, tensorflow, pytorch or scikit_learn are available in the Thermo Scientific standard bundle.
While providing a long list of packages, the Amira-Avizo Software and PerGeos Software python integration is not limited to those being installed by default. The package manager allows the user to create multiple self-contained Python environments with their own Python executable and set of packages. Each self-contained environment can then be used by Avizo Software.
Amira-Avizo Software and PerGeos Software python integration enables you to use Python tools with the same performance and similar memory consumption inside of Amira-Avizo Software and PerGeos Software as would be expected from any other modern standalone Python release. With its memory sharing technology, Amira-Avizo Software and Thermo Fisher Scientific Python are tightly integrated.
Fast development of advanced Amira-Avizo Software PerGeos Software python processing modules
Similar to TCL, Python has been implemented in Amira-Avizo Software and Pergeos Software using a Pythonic API. Commands specific to Amira-Avizo Software and Pergeos Software allow you to access information and functionalities contained within Amira-Avizo Software and Pergeos Software modules. There are two main ways to interact with Amira-Avizo Software and Pergeos Software using Python:
1. The first way to use Python is through the Python console, which is separate from the TCL console. This is an integrated interpreter which includes completion.
2. The second and most powerful way is through script modules. Script modules act like regular modules in Avizo Software and can be accessed in the Object Popup menu.
Script module loaded in Amira-Avizo Software
Script module loaded in PerGeos Software
Amira-Avizo Software and Pergeos Software provides multiple ressources to quickly learn how to integrate Python functionalities in your processing workflows such as documentation, tutorials and script module examples.
Using Python Algorithm in Amira-Avizo Software and Pergeos Software
In the following section we highlight some usage of algorithms and technologies from the Python eco-system in Amira-Avizo Software and Pergeos Software:
Deep learned neural networks have proved to be an invaluable tool for many research and industrial purposes in recent years. Using deep learning for processing images allows to go beyond traditional image processing results. Thanks to the Amira-Avizo Software and Pergeos Software’s python integration, deep learning workflows are possible within Amira-Avizo Software and Pergeos Software.
Users can configure a deep learning environment to use on their preferred DL package (Keras, TensorFlow, PyTorch). They can then train their own model for future prediction.
OpenPNM is a python open source pore network modeling package. Unlike Amira-Avizo Software and Pergeos Software’s PNM technologies which allows to compute a pore network model from a scanned image to extract its properties, OpenPNM allows building theoretical networks from scratch based on a given set of statistical properties. This is proved to be extremely useful for material science applications to study which parameter can optimize a given material’s performance based on various simulations.
With Amira-Avizo Software and Pergeos Software’s python integration, it is possible to explore a wide range of network topologies and simulations with the Python OpenPNM library. For example, individual networks can be stitched together to form a single modeling domain. This feature can be used to model the various domain of a fuel cell battery and simulate phase transport.
It is also possible to generate a pore network model in Avizo from an actual scanned data and load it in OpenPNM to run various simulations.
Three cubic networks stitched together with regular and irregular pore volumes. The networks are generated in OpenPNM and visualized in Avizo Software.
To install Open PNM in a python environment, you may refer to the amira-avizo or PerGeos user’s guide. Briefly you will need to install the necessary library using pip in your preferred python environement:
- edm shell -e my_python_env
- pip install openpnm==1.7.0
Providing that the python environment is set to the my_python_env environment, OpenPNM is now directly available from within the Amira Python console or a pyscro script.
Code example showing how to use openPNM from a pyscro module:
The example shown here highlights a weakly/incomplete supervised learning where the user provides only sparse labels that need to be classified. It can be adapted to a robust workflow to train a model for specific rock types and to be reused later. This workflow is based on open source python API used within the Amira-Avizo Software and Pergeos Software framework thanks to the python 3.5 interpreter.
Users can load a dataset of their choice and navigate to the segmentation workroom and use the Interactive Brush to add supervised labels to the features in the image to segment on a slice.
Shale/EagleFord sample :
Below we highlight some python code training a classifier and executed within the Pergeos application through a .pyscro file:
Training a classifier:
Here the slice by slice testing/prediction example code:
Classified 3 phase segmentation result into Grains (Light blue), Organic matter(Dark blue) and Pores (Red)
Sandstone example with 3 phase user labels :
Classified output showing porosity and high density grains (L) and the sample in grayscale (R):
It is possible to use Graphics User Interface windows from within Amira-Avizo Software python environnement.
It can either be created in a pyscro script for advanced use or directly from within the python console. Here is an example showing how easy it is to visualize the histogram of a data loaded in the pool:
Application and use cases
In this example, we use opencv and matplotlib to automatically calculate an optimized parameter for thresholding the data based on various metrics. This technique ensures an accurate and objective selection of the high intensity phase.
In some cases it is beneficial to optimize binarization parameters by using the image itself to compute the threshold level (maximum entropy or mutual information between greyscale and binary) . The otsu method is a good example of this kind of auto-thresholding. The same methodology can be extrapolated to other binarization algorithms (i.e. top-hat, watershed, ...) or binary mask manipulation (erosion, opening, ...) associated with an image transformation (i.e. an image in which the separation power will be calculated). The general principle of such a tool has been easily prototyped in a pyscro script.
Below is a simple example of thresholding using entropy or mutual information by using the image itself to compute the optimized threshold level. The thresholding is done based on OpenCV. Matplotlib allows to visualize the metric value based on the current threshold used. The automated optimized parameter is at the maximum of the curve.
Qt is set of cross-platform C++ libraries that implement high-level APIs for accessing many aspects of modern desktop and mobile systems. PyQt5 is a comprehensive set of Python bindings for Qt v5. It is implemented as more than 35 extension modules.
Amira-Avizo Software and Pergeos Software are fully compatible with PyQt and allow creating PyQt applets in its own environment.
The screenshot below is based on a pyscro script creating a PyQt applet. This applet creates a scatter plot of measures stored in a label-analysis.