11 # include <vcl_msvc_warnings.h> 17 assert(v_p_i.size()==v_p_j.size());
18 assert(v_p_i.size()>0);
24 for (
unsigned int k=1;k<v_p_i.size();++k)
38 std::vector<int> px,py;
41 for (
int j=-r0;j<=r0;++j)
42 for (
int i=-r0;i<=r0;++i)
43 if (i*i+j*j<r2) { px.push_back(i); py.push_back(j); }
50 p_i_.resize(1+ihi-ilo);
51 p_j_.resize(1+ihi-ilo);
52 for (
int i = ilo;i<=ihi;++i)
64 p_i_.resize(1+jhi-jlo);
65 p_j_.resize(1+jhi-jlo);
66 for (
int j = jlo;j<=jhi;++j)
80 <<element.
min_j()<<
','<<element.
max_j()<<
"] Points: ";
81 for (
unsigned int k=0;k<element.
p_i().size();++k)
82 os<<
'('<<element.
p_i()[k]<<
','<<element.
p_j()[k]<<
") ";
89 std::ptrdiff_t istep, std::ptrdiff_t jstep)
91 unsigned n = element.
p_i().size();
93 for (
unsigned int k=0;k<n;++k)
94 offset[k] = static_cast<std::ptrdiff_t>(element.
p_i()[k]*istep + element.
p_j()[k]*jstep);
Structuring element for morphology represented as a list of non-zero pixels.
int max_i() const
Elements in box bounded by [min_i(),max_i()][min_j(),max_j()].
const std::vector< int > & p_j() const
j position of elements (i,j).
std::vector< int > p_i_
i position of elements (i,j).
Structuring element for morphology represented as a list of non-zero pixels.
int max_j() const
Elements in box bounded by [min_i(),max_i()][min_j(),max_j()].
int min_i_
Elements in box bounded by [min_i_,max_i_][min_j_,max_j].
void set_to_disk(double r)
Set to disk of radius r.
int min_j_
Elements in box bounded by [min_i_,max_i_][min_j_,max_j].
int max_j_
Elements in box bounded by [min_i_,max_i_][min_j_,max_j].
void vil_compute_offsets(std::vector< std::ptrdiff_t > &offset, const vil_structuring_element &element, std::ptrdiff_t istep, std::ptrdiff_t jstep)
Generate a list of offsets for use on image with istep,jstep.
std::ostream & operator<<(std::ostream &os, const vil_structuring_element &element)
Write details to stream.
void set(const std::vector< int > &v_p_i, const std::vector< int > &v_p_j)
Define elements { (p_i[k],p_j[k]) }.
void set_to_line_i(int ilo, int ihi)
Set to line along i (ilo,0)..(ihi,0).
int min_j() const
Elements in box bounded by [min_i(),max_i()][min_j(),max_j()].
std::vector< int > p_j_
j position of elements (i,j).
const std::vector< int > & p_i() const
i position of elements (i,j).
int min_i() const
Elements in box bounded by [min_i(),max_i()][min_j(),max_j()].
void set_to_line_j(int jlo, int jhi)
Set to line along j (jlo,0)..(jhi,0).
int max_i_
Elements in box bounded by [min_i_,max_i_][min_j_,max_j].