Compute distance transform using chamfer distance. More...
#include "vil3d_distance_transform.h"
#include <vil3d/vil3d_image_view.h>
#include <vil3d/algo/vil3d_fill_boundary.h>
#include <vil3d/algo/vil3d_threshold.h>
#include <vil3d/vil3d_slice.h>
#include <vil/vil_fill.h>
#include <vcl_cassert.h>
#include <vcl_algorithm.h>
Go to the source code of this file.
Functions | |
void | vil3d_signed_distance_transform (vil3d_image_view< float > &image, const float distance_link_i, const float distance_link_j, const float distance_link_k) |
Compute signed distance transform in 3d from zeros in original image. | |
template<class T > | |
void | print_values (const vil_image_view< T > &img) |
template<class T > | |
void | print_values (const vil3d_image_view< T > &img) |
void | vil3d_signed_distance_transform (const vil3d_image_view< bool > &mask, vil3d_image_view< float > &image, float max_dist, const float distance_link_i, const float distance_link_j, const float distance_link_k) |
Compute 3d signed distance transform from true elements in mask. | |
void | vil3d_distance_transform (vil3d_image_view< float > &image, const float distance_link_i, const float distance_link_j, const float distance_link_k) |
Compute distance transform in 3d from zeros in original image. | |
void | vil3d_distance_transform_with_dir (vil3d_image_view< float > &image, vil3d_image_view< vil_rgb< float > > &orient, const float distance_link_i, const float distance_link_j, const float distance_link_k) |
Compute distance transform in 3d from zeros in original image. | |
void | vil3d_distance_transform_one_way (vil3d_image_view< float > &image, const float distance_link_i, const float distance_link_j, const float distance_link_k) |
Compute directed 3D distance function from zeros in original image. | |
float | vil3d_min_comp (float const &a, float const &b, bool &comp) |
void | vil3d_distance_transform_one_way_with_dir (vil3d_image_view< float > &image, vil3d_image_view< vil_rgb< float > > &orient, const float distance_link_i, const float distance_link_j, const float distance_link_k) |
Compute directed 3D distance function from zeros in original image. | |
void | vil3d_distance_transform (const vil3d_image_view< bool > &mask, vil3d_image_view< float > &distance_image, float max_dist) |
Compute 3D distance function from true elements in mask. |
Compute distance transform using chamfer distance.
Definition in file vil3d_distance_transform.cxx.
void print_values | ( | const vil_image_view< T > & | img | ) |
Definition at line 51 of file vil3d_distance_transform.cxx.
void print_values | ( | const vil3d_image_view< T > & | img | ) |
Definition at line 61 of file vil3d_distance_transform.cxx.
void vil3d_distance_transform | ( | vil3d_image_view< float > & | image, |
const float | distance_link_i, | ||
const float | distance_link_j, | ||
const float | distance_link_k | ||
) |
Compute distance transform in 3d from zeros in original image.
Compute 3d distance transform from zeros in original image.
Image is assumed to be filled with max_dist where there is background, and zero in the places of interest. On exit, the values are the 8-connected distance to the nearest original zero region.
Definition at line 128 of file vil3d_distance_transform.cxx.
void vil3d_distance_transform | ( | const vil3d_image_view< bool > & | mask, |
vil3d_image_view< float > & | distance_image, | ||
float | max_dist | ||
) |
Compute 3D distance function from true elements in mask.
On exit, the values are the 8-connected distance to the nearest original zero region (or max_dist, if that is smaller).
Definition at line 681 of file vil3d_distance_transform.cxx.
void vil3d_distance_transform_one_way | ( | vil3d_image_view< float > & | image, |
const float | distance_link_i, | ||
const float | distance_link_j, | ||
const float | distance_link_k | ||
) |
Compute directed 3D distance function from zeros in original image.
Compute 3d distance transform from zeros in original image.
Image is assumed to be filled with max_dist where there is background, and zero at the places of interest. On exit, the values are the 8-connected distance to the nearest original zero region above or to the left of current point. One pass of distance transform, going from low to high i,j,k.
Definition at line 187 of file vil3d_distance_transform.cxx.
void vil3d_distance_transform_one_way_with_dir | ( | vil3d_image_view< float > & | image, |
vil3d_image_view< vil_rgb< float > > & | orient, | ||
const float | distance_link_i, | ||
const float | distance_link_j, | ||
const float | distance_link_k | ||
) |
Compute directed 3D distance function from zeros in original image.
Image is assumed to be filled with max_dist where there is background, and zero at the places of interest. Directions are assumed to be filled with max_dist. On exit, the values are the 8-connected distance to the nearest original zero region above or to the left of current point. The direction shows the relative position of the closest pixel with value 0. e.g. pixel (10,10,10) has vector (-2,-2,-2), so the closest 0 is at (8,8,8). One pass of distance transform, going from low to high i,j,k.
Definition at line 379 of file vil3d_distance_transform.cxx.
void vil3d_distance_transform_with_dir | ( | vil3d_image_view< float > & | image, |
vil3d_image_view< vil_rgb< float > > & | orient, | ||
const float | distance_link_i, | ||
const float | distance_link_j, | ||
const float | distance_link_k | ||
) |
Compute distance transform in 3d from zeros in original image.
Image is assumed to be filled with max_dist where there is background, and zero in the places of interest. On exit, the values are the 8-connected distance to the nearest original zero region.
Definition at line 147 of file vil3d_distance_transform.cxx.
float vil3d_min_comp | ( | float const & | a, |
float const & | b, | ||
bool & | comp | ||
) |
Definition at line 361 of file vil3d_distance_transform.cxx.
void vil3d_signed_distance_transform | ( | vil3d_image_view< float > & | image, |
const float | distance_link_i, | ||
const float | distance_link_j, | ||
const float | distance_link_k | ||
) |
Compute signed distance transform in 3d from zeros in original image.
Image is assumed to be filled with max_dist where there is background, and zero in the places of interest. On exit, the values are the signed 26-connected distance to the nearest original zero region. Positive values are outside the bounded region and negative values are inside. The values on the boundary are zero
Definition at line 22 of file vil3d_distance_transform.cxx.
void vil3d_signed_distance_transform | ( | const vil3d_image_view< bool > & | mask, |
vil3d_image_view< float > & | image, | ||
float | max_dist, | ||
const float | distance_link_i, | ||
const float | distance_link_j, | ||
const float | distance_link_k | ||
) |
Compute 3d signed distance transform from true elements in mask.
On exit, values are 26 connected distance from the 'true' boundary. There are no zero values because the true boundary is the infinitesimally thin edge of the true and false regions of the mask. The values inside the mask are negative and those outside are positive
Definition at line 78 of file vil3d_distance_transform.cxx.