API Reference

quanfima.morphology module

quanfima.morphology.calc_porosity(data)[source]

Computes porosity.

data : 3D array
Indicates the labeled 3D data.
out : dict
The dictionary of materials and corresponding porosity values.
quanfima.morphology.cast_ray(theta, y0, x0, fiber_mask, ray_len=100)[source]

Computes a distance between two detected points at fiber_mask.

Casts a ray from the point (x0, y0) at fiber_mask under angle theta of maximum length of ray_len. The ray is casted towards to opposite directions, thus two points (x1,y1) and (x2,y2) are detected at opposite borders of fiber. Finally, the Euclidean distance between these points is calculated and returned.

theta : float
Indicates the angle under which the ray is casted.
y0 : integer
Indicates the y-axis component of the origin of ray emission.
x0 : integer
Indicates the x-axis component of the origin of ray emission.
fiber_mask : 2D array
Indicates the binary array of fibers.
ray_len : integer
Indicates the maximum length of the ray.
distance : float
The distance between (x1,y0) and (x2,y2) detected points.
quanfima.morphology.estimate_diameter_batches(name, output_dir, data, skel, lat_data, azth_data, border_gap, n_scan_angles=32, out_arr_names=['diameter'], make_output=True, slices_per_batch=100)[source]

Computes 3D diameter using GPU in batches and stores result in a npy file.

name : str
Indicates the name of the output npy file.
output_dir : str
Indicates the path to the output folder where the data will be stored.
data : 3D array
Indicates the 3D binary data.
skel : 3D array
Indicates the skeleton of the binary data.
lat_data : 3D array
Indicates the 3D array containing latitude / elevation angle at every point of the skeleton in radians.
azth_data : 3D array
Indicates the 3D array containing azimuth angle at every point of the skeleton in radians.
border_gap : integer
Indicates the number of overlapping slices along z-axis, usually it should be more or equal to a half of size of the 3D local window.
n_scan_angles : int
Indicates the number of scanning angles on a range [0, 360] degrees.
out_arr_names : array of str
Indicates the array of keys of the output dictionary.
make_output : boolean
Specifies if the estimated data should be stored.
slices_per_batch : integer
The number of slices along z-axis in a batch.
output_props : dict
The dictionary of properties specifying the sample name, the algorithm name, the number of processes, and the execution time.
quanfima.morphology.estimate_diameter_gpu(skel, data, lat_data, azth_data, n_scan_angles, max_iters=150, do_reshape=True)[source]

Computes 3D diameter at every point of a skeleton of data using GPU.

Estimates 3D diameter at every point of the skeleton skel extracted from the binary data data with help of orientation information provided by lat_data and azth_data arrays. The diameter is evaluated with a ray casting approach cast_ray adapted for a 3D case.

skel : 3D array
Indicates the skeleton of the binary data.
data : 3D array
Indicates the 3D binary data.
lat_data : 3D array
Indicates the 3D array containing latitude / elevation angle at every point of the skeleton in radians.
azth_data : 3D array
Indicates the 3D array containing azimuth angle at every point of the skeleton in radians.
n_scan_angles : int
Indicates the number of scanning angles on a range [0, 360] degrees.
max_iters : int
Indicates the maximum length of a ray in each direction.
do_reshape : boolean
Specifies if the output array should be reshaped immediately after estimation.
out : dict
The dictionary of the 3D array of estimated diameter and the execution time.
quanfima.morphology.estimate_diameter_single_run(name, output_dir, data, skel, lat_data, azth_data, n_scan_angles=32, make_output=True)[source]

Computes 3D diameter using GPU and stores result in a npy file.

name : str
Indicates the name of the output npy file.
output_dir : str
Indicates the path to the output folder where the data will be stored.
data : 3D array
Indicates the 3D binary data.
skel : 3D array
Indicates the skeleton of the binary data.
lat_data : 3D array
Indicates the 3D array containing latitude / elevation angle at every point of the skeleton in radians.
azth_data : 3D array
Indicates the 3D array containing azimuth angle at every point of the skeleton in radians.
n_scan_angles : int
Indicates the number of scanning angles on a range [0, 360] degrees.
make_output : boolean
Specifies if the estimated data should be stored.
output_props : dict
The dictionary of properties specifying the sample name, the algorithm name, the number of processes, and the execution time.
quanfima.morphology.estimate_fiber_properties(fiber_mask, fiber_skel, paddding=25, window_radius=12, orient_type='tensor', diameter_window_radius=12)[source]

