Title: | Nested multiresolution hierarchical simulated annealing |
---|---|
Description: | Porous media reconstruction using an advanced simulated annealing approach. |
Authors: | Bart Rogiers [aut, cre] (<https://orcid.org/0000-0002-8836-0988>, <https://rogiersbart.github.io>), Laurent Lemmens [aut] (Author of the original Python code, <https://orcid.org/0000-0002-8836-0988>) |
Maintainer: | Bart Rogiers <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.0.9000 |
Built: | 2025-02-21 04:30:58 UTC |
Source: | https://github.com/rogiersbart/nmhsa |
A 2D segmented cement paste image, as an integer matrix, which carries the
nmhsa_array
S3 class for more friendly printing and plotting.
cement
cement
An integer matrix of 128 rows and 128 columns, with the following labels for the different segmented phases:
Pores
Portlandite
Clinker
CSH
https://doi.org/10.1103/PhysRevE.100.053316
This is the simplest algorithm available at the moment, which is capable of multiphase reconstruction using the hierarchical approach (phases are added one by one).
hsa( ti, dimensions = NULL, start_after = NULL, stop_after = NULL, stop_rejected = NULL, stop_at = 1e-06, order = NULL, distance = NULL, cool = 0.9 )
hsa( ti, dimensions = NULL, start_after = NULL, stop_after = NULL, stop_rejected = NULL, stop_at = 1e-06, order = NULL, distance = NULL, cool = 0.9 )
ti |
The original training image (2D array). |
dimensions |
Dimensions for the reconstruction (vector of length 2 or
3). Defaults to the dimensions of |
start_after |
Number of iterations for determining the initial simulated annealing temperature. Defaults to 0.1% of the total amount of pixels in the reconstruction. |
stop_after |
Maximum number of iterations. Defaults to the amount of pixels in the reconstruction. Can be a vector for different values per phase. |
stop_rejected |
Maximum number of consecutively rejected iterations. Defaults to 1% of the total amount of pixels in the reconstruction. |
stop_at |
Target precision. Defaults to |
order |
Integer vector with the phase order for hierarchical simulation. Defaults to the least to the most occurring phase. |
distance |
Distance, in pixels, up to which to investigate the
structural descriptors. Defaults to 1/4th of the minimum of |
cool |
Simulated annealing cooling factor. Must be lower than one.
Defaults to |
A reconstructed 2D or 3D array.
https://doi.org/10.1103/PhysRevE.100.053316
This algorithm extends hsa()
by introducing different grid levels, or
resolutions, which should result in improved and more efficient
reconstruction of larger particles.
mhsa( ti, dimensions = NULL, start_after = NULL, stop_after = NULL, stop_rejected = NULL, stop_at = 1e-06, order = NULL, distance = NULL, cool = 0.9, levels = 2 )
mhsa( ti, dimensions = NULL, start_after = NULL, stop_after = NULL, stop_rejected = NULL, stop_at = 1e-06, order = NULL, distance = NULL, cool = 0.9, levels = 2 )
ti |
The original training image (2D array). |
dimensions |
Dimensions for the reconstruction (vector of length 2 or
3). Defaults to the dimensions of |
start_after |
Number of iterations for determining the initial simulated annealing temperature. Defaults to 0.1% of the total amount of pixels in the reconstruction. |
stop_after |
Maximum number of iterations. Defaults to the amount of pixels in the reconstruction. Can be a vector for different values per phase. |
stop_rejected |
Maximum number of consecutively rejected iterations. Defaults to 1% of the total amount of pixels in the reconstruction. |
stop_at |
Target precision. Defaults to |
order |
Integer vector with the phase order for hierarchical simulation. Defaults to the least to the most occurring phase. |
distance |
Distance, in pixels, up to which to investigate the
structural descriptors. Defaults to 1/4th of the minimum of |
cool |
Simulated annealing cooling factor. Must be lower than one.
Defaults to |
levels |
Amount of grid levels (or resolutions) to use for the
reconstruction. Defaults to |
A reconstructed 2D or 3D array.
https://doi.org/10.1103/PhysRevE.100.053316
This algorithm extends mhsa()
by introducing the nested approach, meaning
it automatically handles identified subphases (which are split by the user,
and merged again by the algorithm), and allows handling things like
inclusions by a splitting step at the end of the simulation (phases merged,
or rather rearranged, by the user, and split again by the algorithm).
nmhsa( ti, dimensions = NULL, start_after = NULL, stop_after = NULL, stop_rejected = NULL, stop_at = 1e-06, order = NULL, distance = NULL, cool = 0.9, levels = 2, ti_merged = NULL, ti_splitted = NULL, merge_pairs = NULL, merge_distance = NULL, merge_stop_after = NULL, split_distance = NULL, split_stop_after = NULL )
nmhsa( ti, dimensions = NULL, start_after = NULL, stop_after = NULL, stop_rejected = NULL, stop_at = 1e-06, order = NULL, distance = NULL, cool = 0.9, levels = 2, ti_merged = NULL, ti_splitted = NULL, merge_pairs = NULL, merge_distance = NULL, merge_stop_after = NULL, split_distance = NULL, split_stop_after = NULL )
ti |
The original training image (2D array). |
dimensions |
Dimensions for the reconstruction (vector of length 2 or
3). Defaults to the dimensions of |
start_after |
Number of iterations for determining the initial simulated annealing temperature. Defaults to 0.1% of the total amount of pixels in the reconstruction. |
stop_after |
Maximum number of iterations. Defaults to the amount of pixels in the reconstruction. Can be a vector for different values per phase. |
stop_rejected |
Maximum number of consecutively rejected iterations. Defaults to 1% of the total amount of pixels in the reconstruction. |
stop_at |
Target precision. Defaults to |
order |
Integer vector with the phase order for hierarchical simulation. Defaults to the least to the most occurring phase. |
distance |
Distance, in pixels, up to which to investigate the
structural descriptors. Defaults to 1/4th of the minimum of |
cool |
Simulated annealing cooling factor. Must be lower than one.
Defaults to |
levels |
Amount of grid levels (or resolutions) to use for the
reconstruction. Defaults to |
ti_merged |
Merged version of |
ti_splitted |
Splitted version of |
merge_pairs |
List of length 2 vectors, indicating for which pairs of
phases optimisation should again be performed after merging all subphases
again to their original phase (transition from the state of |
merge_distance |
Distance, in pixels, up to which to investigate the
structural descriptors for the merging step. Defaults to 1/4th of the
minimum of |
merge_stop_after |
Maximum number of iterations for the merging step. Defaults to the amount of pixels in the reconstruction. Can be a vector for different values per phase. |
split_distance |
Distance, in pixels, up to which to investigate the
structural descriptors for the splitting step. Defaults to 1/4th of the
minimum of |
split_stop_after |
Maximum number of iterations for the splitting step. Defaults to the amount of pixels in the reconstruction. |
A more general approach to the phase merging and splitting would be possible, where the user has control of every step in the simulation, but this is currently not implemented.
A reconstructed 2D or 3D array.
https://doi.org/10.1103/PhysRevE.100.053316
hsa()
, mhsa()
, phase_merge()
, phase_split()
This functionality was originally introduced to remove inclusions of certain phases within another phase. We are however simply looking for neighbouring pixels here. As this is still effective with small inclusions, for larger ones, repeated calls of this function may be required. Note however that this also affects pixels of the phase to modify that are not inclusions but just neighbouring pixels of the target phase.
phase_merge(img, phase, into)
phase_merge(img, phase, into)
img |
A 2D array. |
phase |
The phase to modify. |
into |
The phase to change pixels to. |
The modified 2D array.
This function splits a certain phase into two subphases based on a size threshold, which makes sense in the reconstruction framework if the two subphases behave different structurally.
phase_split(img, phase, larger_than, into = max(c(img)) + 1)
phase_split(img, phase, larger_than, into = max(c(img)) + 1)
img |
A 2D array. |
phase |
The phase to modify. |
larger_than |
The threshold for splitting (in pixels). |
into |
The phase to change pixels to. |
The modified 2D array.
Access to the Python wrapper examples
wrapper(algorithm)
wrapper(algorithm)
algorithm |
One of "hsa", "mhsa", "nmhsa" or "3d". |
A 2D or 3D array