siddharth-maddali / HierarchicalSmooth

Implementation of the hierarchical smooth algorithm applicable to voxelated images of interface networks ( grain boundaries, soap foam, etc. )
Other
9 stars 3 forks source link
c-plus-plus dream3d eigen grain-boundaries grains matlab octave python quad-points smoothing

Hierarchical Smoothing

alt tag alt tag

Description

Thie repo contains multiple implementations of the hierarchical smoothing algorithm applicable to voxelated meshes of interface networks. Primarily directed at users of microstructure analysis software, specifically DREAM.3D.

WARNING

It is strongly recommended to compile the C++ version and call it in a Matlab/Octave routine (wrappers are available with the code). The Python and Matlab source codes are basically prototyped versions, and haven't been updated in years. They are definitely slow, not at all optimized and possibly buggy. What Python and Matlab do in a few hours for a large, high-resolution microstructure, C++ can do in a few seconds. I can help with the compilation on a Linux machine; please go through previous issues or open a new one if you run into trouble.

Motivation

  1. Faithfulness to mesoscopically smooth interfaces
  2. Minimum user interference in deciding smoothing parameters
  3. Ability to automate over an entire polycrystal volume
  4. Proper treatment of topological features like grain boundary interiors, triple lines and quad points

Reference (citations are greatly appreciated!)

S. Maddali, S. Ta'asan, R. M. Suter, Topology-faithful nonparametric estimation and tracking of bulk interface networks, Computational Materials Science 125, 328-340 (2016).

Software requirements

Import/Export of data from HDF5

  1. DREAM.3D v6.2 or higher (to import and export ASCII data) OR
  2. HDFView to export from existing DREAM.3D data file

Matlab

  1. Matlab R2013a or higher (extensive use of the triangulation object)

Python

  1. NumPy (>=1.11.2)
  2. SciPy (>=0.18.1)

C++

  1. Eigen - a templated C++ library for linear algebra.
  2. libIGL - a set of very useful algorithms and routines written using Eigen.

Tutorials

These tutorials do not cover the import and export of the required microstructure data relative to DREAM.3D. Included is a sample data set (in the examples/ex2 directory) containing the mesh of a 794-grain microstructure volume. The following steps illustrate the form of the input and implementation of the central HierarchicalSmooth routine. In each tutorial, the working directory is assumed to be that which contains the corresponding source code.

Matlab usage

Python usage

The Python functions were written to mirror the corresponding functions in the Matlab source code as much as possible. Specifically, the primary function HierarchicalSmooth and its auxiliary functions are written in a file HierarchicalSmooth.py which is loaded as a module. A bare-bones version of Matlab's indispensible ismember function is implemented in Base.py. Further, the basic functionality of Matlab's triangulation object is implemented in Triangulation.py. The following steps are the essence of the test script Src/Python/TestSuite/SmoothVolume.py.

C++ usage

The C++ implementation of HierarchicalSmooth is by far the fastest and most efficient of the three available on this repo, and it is highly recommended that you use this instead of the much older and slightly buggy Matlab and Python code. It is built on top of Eigen, which is also the linear algebra package of choice for DREAM.3D.

This section describes how to build the compiled libraries and also how to generate wrappers that allow them to be used in Matlab and Octave. This has been tested for 64-bit Linux systems. The source code is found in the Src/Cpp directory and includes a simple hand-written Makefile to generate the shared and static libraries. The procedure for building the project is as follows:

Acknowledgements

  1. Anthony Rollett (Dept of Materials Science and Engineering, Carnegie Mellon University)
  2. David Menasche (Dept of Physics, Carnegie Mellon University)
  3. Michael Jackson (Bluequartz Software)