Computes orientation and diameter of fibers at every point of a skeleton.

Estimates orientation and diameter of fibers at every point of a skeleton. The orientation is estimated using either tensor-based or PCA-based approach. The distance is evaluated by scanning a mask of fibers in a speficied angular range.

fiber_mask : 2D array
Indicates the binary data of fibers produced by the segmentation process.
fiber_skel : 2D array
Indicates the skeleton produced by thinning of the binary data of fibers.
paddding : integer
Indicates the amount of padding at the corners to prevent an estimation error.
window_radius : integer
Indicates the radius of the local window of orientation calculation, which leads to patches of size (`window_radius`*2+1) x (`window_radius`*2+1).
orient_type : str
Indicates the type of algorithm for orientation estimation (‘tensor’ or ‘pca’).
diameter_window_radius : integer
Indicates the radius of the local window of diameter estimation, which leads to patches of size (`diameter_window_radius`*2+1) x (`diameter_window_radius`*2+1).

(clear_fiber_skel, fiber_skel, output_orientation_map, output_diameter_map, orientation_vals, diameter_vals) : tuple of arrays

The skeleton with removed intersections, the skeleton, the orientation map, the diameter map, the arrays of orientation and diameter values.
quanfima.morphology.estimate_fourier_orientation(data, grid_shape=(2, 2), sigma=2.0, zoom=1.0, order=3)[source]

Computes orientation at every block of the subdivided image.

Subdivides the image into the grid of blocks grid_shape, it computes 2D FFT for every block, then the real components are segmented by the Otsu thresholding and the PCA-based approach calculates the orientation of structures within each block.

data : ndarray
Indicates the grayscale 2D image.
grid_shape : tuple
Indicates the number of blocks to subdivide the image.
sigma : float
Indicates the sigma value of the Gaussian filter to smooth the real part of 2D Fourier spectrum.
zoom : float
Indicates the upscaling factor of each block before applying 2D FFT.
order : str
Indicates the order of interpolation used in the upscaling procedure.
(orient_blocks, block_shape) : tuple of arrays
The 2D array of the orientation angle within each block, the shape of a block.
quanfima.morphology.estimate_tensor(name, skel, data, window_size, output_dir, sigma=0.025, make_output=True)[source]

Computes 3D orientation at every point of a skeleton of data.

Estimates 3D orientation at every point of the skeleton skel extracted from the binary data data within a 3D local window of size window_size using the tensor-based approach with a Gaussian smoothing of sigma.

name : str
Indicates the name of the output npy file.
skel : 3D array
Indicates the skeleton of the binary data.
data : 3D array
Indicates the 3D binary data.
window_size : integer
Indicates the size of the 3D local window.
output_dir : str
Indicates the path to the output folder where the data will be stored.
output_fmt : str
Indicates the format of
sigma : float
Indicates the sigma value of the Gaussian filter.
make_output : boolean
Specifies if the estimated data should be stored.
output_props : dict
The dictionary of properties specifying the sample name, the algorithm name, the number of processes, and the execution time.
quanfima.morphology.estimate_tensor_parallel(name, skel, data, window_size, output_dir, sigma=0.025, make_output=True, n_processes=4)[source]

Computes 3D orientation at every point of a skeleton of data in parallel processes.

Estimates 3D orientation at every point of the skeleton skel extracted from the binary data data within a 3D local window of size window_size using the tensor-based approach with a Gaussian smoothing of sigma. The orientation is estimated simultaneously at n_processes parallel processes.

name : str
Indicates the name of the output npy file.
skel : 3D array
Indicates the skeleton of the binary data.
data : 3D array
Indicates the 3D binary data.
window_size : integer
Indicates the size of the 3D local window.
output_dir : str
Indicates the path to the output folder where the data will be stored.
sigma : float
Indicates the sigma value of the Gaussian filter.
make_output : boolean
Specifies if the estimated data should be stored.
n_processes : integer
Indicates the number of the parallel processes.
output_props : dict
The dictionary of properties specifying the sample name, the algorithm name, the number of processes, and the execution time.
quanfima.morphology.execute_tensor(patch, sigma)[source]

