Plotting
Plot processed images.
Functions:
| Name | Description |
|---|---|
generate_gif |
Generate a GIF of all slices through the image. |
plot_all_layers |
Plot a three-dimensional numpy array. |
plot_area_by_layer |
Plot the layer v total area of pores within it. |
plot_layer |
Plot a two-dimensional numpy array. |
plot_pores_by_layer |
Plot the layer v number of pores within it. |
generate_gif
generate_gif(
sliced_segments, outdir, img_name, duration=100, loop=0
)
Generate a GIF of all slices through the image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
NDArray
|
A three-dimensional array of slices through the image. |
required |
|
Path
|
Where to save the image to. |
required |
|
str
|
The original image filename, will have |
required |
|
int
|
Duration between frames in the GIF, default is |
100
|
|
int
|
Whether to loop the image, default is |
0
|
plot_all_layers
Plot a three-dimensional numpy array.
This function calls plot_layer() for each "slice" of a three-dimensional array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
NDArray
|
Two-dimensional numpy array to be plotted, may be labelled or unlabelled data. |
required |
|
str
|
The image name from which the data is derived. |
None
|
|
str | Path
|
Target output directory, will be created if it does not exist. |
None
|
|
str
|
Image format for creating image. Default is |
None
|
|
str | ColorType
|
Colormap to plot as, defaults to |
None
|
Returns:
| Type | Description |
|---|---|
dict[int, tuple[Figure, Axes]]
|
Dictionary of Matplotlib |
plot_area_by_layer
plot_area_by_layer(
area_per_layer,
img_name=None,
min_size=None,
outdir=None,
format=None,
fwhm=None,
log=False,
grid=False,
)
Plot the layer v total area of pores within it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
list[list[float]]
|
A list of the total area of pores within each layer. |
required |
|
str
|
Image name. |
None
|
|
float
|
Minimum size of objects to include when summing the area by layer. |
None
|
|
str | Path
|
Output directory, if no |
None
|
|
str
|
Output file format as a string, defaults to |
None
|
|
tuple[int, int]
|
Full width half max limits for subsetting the data. |
None
|
|
bool
|
Whether to plot with the logarithm (base10) of the number of pores. |
False
|
|
bool
|
Whether to include a grid on the plot. |
False
|
Returns:
| Type | Description |
|---|---|
tuple[Figure, Axes]
|
Returns a tuple of Matplotlib |
plot_layer
Plot a two-dimensional numpy array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
NDArray
|
Two-dimensional numpy array to be plotted, may be labelled or unlabelled data. |
required |
|
str
|
The image name from which the data is derived. |
None
|
|
int
|
The layer that is being plotted. |
None
|
|
str | Path
|
Target output directory, will be created if it does not exist. |
None
|
|
str
|
Image format for creating image. Default is |
None
|
|
str
|
Colormap to plot as, defaults to |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Figure, Axes]
|
Matplotlib |
plot_pores_by_layer
plot_pores_by_layer(
pores_per_layer,
img_name=None,
outdir=None,
format=None,
log=False,
grid=False,
)
Plot the layer v number of pores within it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
list[int]
|
A list of the number of pores in each layer. |
required |
|
str
|
Image name. |
None
|
|
str | Path
|
Output directory, if no |
None
|
|
str
|
Output file format as a string, defaults to |
None
|
|
bool
|
Whether to plot with the logarithm (base10) of the number of pores. |
False
|
|
bool
|
Whether to include a grid on the plot. |
False
|
Returns:
| Type | Description |
|---|---|
tuple[Figure, Axes]
|
Returns a tuple of Matplotlib |