Structuring element for morphology represented as a list of non-zero pixels. More...
#include <vil3d_structuring_element.h>
Public Member Functions | |
vil3d_structuring_element () | |
vil3d_structuring_element (const vcl_vector< int > &p_i, const vcl_vector< int > &p_j, const vcl_vector< int > &p_k) | |
Define elements { (p_i[a],p_j[a],p_k[a]) }. | |
void | set (const vcl_vector< int > &p_i, const vcl_vector< int > &p_j, const vcl_vector< int > &p_k) |
Define elements { (p_i[a],p_j[a],p_k[a]) }. | |
void | set_to_sphere (double r) |
Set to sphere of radius r. | |
void | set_to_circle_i (double r) |
Set to circle of radius r. | |
void | set_to_circle_j (double r) |
Set to circle of radius r. | |
void | set_to_circle_k (double r) |
Set to circle of radius r. | |
void | set_to_7 () |
Set to 6 axis-aligned neighbours plus self. | |
void | set_to_27 () |
Set to 26 touching neighbours plus self. | |
void | set_to_sphere_noniso (double r, double sx, double sy, double sz) |
Set to sphere of radius r, but with non isotropic voxel sizes. | |
void | set_to_line_i (int ilo, int ihi) |
Set to line along i (ilo,0)..(ihi,0). | |
void | set_to_line_j (int jlo, int jhi) |
Set to line along j (jlo,0)..(jhi,0). | |
void | set_to_line_k (int klo, int khi) |
Set to line along k (klo,0)..(khi,0). | |
const vcl_vector< int > & | p_i () const |
i position of elements (i,j,k). | |
const vcl_vector< int > & | p_j () const |
j position of elements (i,j,k). | |
const vcl_vector< int > & | p_k () const |
k position of elements (i,j,k). | |
int | min_i () const |
i range of elements is [min_i(),max_i()]. | |
int | max_i () const |
i range of elements is [min_i_,max_i()]. | |
int | min_j () const |
j range of elements is [min_j_,max_j()]. | |
int | max_j () const |
j range of elements is [min_j_,max_j()]. | |
int | min_k () const |
k range of elements is [min_k(),max_k()]. | |
int | max_k () const |
k range of elements is [min_k(),max_k()]. | |
Private Attributes | |
vcl_vector< int > | p_i_ |
i position of elements (i,j,k). | |
vcl_vector< int > | p_j_ |
j position of elements (i,j,k). | |
vcl_vector< int > | p_k_ |
k position of elements (i,j,k). | |
int | min_i_ |
i range of elements is [min_i_,max_i_]. | |
int | max_i_ |
i range of elements is [min_i_,max_i_]. | |
int | min_j_ |
j range of elements is [min_j_,max_j_]. | |
int | max_j_ |
j range of elements is [min_j_,max_j_]. | |
int | min_k_ |
k range of elements is [min_k_,max_k_]. | |
int | max_k_ |
k range of elements is [min_k_,max_k_]. | |
Related Functions | |
(Note that these are not member functions.) | |
template<class T1 , class T2 > | |
double | vil3d_abs_shuffle_distance (const vil3d_image_view< T1 > &image1, const vil3d_image_view< T2 > &image2, const vil3d_structuring_element &element, bool include_borders) |
Computes shuffle distance between image1 and image2. | |
template<class T1 , class T2 > | |
void | vil3d_abs_shuffle_distance (const vil3d_image_view< T1 > &image1, const vil3d_image_view< T2 > &image2, const vil3d_structuring_element &element, vil3d_image_view< T1 > &image3) |
Computes shuffle distance between image1 and image2. | |
void | vil3d_binary_closing (const vil3d_image_view< bool > &src_image, vil3d_image_view< bool > &dest_image, const vil3d_structuring_element &element) |
Applies morphological closing operation with given structuring element. | |
void | vil3d_binary_dilate (const vil3d_image_view< bool > &src_image, vil3d_image_view< bool > &dest_image, const vil3d_structuring_element &element) |
Dilates src_image to produce dest_image (assumed single plane). | |
void | vil3d_binary_erode (const vil3d_image_view< bool > &src_image, vil3d_image_view< bool > &dest_image, const vil3d_structuring_element &element) |
Erodes src_image to produce dest_image (assumed single plane). | |
void | vil3d_binary_opening (const vil3d_image_view< bool > &src_image, vil3d_image_view< bool > &dest_image, const vil3d_structuring_element &element) |
Applies morphological opening operation with given structuring element. | |
template<class T > | |
void | vil3d_erode (const vil3d_image_view< T > &src_image, vil3d_image_view< T > &dest_image, const vil3d_structuring_element &element) |
Erodes src_image to produce dest_image (assumed single plane). | |
template<class T > | |
void | vil3d_max_product_filter (vil3d_image_view< T > &image, const vil3d_structuring_element &se, const vcl_vector< double > &f) |
Performs raster scan through image, comparing each voxel with neighbours. |
Structuring element for morphology represented as a list of non-zero pixels.
Elements in box bounded by [min_i(),max_i()][min_j(),max_j()] Non-zero pixels are given by (p_i[k],p_j[k])
Definition at line 15 of file vil3d_structuring_element.h.
vil3d_structuring_element::vil3d_structuring_element | ( | ) | [inline] |
Definition at line 37 of file vil3d_structuring_element.h.
vil3d_structuring_element::vil3d_structuring_element | ( | const vcl_vector< int > & | p_i, |
const vcl_vector< int > & | p_j, | ||
const vcl_vector< int > & | p_k | ||
) |
Define elements { (p_i[a],p_j[a],p_k[a]) }.
Definition at line 12 of file vil3d_structuring_element.cxx.
int vil3d_structuring_element::max_i | ( | ) | const [inline] |
i range of elements is [min_i_,max_i()].
Definition at line 96 of file vil3d_structuring_element.h.
int vil3d_structuring_element::max_j | ( | ) | const [inline] |
j range of elements is [min_j_,max_j()].
Definition at line 100 of file vil3d_structuring_element.h.
int vil3d_structuring_element::max_k | ( | ) | const [inline] |
k range of elements is [min_k(),max_k()].
Definition at line 104 of file vil3d_structuring_element.h.
int vil3d_structuring_element::min_i | ( | ) | const [inline] |
i range of elements is [min_i(),max_i()].
Definition at line 94 of file vil3d_structuring_element.h.
int vil3d_structuring_element::min_j | ( | ) | const [inline] |
j range of elements is [min_j_,max_j()].
Definition at line 98 of file vil3d_structuring_element.h.
int vil3d_structuring_element::min_k | ( | ) | const [inline] |
k range of elements is [min_k(),max_k()].
Definition at line 102 of file vil3d_structuring_element.h.
const vcl_vector<int>& vil3d_structuring_element::p_i | ( | ) | const [inline] |
i position of elements (i,j,k).
Definition at line 87 of file vil3d_structuring_element.h.
const vcl_vector<int>& vil3d_structuring_element::p_j | ( | ) | const [inline] |
j position of elements (i,j,k).
Definition at line 89 of file vil3d_structuring_element.h.
const vcl_vector<int>& vil3d_structuring_element::p_k | ( | ) | const [inline] |
k position of elements (i,j,k).
Definition at line 91 of file vil3d_structuring_element.h.
void vil3d_structuring_element::set | ( | const vcl_vector< int > & | p_i, |
const vcl_vector< int > & | p_j, | ||
const vcl_vector< int > & | p_k | ||
) |
Define elements { (p_i[a],p_j[a],p_k[a]) }.
Definition at line 20 of file vil3d_structuring_element.cxx.
void vil3d_structuring_element::set_to_27 | ( | ) |
Set to 26 touching neighbours plus self.
Definition at line 65 of file vil3d_structuring_element.cxx.
void vil3d_structuring_element::set_to_7 | ( | ) |
Set to 6 axis-aligned neighbours plus self.
Definition at line 51 of file vil3d_structuring_element.cxx.
void vil3d_structuring_element::set_to_circle_i | ( | double | r | ) |
Set to circle of radius r.
Select pixels in circle s.t. y*y+z*z<=r^r
Definition at line 95 of file vil3d_structuring_element.cxx.
void vil3d_structuring_element::set_to_circle_j | ( | double | r | ) |
Set to circle of radius r.
Select pixels in circle s.t. y*y+z*z<=r^r
Select pixels in circle s.t. x*x+z*z<=r^r
Definition at line 110 of file vil3d_structuring_element.cxx.
void vil3d_structuring_element::set_to_circle_k | ( | double | r | ) |
Set to circle of radius r.
Select pixels in circle s.t. y*y+z*z<=r^r
Definition at line 125 of file vil3d_structuring_element.cxx.
void vil3d_structuring_element::set_to_line_i | ( | int | ilo, |
int | ihi | ||
) |
Set to line along i (ilo,0)..(ihi,0).
Definition at line 158 of file vil3d_structuring_element.cxx.
void vil3d_structuring_element::set_to_line_j | ( | int | jlo, |
int | jhi | ||
) |
Set to line along j (jlo,0)..(jhi,0).
Definition at line 174 of file vil3d_structuring_element.cxx.
void vil3d_structuring_element::set_to_line_k | ( | int | klo, |
int | khi | ||
) |
Set to line along k (klo,0)..(khi,0).
Definition at line 190 of file vil3d_structuring_element.cxx.
void vil3d_structuring_element::set_to_sphere | ( | double | r | ) |
Set to sphere of radius r.
Select pixels in disk s.t. x*x+y*y+z*z<=r^r
Definition at line 80 of file vil3d_structuring_element.cxx.
void vil3d_structuring_element::set_to_sphere_noniso | ( | double | r, |
double | sx, | ||
double | sy, | ||
double | sz | ||
) |
Set to sphere of radius r, but with non isotropic voxel sizes.
Select pixels in disk s.t. x*x+y*y+z*z<=r^r
Voxel size supplied in sx,sy and sz. r then becomes an absolute radius Select pixels in disk s.t. x*x+y*y+z*z<=r^r
Definition at line 141 of file vil3d_structuring_element.cxx.
double vil3d_abs_shuffle_distance | ( | const vil3d_image_view< T1 > & | image1, |
const vil3d_image_view< T2 > & | image2, | ||
const vil3d_structuring_element & | element, | ||
bool | include_borders = true |
||
) | [related] |
Computes shuffle distance between image1 and image2.
For each pixel in image1 it finds the pixel in image2 with the closest value in an offset area defined by the element. Returns mean over all pixels of this minimum value.
Definition at line 18 of file vil3d_abs_shuffle_distance.txx.
void vil3d_abs_shuffle_distance | ( | const vil3d_image_view< T1 > & | image1, |
const vil3d_image_view< T2 > & | image2, | ||
const vil3d_structuring_element & | element, | ||
vil3d_image_view< T1 > & | image3 | ||
) | [related] |
Computes shuffle distance between image1 and image2.
For each pixel in image1 it finds the pixel in image2 with the closest value in an offset area defined by the element.
Definition at line 113 of file vil3d_abs_shuffle_distance.txx.
void vil3d_binary_closing | ( | const vil3d_image_view< bool > & | src_image, |
vil3d_image_view< bool > & | dest_image, | ||
const vil3d_structuring_element & | element | ||
) | [related] |
Applies morphological closing operation with given structuring element.
Applies dilation followed by erosion
Definition at line 15 of file vil3d_binary_closing.h.
void vil3d_binary_dilate | ( | const vil3d_image_view< bool > & | src_image, |
vil3d_image_view< bool > & | dest_image, | ||
const vil3d_structuring_element & | element | ||
) | [related] |
Dilates src_image to produce dest_image (assumed single plane).
Definition at line 10 of file vil3d_binary_dilate.cxx.
void vil3d_binary_erode | ( | const vil3d_image_view< bool > & | src_image, |
vil3d_image_view< bool > & | dest_image, | ||
const vil3d_structuring_element & | element | ||
) | [related] |
Erodes src_image to produce dest_image (assumed single plane).
Definition at line 11 of file vil3d_binary_erode.cxx.
void vil3d_binary_opening | ( | const vil3d_image_view< bool > & | src_image, |
vil3d_image_view< bool > & | dest_image, | ||
const vil3d_structuring_element & | element | ||
) | [related] |
Applies morphological opening operation with given structuring element.
Applies erosion followed by dilation
Definition at line 15 of file vil3d_binary_opening.h.
void vil3d_erode | ( | const vil3d_image_view< T > & | src_image, |
vil3d_image_view< T > & | dest_image, | ||
const vil3d_structuring_element & | element | ||
) | [related] |
Erodes src_image to produce dest_image (assumed single plane).
Definition at line 26 of file vil3d_erode.h.
void vil3d_max_product_filter | ( | vil3d_image_view< T > & | image, |
const vil3d_structuring_element & | se, | ||
const vcl_vector< double > & | f | ||
) | [related] |
Performs raster scan through image, comparing each voxel with neighbours.
Runs through every voxel in raster order. Each voxel is compared with weighted versions of offset voxels, and is replaced with the maximum value.
Replace each voxel with max(im(i,j,k),max_a (f[a]*im(i+p_i[a],j+p_j[a],k+p_k[a],plane))
If a suitable combination of se and f is chosen, this performs half an 'exponential distance transform'. For an example of use, see vil3d_exp_distance_transform.
Definition at line 71 of file vil3d_max_product_filter.h.
int vil3d_structuring_element::max_i_ [private] |
i range of elements is [min_i_,max_i_].
Definition at line 26 of file vil3d_structuring_element.h.
int vil3d_structuring_element::max_j_ [private] |
j range of elements is [min_j_,max_j_].
Definition at line 30 of file vil3d_structuring_element.h.
int vil3d_structuring_element::max_k_ [private] |
k range of elements is [min_k_,max_k_].
Definition at line 34 of file vil3d_structuring_element.h.
int vil3d_structuring_element::min_i_ [private] |
i range of elements is [min_i_,max_i_].
Definition at line 24 of file vil3d_structuring_element.h.
int vil3d_structuring_element::min_j_ [private] |
j range of elements is [min_j_,max_j_].
Definition at line 28 of file vil3d_structuring_element.h.
int vil3d_structuring_element::min_k_ [private] |
k range of elements is [min_k_,max_k_].
Definition at line 32 of file vil3d_structuring_element.h.
vcl_vector<int> vil3d_structuring_element::p_i_ [private] |
i position of elements (i,j,k).
Definition at line 18 of file vil3d_structuring_element.h.
vcl_vector<int> vil3d_structuring_element::p_j_ [private] |
j position of elements (i,j,k).
Definition at line 20 of file vil3d_structuring_element.h.
vcl_vector<int> vil3d_structuring_element::p_k_ [private] |
k position of elements (i,j,k).
Definition at line 22 of file vil3d_structuring_element.h.