Executes the tensor-based approach for a patch and sigma for Gaussian smoothing.

patch : 3D aray
Indicates the data patch of some size.
sigma : float
Indicates the sigma value of the Gaussian filter.
(lat, azth, 255) : tuple
The latitude / elevation and azimuth components of 3D orientation with valid value for the point at the skeleton. If the patch is None, then return (0, 0, -1) where -1 indicates that this point of the skeleton is invalid.
quanfima.morphology.extract_patch(data, pt, ws2)[source]

Extract a path from data of radius ws2.

data : 3D array
Indicates the 3D data array.
pt : array or tuple
Indicates the coordinates of a point within data.
ws2 : integer
Indicates a half of the window size of the patch to be extracted.
patch : 3D array
The 3D patch extracted from the local window around the point pt in the data with radius of ws2.
quanfima.morphology.numpy3d_to_array(np_array, allow_surface_bind=True)[source]

Converts 3D numpy array to 3D device array.

quanfima.morphology.object_counter(stack_binary_data)[source]

Label and counts particles in a binary data.

stack_binary_data : 3D array
Indicates the 3D binary data.
(objects_stats, labeled_stack) : tuple
The tuple of a DataFrame object of counted partilces and the labeled 3D data.
quanfima.morphology.orientation_3d_tensor_vigra(data, sigma=0.1)[source]

Computes 3D orientation from a 3D structure tensor of data.

data : ndarray
Indicates the N-dimensional array.
sigma : float
Indicates the sigma value of the Gaussian filter.
(lat, azth) : tuple of floats
The latitude / elevation and azimuth component of 3D orientation of structures within the patch data.
quanfima.morphology.scan_fiber_thickness(angle, patch, angular_step=1.0, tilt_range=[-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5], ray_len=100)[source]

Computes an average diameter of a structure within a patch.

Estimates an average distance from sequence of distances calculated with cast_ray function for a range of angles tilt_range.

orientation : float
Indicates the orientation angle of a structure centered within a patch.
patch : 2D array
Indicates the patch with a centered structure having orientation angle.
angular_step : float
Indicates the angular step of the scanning range in degrees.
tilt_range : integer
Indicates the scanning range of steps to estimate the distance.
ray_len : integer
Indicates the maximum length of the ray.
average_diameter : float
The average diameter of a structure centered within a patch.
quanfima.morphology.unpack_execute_tensor(args)[source]

Unpack input arguments and return result of execute_tensor function

quanfima.simulation module

quanfima.simulation.additive_noise(params, noise_lvl, smooth_lvl, use_median=True, median_rad=3)[source]

Contaminates datasets with a speficied additive Gaussian noise and smoothing level.

Contaminates the datasets (generated with generate_datasets function) with the specified level of additive Gaussian noise and smoothing, uneven illumination can be added by extracting blobs from params tuple with some other arguments.

params : tuple
Contains name, dataset_path, blobs, output_dir arguments passed from generate_noised_data.
noise_level : float
Indicates the standard deviations of noise.
smooth_level : float
Indicates the sigma value of Gaussian filter.
use_median : boolean
Specifies if the median filter should be applied after addition of noise.
median_rad : integer
Indicates the size of median filter.
datasets_props : dict
The dictionary containing the path to the reference dataset, the path to the contaminated dataset, the generated name, the SNR level, the precision, the recall and f1-score, and the level of noise and smoothing.
quanfima.simulation.generate_blobs(volume_size, blob_size_fraction=0.1, transparency_ratio=0.5, sigma=90.0)[source]

Generates random blobs smoothed with Gaussian filter in a volume.

Generates several blobs of random size in a volume using function from scikit-image, which are subsequently smoothed with a Gaussian filter of a large sigma to imitate 3D uneven illumination of the volume.

