Skip to main content

The package for morphological analysis and visualization of fibrous materials.

Project description

docs/source/_static/logo.png Documentation Status

Quanfima (quantitative analysis of fibrous materials) is a collection of useful functions for morphological analysis and visualization of 2D/3D data from various areas of material science. The aim is to simplify the analysis process by providing functionality for frequently required tasks in the same place.

More examples of usage you can find in the documentation.

  • Analysis of fibrous structures by tensor-based method in 2D / 3D datasets.
  • Estimation of structure diameters in 2D / 3D by a ray-casting method.
  • Counting of particles in 2D / 3D datasets and providing a detailed report in pandas.DataFrame format.
  • Calculation of porosity measure for each material in 2D / 3D datasets.
  • Visualization in 2D / 3D using matplotlib, visvis packages.


The easiest way to install the latest version is by using pip:

$ pip install quanfima

You may also use Git to clone the repository and install it manually:

$ git clone
$ cd quanfima
$ python install


Open a grayscale image, perform segmentation, estimate porosity, analyze fiber orientation and diameters, and plot the results.

import numpy as np
from skimage import io, filters
from quanfima import morphology as mrph
from quanfima import visualization as vis
from quanfima import utils

img = io.imread('../data/polymer_slice.tif')

th_val = filters.threshold_otsu(img)
img_seg = (img > th_val).astype(np.uint8)

# estimate porosity
pr = mrph.calc_porosity(img_seg)
for k,v in pr.items():
  print 'Porosity ({}): {}'.format(k, v)

# prepare data and analyze fibers
data, skeleton, skeleton_thick = utils.prepare_data(img_seg)
cskel, fskel, omap, dmap, ovals, dvals = \
                    mrph.estimate_fiber_properties(data, skeleton)

# plot results
vis.plot_orientation_map(omap, fskel, min_label=u'0°', max_label=u'180°',
vis.plot_diameter_map(dmap, cskel, figsize=(10,10), cmap='gist_rainbow',
>> Porosity (Material 1): 0.845488888889
docs/source/_static/2d_polymer_data.png docs/source/_static/2d_polymer_orientation_map_600px.png docs/source/_static/2d_polymer_diameter_map_600px.png

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for quanfima, version 0.1a3
Filename, size File type Python version Upload date Hashes
Filename, size quanfima-0.1a3-py2-none-any.whl (5.0 MB) File type Wheel Python version py2 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page