module
imea.extract
imea core functions to extract 2D and/or 3D shape measurements from images.
Functions
shape_measurements_2d(bw,spatial_resolution_xy,dalpha,return_statistical_lengths,return_all_chords)(tuple) — Extract 2D rotation and translation invariant shape measurements from a binary image.shape_measurements_3d(img_3d,threshold_mm,spatial_resolution_xy,spatial_resolution_z,dalpha,min_object_area,n_objects_max)(tuple) — Extract 2D and 3D rotation and translation invariant shape measurements from a 3d grayscale image.
function
imea.extract.shape_measurements_3d(img_3d, threshold_mm, spatial_resolution_xy, spatial_resolution_z, dalpha=9, min_object_area=10, n_objects_max=-1)
Extract 2D and 3D rotation and translation invariant shape measurements from a 3d grayscale image.
Parameters
img_3d(numpy.ndarray, type float) — 3d image in grayscale representation (background is zero, grayvalues represent height).threshold_mm(float) — Threshold in millimeters for segmentation ofimg_3d. Pixels <=thresholdare considered as background, pixels >threshold_mmas object (foreground).spatial_resolution_xy(float) — Spatial resolution ofimg_3din x and y direction in [mm/pixel]. Assumes image is already calibrated, i.e. dx = dy, see Notes.spatial_resolution_z(float) — Spatial resolution ofimg_3din z-direction (height) in [mm/grayvalue].dalpha(float, optional) — Angle in degrees by which object is rotated at each iteration, (e. g. for statistical length), by default 9.min_object_area(int, optional) — Minimum area in pixels of a region to be considered as an object, by default 10.n_objects_max(int, optional) — Maximum number of objects to be extracted. Ifn_objects_max=-1, then all objects are extracted, by default -1.
Returns (tuple)
df_2d(pandas.DataFrame): Pandas dataframe including all 2D shape measurements currently supported by imea objects are represented row-wise, shape measurements area returned column-wise.df_3d(pandas.DataFrame): Pandas dataframe including all 3D shape measurements currently supported by imea objects are represented row-wise, shape measurements area returned column-wise.
Notes
You might want to use skimage.transform.rescale before calling this function
if your image is not already calibrated, i. e. dx != dy.
function
imea.extract.shape_measurements_2d(bw, spatial_resolution_xy=1, dalpha=9, return_statistical_lengths=False, return_all_chords=False)
Extract 2D rotation and translation invariant shape measurements from a binary image.
Parameters
bw(numpy.ndarray, type bool) — 2-dimensional binary image.spatial_resolution_xy(float, optional) — Spatial resolution of image in [mm/pixel] to return values in metric values [mm]. Ifspatial_resolution_xyis 1 measurements are returned in [pixels], by default 1.dalpha(int, optional) — Angle in degrees [°] to rotatebwat each iteration. Should be a fraction of 180° (180°/n), wherenis a natural number, by default 9.return_statistical_lengths(bool, optional) — If True, original statistical lengths distributions are returned, by default False.return_all_chords(bool, optional) — If True, an array with all found chords are returned, by default False.
Returns (tuple)
df_2d(pandas.DataFrame): Pandas dataframe including all 2D shape measurements currently supported by imea objects are represented row-wise, shape measurements area returned column-wise.statistical_lengths(list, optional): List ofnpandas.DataFrames, where each dataframe includes statistical lengths (columns) for all iterated angles (0° : dalpha : 180°). Only provided ifreturn_statistical_lengthsis True.all_chords(numpy.ndarray, optional): 1-dimensional array with all found chords for all angles. Only provided ifreturn_all_chordsis True.