volume_size : tuple
Indicates the size of the volume.
blob_size_fraction : float
Indicates the fraction of volume occupied by blobs.
transparency_ratio : float
Indicates the transparency of blobs in a range [0, 1].
sigma : float
Indicates the sigma of Gaussian filter.
blobs_smeared : ndarray
The volume with smoothed blobs of a specified transparency.
quanfima.simulation.generate_datasets(volume_size=(512, 512, 512), n_fibers=50, radius_lim=(4, 10), length_lim=(0.2, 0.8), gap_lim=(3, 10), max_fails=100, median_rad=3, intersect=False, output_dir=None, params=None)[source]

Simulates speficied configurations of fibers and stores in a npy file.

Simulates a number of fiber configurations speficied in params with n_fibers of the radii and lengths in ranges radius_lim and length_lim, separated with gaps in a range of gap_lim. The simulation process stops if the number of attempts to generate a fiber exceeds max_fails.

volume_size : tuple
Indicates the size of the volume.
n_fibers : integer
Indicates the number of fibers to be generated.
radius_lim : tuple
Indicates the range of radii for fibers to be generated.
length_lim : tuple
Indicates the range of lengths for fibers to be generated.
gap_lim : tuple
Indicates the range of gaps separating the fibers from each other.
max_fails : integer
Indicates the maximum number of failures during the simulation process.
median_rad : integer
Indicates the radius of median filter to fill holes occured due to rounding of coordinates of the generated fibers.
intersect : boolean
Specifies if generated fibers can intersect.
output_dir : str
Indicates the path to the output folder where the data will be stored.
params : dict
Indicates the configurations of orientation of fibers to be generated.
out : dict
The dictionary of generated datasets of specified configurations.
quanfima.simulation.generate_noised_data(datasets_path, noise_levels=[0.0, 0.15, 0.3], smooth_levels=[0.0, 1.0, 2.0], blobs=None, use_median=True, median_rad=3, output_dir=None, n_processes=9)[source]

Contaminates datasets with a speficied additive Gaussian noise and smoothing level.

Contaminates the datasets (generated with generate_datasets function) with the specified level of additive Gaussian noise and smoothing, uneven illumination can be added if blobs is provided. The contaminating process can be performed in a parallel n_processes processes.

datasets_path : str
Indicates the path to dataset.
noise_levels : array
Indicates the array of standard deviations of noise.
smooth_levels : array
Indicates the array of sigma values of Gaussian filter.
blobs : ndarray
Indicates the volume of uneven illumination generated by generate_blobs.
use_median : boolean
Specifies if the median filter should be applied after addition of noise.
median_rad : integer
Indicates the size of median filter.
output_dir : str
Indicates the path to the output folder where the data will be stored.
n_processes : integer
Indicates the number of parallel processes.
results : array of dicts
The array of dictionaries containing paths to contaminated datasets, and other properties.
quanfima.simulation.generate_particle_dataset(volume_size=(512, 512, 512), n_particles=500, radius_lim=(4, 10), max_fails=100, output_dir=None)[source]

Simulates a speficied number of particles and stores complete dataset in a npy file.

volume_size : tuple
Indicates the size of the volume.
n_particles : integer
Indicates the number of particles to be generated.
radius_lim : tuple
Indicates the range of radii for particles to be generated.
max_fails : integer
Indicates the maximum number of failures during the simulation process.
output_dir : str
Indicates the path to the output folder where the data will be stored.
out : dict
The dictionary of generated dataset.
quanfima.simulation.mkfiber(dims_size, length, radius, azth, lat, offset_xyz)[source]

Computes fiber coordinates and its length.

Computes a fiber of speficied length, radius, oriented under azimuth azth and latitude / elevation lat angles shifted to offset_xyz from the center of a volume of size dims_size.

dims_size : tuple
Indicates the size of the volume.
length : integer
Indicates the length of the simulated fiber.
radius : integer
Indicates the radius of the simulated fiber.
azth : float
Indicates the azimuth component of the orientation angles of the fiber in radians.
lat : float
Indicates the latitude / elevation component of the orientation angles of the fiber in radians.
offset_xyz : tuple
Indicates the offset from the center of the volume where the fiber will be generated.
fiber_pts, fiber_len : tuple of array and number
The array of fiber coordinates and the length.
quanfima.simulation.random_in(rng, number=1)[source]

