Statistics Modules
Function for calculating statistics about a whole image, for example number of grains or surface roughness.
image_statistics(image: np.ndarray, filename: str, pixel_to_nm_scaling: float, results_df: pd.DataFrame) -> pd.DataFrame
Calculate statistics pertaining to the whole image.
Calculates the size of the image in pixels and metres, the root-mean-squared roughness and the grains per metre squared.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
ndarray
|
Numpy 2D image array of the image to calculate stats for. |
required |
filename
|
str
|
The name of the file being processed. |
required |
pixel_to_nm_scaling
|
float
|
Float of the scaling factor between pixels and nanometres. |
required |
results_df
|
DataFrame
|
Pandas DataFrame of statistics pertaining to individual grains including from grainstats and dna tracing. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary of image statistics. |
Source code in topostats\statistics.py
roughness_rms(image: np.ndarray) -> float
Calculate the root-mean-square roughness of a heightmap image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
ndarray
|
2-D numpy array of heightmap data to calculate roughness. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The RMS roughness of the input array. |