props_to_DataFrame#

Extracts the scalar values from a regionprops_3D query and uses them to populate a pandas DataFrame.

import porespy as ps
import numpy as np
import matplotlib.pyplot as plt
import scipy.ndimage as spim
np.random.seed(7)
im = ~ps.generators.overlapping_spheres([100, 100], r=10, porosity=0.6)
plt.imshow(im, origin='lower', interpolation='none');
../../../_images/c49d21ef3cbe7ad17a006f956cd838bae0799e7311b9afb94d753efdb28fd2f8.png
regions = spim.label(im)[0]
props = ps.metrics.regionprops_3D(regions)
plt.imshow(regions, origin='lower', interpolation='none');
../../../_images/8396cb6338687e365eab9563f0db2b852da4eda7702961f68466524a546a6e19.png
df = ps.metrics.props_to_DataFrame(props)
df
label volume bbox_volume sphericity surface_area convex_volume area area_bbox area_convex eccentricity ... euler_number extent feret_diameter_max area_filled axis_major_length axis_minor_length orientation perimeter perimeter_crofton solidity
0 1 270 304 3.377624 59.811131 274 270 304 274 0.535682 ... 1 0.888158 20.615528 270 20.302892 17.144166 -1.570796 58.970563 58.589116 0.985401
1 2 292 352 2.966109 71.760513 301 292 352 301 0.668822 ... 1 0.829545 24.186773 292 22.792054 16.944133 -1.332241 64.384776 63.722113 0.970100
2 3 305 361 2.578463 84.981247 313 305 361 313 0.000000 ... 1 0.844875 20.808652 305 19.710694 19.710694 0.785398 62.627417 62.056032 0.974441
3 4 701 952 1.939290 196.782654 747 701 952 747 0.646067 ... 1 0.736345 35.440090 701 34.990789 26.707805 1.291699 105.840620 103.024717 0.938420
4 5 1237 2205 1.255313 443.927490 1665 1237 2205 1665 0.904394 ... 1 0.560998 63.788714 1237 70.153363 29.934308 1.478716 202.539105 195.878727 0.742943
5 6 255 285 3.677297 52.882927 259 255 285 259 0.611649 ... 1 0.894737 20.615528 255 20.466711 16.191807 0.000000 58.142136 57.803718 0.984556
6 7 641 945 1.932482 186.040405 762 641 945 762 0.933715 ... 1 0.678307 47.434165 641 52.035208 18.629564 -1.383012 124.526912 120.740433 0.841207

7 rows × 21 columns