Returns a random value within a given range.

quanfima.simulation.simulate_fibers(volume_shape, n_fibers=1, radius_lim=(4, 10), length_lim=(0.2, 0.8), lat_lim=(0, 3.141592653589793), azth_lim=(0, 3.141592653589793), gap_lim=(3, 10), max_fails=10, max_len_loss=0.5, intersect=False)[source]

Simulates fibers in a volume.

Simulates n_fibers of the radii and lengths in ranges radius_lim and length_lim, oriented in a range of azimuth azth_lim and latitude elevation ‘lat_lim’ angles, separated with a gap in a range of gap_lim. The simulation process stops if the number of attempts to generate a fiber exceeds max_fails.

volume_shape : tuple
Indicates the size of the volume.
n_fibers : integer
Indicates the number of fibers to be generated.
radius_lim : tuple
Indicates the range of radii for fibers to be generated.
length_lim : tuple
Indicates the range of lengths for fibers to be generated.
lat_lim : tuple
Indicates the range of latitude / elevation component of the orientation angles of the fibers to be generated.
azth_lim : tuple
Indicates the range of azimuth component of the orientation angles of the fibers to be generated.
gap_lim : tuple
Indicates the range of gaps separating the fibers from each other.
max_fails : integer
Indicates the maximum number of failures during the simulation process.
max_len_loss : float
Indicates the maximum fraction of the generated fiber placed out of volume, exceeding which the fiber is counted as failed.
intersect : boolean
Specifies if generated fibers can intersect.
(volume, lat_ref, azth_ref, diameter, n_generated, elapsed_time) : tuple of arrays and numbers
The binary volume of generated fibers, the volumes of latitude / elevation and azimuth angles at every fiber point, the volume of diameters at every fibers point, the number of generated fibers and the simulation time.
quanfima.simulation.simulate_particles(volume_shape, n_particles=1, radius_lim=(3, 30), max_fails=10)[source]

Simulates particles in a volume.

Simulates n_particles of the radii in a range radius_lim. The simulation process stops if the number of attempts to generate a particle exceeds max_fails.

volume_shape : tuple
Indicates the size of the volume.
n_particles : integer
Indicates the number of particles to be generated.
radius_lim : tuple
Indicates the range of radii for particles to be generated.
max_fails : integer
Indicates the maximum number of failures during the simulation process.
(volume, diameter, n_generated, elapsed_time) : tuple of arrays and numbers
The binary volume of generated particles, the volume of diameters at every point of particles, the number of generated particles and the simulation time.
quanfima.simulation.unpack_additive_noise(args)[source]

Unpack arguments and return result of additive_noise function.

quanfima.utils module

quanfima.utils.calculate_tukey_posthoc(df, column, type_column='type', verbose=True, write=False, name=None, output_dir=None)[source]

Computes p-values using ANOVA with post-hoc Tukey HSD for a given DataFrame.

Estimates p-values for a given DataFrame assuming that the sample type is named as type_column.

df : pandas DataFrame
Contains the table of values ans corresponding types or classes.
column : str
Indicates the column of values.
type_column : str
Indicates the column of sample kind.
verbose : boolean
Specifies if the output should be printed into a terminal.
write : boolean
Specifies if the output should be written into a text file.
name : str
Indicates the name of the output file.
output_dir : str
Indicates the output dir where the file will be written.
dict : sample typles and p-values
The dict of sample types and cooresponding p-values.
quanfima.utils.geo2rgb(lat, azth, azth_max=3.141592653589793, lat_max=3.141592653589793)[source]

Translates geo-coordinates to color in RGB color space.

lat : float
Indicates latitude or elevation component of a given geo-coordinates.
azth : float
Indicates azimuth component of a given geo-coordinates.
azth_max : float
Indicates the normalization value for the azimuth component.
lat_max : float
Indicates the normalization value for the latitude or elevation component.
array : tuple of values
The tuple of RGB values [R, G, B].
quanfima.utils.prepare_data(data, dilate_iterations=1, sigma=0.5)[source]

