![]() |
ImFusion C++ SDK 4.4.0
|
#include <ImFusion/Base/DistanceTransform.h>
Distance transformation algorithm. More...
Distance transformation algorithm.
Static Public Member Functions | |
| static std::unique_ptr< TypedImage< float > > | computeChamfer (const TypedImage< unsigned char > &mask, bool inverse=false, bool considerSpacing=false, int thresholdMask=0) |
| Computes a fast Chamfer distance transformation from mask of non-zero values. | |
| static void | extendChamfer (TypedImage< float > &result, bool considerSpacing, float threshold=0.0) |
| Extends a given distance-volume by performing a forward-backward Chamfer pass. | |
| static std::unique_ptr< TypedImage< float > > | computeChamferSigned (const TypedImage< unsigned char > &mask, bool considerSpacing=false, int thresholdMask=0, double insideWeight=1.0) |
| Version of the method above which also computes distances inside the object (whose negative values are scaled with insideWeight). | |
| static std::unique_ptr< TypedImage< float > > | computeSequentialEuclidean (const TypedImage< unsigned char > &mask, int iterations=-1) |
| Computes an absolute Sequential Euclidean Distance Transform. | |
| static std::unique_ptr< TypedImage< float > > | computePreciseSigned (const Mesh &input, double resolution, int fillZ=0, double insideWeight=1.0, double offset=3.0) |
| Compute signed distance volume with sub-pixel precise distances in narrow band about surface. | |
| static std::unique_ptr< TypedImage< float > > | computePreciseSigned (const Mesh &input, const vec3 &resolution, int fillZ=0, double insideWeight=1.0, double offset=3.0, vec3i *targetDim=nullptr, TypedImage< unsigned char > *inputMask=nullptr, bool distInPixels=true, int marginPx=10) |
| static std::unique_ptr< TypedImage< float > > | computePreciseSignedEigen (const Mesh &input, const vec3 &resolution, int fillZ=0, double insideWeight=1.0, double offset=3.0, vec3i *targetDim=nullptr, TypedImage< unsigned char > *inputMask=nullptr, bool distInPixels=true, int marginPx=10) |
| Compute precise signed distance transform using portable Eigen-based vectorization. | |
| static std::unique_ptr< TypedImage< float > > | computePreciseAbsolute (const Mesh &input, const vec3 &resolution, double offset=3.0) |
| Compute absolute distance volume with sub-pixel precise distances in narrow band about surface. | |
| static std::unique_ptr< TypedImage< float > > | computePreciseAbsolute (const Mesh &input, double resolution, double offset=3.0) |
| static std::unique_ptr< TypedImage< float > > | computeFastSweeping (const TypedImage< unsigned char > &label, bool considerSpacing) |
| Compute a distance volume with the fast sweeping method (https://en.wikipedia.org/wiki/Fast_sweeping_method). | |
|
static |
Computes a fast Chamfer distance transformation from mask of non-zero values.
| mask | Input binary image, all values > threshold will be interpreted as foreground. |
| inverse | If false, will compute the distances of the background to the foreground. If true, will compute the distances of the foreground to the background. |
| considerSpacing | Flag whether to approximate image distances (incorporating pixel spacing) instead of pixel distances. |
| thresholdMask | Optional threshold value for the mask, larger than it is considered foreground |
|
static |
Extends a given distance-volume by performing a forward-backward Chamfer pass.
| threshold | - pixels with value less than this parameter are not updated. Ignored if zero. |
|
static |
Computes an absolute Sequential Euclidean Distance Transform.
This function is more accurate than computeChamfer() but also more expensive to compute.
Unless a specific number of iterations is requested, this will run until it has converged to a final solution (typically 3-4 iterations). Note that the result is not always exact, as the scheme will fail in case of disconnected Voronoi regions. See 7.3 in http://www.agencia.fapesp.br/arquivos/survey-final-fabbri-ACMCSurvFeb2008.pdf For random 2D input this occurs roughly every 10^7 pixels and leads to an error of typically 0.05 pixels.
|
static |
Compute signed distance volume with sub-pixel precise distances in narrow band about surface.
The region inside the object is weighted by the factor insideWeight The input mesh has to be closed for this method to work If it is not the case, the parameter fillZ can be set to 1 (resp. -1) in order to close the mesh in the upper (resp. lower) Z-part
|
static |
| inputMask | Optional mask of the input mesh, will be recomputed if not provided. |
| distInPixels | If true, the distances will be computed in pixel units. Otherwise it will be in metric units. |
| offset | Distances smaller than this (in pixels, if distInPixels is set, otherwise metric) will be computed precisely from the Mesh, the further distances are obtained from this via the Chamfer distance. If spacing is not isotropic, metric distance is recommended. |
|
static |
Compute precise signed distance transform using portable Eigen-based vectorization.
This implementation uses Eigen's vectorization capabilities which auto-vectorize on all platforms (NEON on ARM, SSE/AVX on x86) without platform-specific intrinsics.
|
static |
Compute absolute distance volume with sub-pixel precise distances in narrow band about surface.
The input mesh can be either closed or open
|
static |
Compute a distance volume with the fast sweeping method (https://en.wikipedia.org/wiki/Fast_sweeping_method).
Computes the (unsigned) distance transform to pixels that are nonzero in label.
| `label` | the input label map, where pixels that are non-zero yield zero values in the distance map. |
| `considerSpacing` | if true, the distance is computed in metric units, otherwise in pixel units. For nonisotropic spacing, distance values may be inexact relative to the precision obtained for isotropic spacing. |