Returns the given binary data, its skeleton and the thickened skeleton.

The skeleton of a given 2D or 3D array is computed, then it is thickened using morphological dilation with dilate_iterations and smoothed with help of Gaussian filter of specified sigma.

data : ndarray
2D or 3D binary array which will be processed.
dilate_iterations : integer
Indicates the number of iterations for thickenning the skeleton.
sigma : float
Indicates the sigma of Gaussian filter used in smoothing of skeleton.
arrays : tuple of 2D or 3D arrays
The original array, its skeleton and the thickened skeleton.

quanfima.visualization module

quanfima.visualization.create_pie_chart(data, rngs, colors=['#244268', '#426084', '#67809F', '#95A9C1', '#C6D2E0'], unit_scale=1.0, measure_quantity='m^3', figsize=(33, 15), legend_loc=(0.383, -0.25), zebra_color=(False, 3), legend_fontsize=50, chart_fontsize=60, dpi=72, name=None, output_dir=None)[source]

Plots the piechart of from a given data.

data : 1D array
Indicates the array containing the values.
rngs : tuple of tuples
Indicates the ranges of the piechart.
colors : array
Indicates the color for the region of the piechart corresponding to the specific range.
unit_scale : float
Indicates the scale factor of the data values.
measure_quantity : str
Indicates the name of measure of the values.
figsize : tuple of integers
Indicates the size of the output figure.
legend_loc : tuple
Indicates the position of the legend of the figure.
zebra_color : tuple
Allows to change the text color of the region to white from the first to the speficied index of the region (True, reg_index).
legend_fontsize : integer
Indicates the fontsize of the legend.
chart_fontsize : integer
Indicates the fontsize of the figure.
dpi : integer
Indicates the DPI of the output image.
name : str
Indicates the name of the output png file.
output_dir : str
Indicates the path to the output folder where the image will be stored.
quanfima.visualization.gather_polar_errors(datasets_path, estimation_path, azth_rng=array([-90, -87, -84, -81, -78, -75, -72, -69, -66, -63, -60, -57, -54, -51, -48, -45, -42, -39, -36, -33, -30, -27, -24, -21, -18, -15, -12, -9, -6, -3, 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90]), lat_rng=array([ 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90]))[source]

Computes the absolute angular error in ranges between estimated datasets.

Calculates the absolute angular error in ranges azth_rng and lat_rng between estimated orientation datasets localed at paths datasets_path and estimation_path.

datasets_path : str
Indicates the path to the reference / estimated dataset.
estimation_path : str
Indicates the path to the estimated / reference dataset.
azth_rng : array
Indicates the ranges of azimuth angles where the error is accumulated.
lat_rng : array
Indicates the ranges of latitude or elevation angles where the error is accumulated.
array : 2D array
The 2D array of accumulated errors within the combinations of the specified angular ranges.
quanfima.visualization.plot_3d_diameter_map(name, data, unit_scale=1.0, measure_quantity='vox', radius_structure_elem=1, output_dir=None, width=512, height=512, camera_azth=44.5, camera_elev=35.8, camera_roll=0.0, camera_fov=35.0, camera_zoom=0.0035, camera_loc=(67.0, 81.6, 45.2), xlabel='', ylabel='', zlabel='', axis_color='w', background_color='k', cb_x_offset=10)[source]

Renders orientation data in 3D with RGB angular color-coding.

name : str
Indicates the name of the output png file.
data : 3D array
Indicates the 3D array containing diameter at every point of the skeleton.
unit_scale : float
Indicates the scale factor of the data values.
measure_quantity : str
Indicates the name of measure of the values.
radius_structure_elem : integer
Indicates the size of the structure element of the dilation process to thicken the skeleton.
output_dir : str
Indicates the path to the output folder where the image will be stored.
camera_azth : float
Indicates the azimuth angle of the camera.
width : int
Indicates the width of the visualization window.
height : int
Indicates the width of the visualization window.
camera_elev : float
Indicates the latitude / elevation angle of the camera.
camera_roll : float
Indicates the roll angle of the camera.
camera_fov : float
Indicates the field of view of the camera.
camera_zoom : float
Indicates the zoom level of the camera.
camera_loc : tuple
Indicates the camera location.
xlabel : str
Indicates the label along the x-axis.
ylabel : str
Indicates the label along the y-axis.
zlabel : str
Indicates the label along the z-axis.
axis_color : str
Indicates the color of axes.
background_color : str
Indicates the background color of the figure.
cb_x_offset : int
Indicates the offset of the colorbar from the right window side.
quanfima.visualization.plot_3d_orientation_map(name, lat_data, azth_data, radius_structure_elem=1, output_dir=None, width=512, height=512, camera_azth=44.5, camera_elev=35.8, camera_roll=0.0, camera_fov=35.0, camera_zoom=0.0035, camera_loc=(67.0, 81.6, 45.2), xlabel='', ylabel='', zlabel='', axis_color='w', background_color='k')[source]

Renders orientation data in 3D with RGB angular color-coding.

name : str
Indicates the name of the output png file.
lat_data : 3D array
Indicates the 3D array containing latitude / elevation angle at every point of the skeleton in radians.
azth_data : 3D array
Indicates the 3D array containing azimuth angle at every point of the skeleton in radians.
radius_structure_elem : integer
Indicates the size of the structure element of the dilation process to thicken the skeleton.
output_dir : str
Indicates the path to the output folder where the image will be stored.
width : int
Indicates the width of the visualization window.
height : int
Indicates the width of the visualization window.
camera_azth : float
Indicates the azimuth angle of the camera.
camera_elev : float
Indicates the latitude / elevation angle of the camera.
camera_roll : float
Indicates the roll angle of the camera.
camera_fov : float
Indicates the field of view of the camera.
camera_zoom : float
Indicates the zoom level of the camera.
camera_loc : tuple
Indicates the camera location.
xlabel : str
Indicates the label along the x-axis.
ylabel : str
Indicates the label along the y-axis.
zlabel : str
Indicates the label along the z-axis.
axis_color : str
Indicates the color of axes.
background_color : str
Indicates the background color of the figure.
quanfima.visualization.plot_color_wheel(name, output_dir=None, dpi=500, xlabel='Elevation', ylabel='Azimuth', fontsize=10, num_xticks=4, yticks=(-90, 90))[source]

Plots the color wheel for visualizations of 3D orintation.

name : str
Indicates the name of the output png file.
output_dir : str
Indicates the path to the output folder where the image will be stored.
dpi : integer
Indicates the DPI of the output image.
xlabel : str
Indicates the text along the x-axis.
ylabel : str
Indicates the text along the y-axis.
fontsize : int
Indicates the font size of labels along axes.
num_xticks : int
Indicates the number of ticks along axes.
yticks : tuple
Indicates the range of minimum and maximum values along the y-axis.
quanfima.visualization.plot_diameter_map(thickness_map, fiber_skel, radius_structure_elem=1, figsize=(15, 15), cmap='hsv', tmin=None, tmax=None, dpi=200, labelsize=20, label='Diameter, [pixels]', name=None, output_dir=None)[source]

Plots the diameter map with the colorbar.

Plots the diameter map from the provided diameters thickness_map and skeleton fiber_skel of size figsize using the colormap cmap and the limits of the colorbar specified by tmin and tmax, and writes as a png file with DPI of dpi to the folder specified by output_dir.

thickness_map : ndarray
2D array of diameter at every point of the skeleton.
fiber_skel : ndarray
The binary skeleton extracted from the binary data.
radius_structure_elem : integer
Indicates the size of the structure element of the dilation process to thicken the skeleton.
figsize : tuple of integers
Indicates the size of the output figure.
cmap : str
Indicates the name of a colormap used to map angles to colors.
tmin : float
Indicates the minimum value of the colorbar.
tmax : float
Indicates the maximum value of the colorbar.
dpi : integer
Indicates the DPI of the output image.
labelsize : integer
Indicates the fontsize of the label of the colorbar.
label : str
Indicates the label of the colorbar.
name : str
Indicates the name of the output png file.
output_dir : str
Indicates the path to the output folder where the image will be stored.
quanfima.visualization.plot_fourier_orientation(data, orient_blocks, block_shape, figsize=(12, 12), cmap='gray', line_length=20, line_width=2.5, line_color='red', line_style='-', name=None, output_dir=None, dpi=200)[source]

Plots the orientation map in a block-wise manner.

Plots the orientation vector over the image data at the center of each block of the subdivided image. The orientation at every block ‘orient_blocks’ and its size block_shape are specified by orientation estimation method. The result can be and stored as a png file with DPI of dpi to the folder specified by output_dir.

data : ndarray
An image on top of which, the orientation will be plotted..
orient_blocks : ndarray
2D array of orientation at every block of the subdivided image.
block_shape : tuple
Indicates the block size within which the orientation is calculated.
figsize : tuple of integers
Indicates the size of the output figure.
cmap : str
Indicates the name of a colormap used for image.
line_length : integer
Indicates the length of the orientation vector at each block.
line_width : float
Indicates the line width of the orientation vector at each block.
line_color : str
Indicates the line color of the orientation vector at each block.
line_style : str
Indicates the line style of the orientation vector at each block.
name : str
Indicates the name of the output png file.
output_dir : str
Indicates the path to the output folder where the image will be stored.
dpi : integer
Indicates the DPI of the output image.
quanfima.visualization.plot_histogram_fig(data, num_bins, xticks, color, splot_index=111, output_dir=None, xlim=(None, None), ylim=(None, None), name=None, in_percent=False, bar_width=0.8, ticks_pad=7, xticks_fontsize=22, yticks_fontsize=22, xlabel=None, ylabel=None, labels_fontsize=20, grid_alpha=0.3, title_fontsize=22, exp_fontsize=15, type=None, figsize=(12, 8), dpi=200)[source]

Plots the histogram from a given data.

data : 1D array
Indicates the array containing the values.
num_bins : integer
Indicates the number of histogram bins.
xticks : array
Indicates the array of ticks of the X-axis.
color : str
Indicates the color of the histogram.

tuple : tuple of Figure and Axis objects.

quanfima.visualization.plot_orientation_map(orient_map, fiber_skel, radius_structure_elem=1, figsize=(12, 12), cmap='hsv', dpi=200, min_label='0', max_label='180', name=None, output_dir=None)[source]

Plots the orientation map with the color wheel.

Plots the orientation map from the provided angles orient_map and skeleton fiber_skel of size figsize using the colormap cmap and writes as a png file with DPI of dpi to the folder specified by output_dir.

orient_map : ndarray
2D array of orientation at every point of the skeleton.
fiber_skel : ndarray
The binary skeleton extracted from the binary data.
radius_structure_elem : integer
Indicates the size of the structure element of the dilation process to thicken the skeleton.
figsize : tuple of integers
Indicates the size of the output figure.
cmap : str
Indicates the name of a colormap used to map angles to colors.
dpi : integer
Indicates the DPI of the output image.
min_label : str
Indicates the label of minimum degree.
max_label : str
Indicates the label of minimum degree.
name : str
Indicates the name of the output png file.
output_dir : str
Indicates the path to the output folder where the image will be stored.
quanfima.visualization.plot_polar_heatmap(data, name, interp_factor=5.0, color_limits=False, hide_colorbar=False, vmin=None, vmax=None, log_scale=True, dpi=200, output_dir=None)[source]

Plots the polar heatmap describing azimuth and latitude / elevation components.

Plots the polar heatmap where each cell of the heatmap corresponds to the specific element of the array provided by gather_polar_errors function.

data : 2D array
Indicates the array containing the sum of angular errors within the specified angular ranges. It is usually provided by gather_polar_errors function.
name : str
Indicates the name of the output png file.
interp_factor : float
Indicates the interpolation factor of the heatmap.
color_limits : boolean
Specifies if the determined intensity limits should be returned.
hide_colorbar : boolean
Specifies if the colorbar should be hidden.
vmin : float
Indicates the minimum value of the colorbar.
vmax : float
Indicates the maximum value of the colorbar.
log_scale : float
Specifies if the heatmap sould be in the logarithmic scale.
dpi : integer
Indicates the DPI of the output image.
output_dir : str
Indicates the path to the output folder where the image will be stored.