13 # include <vcl_msvc_warnings.h> 23 std::fill(view.
begin(), view.
end(), value);
25 unsigned ni = view.
ni();
26 std::ptrdiff_t istep=view.
istep();
27 unsigned nj = view.
nj();
28 std::ptrdiff_t jstep=view.
jstep();
33 for (
unsigned p=0;p<np;++p,plane += pstep)
36 for (
unsigned j=0;j<nj;++j,row += jstep)
39 for (
unsigned i=0;i<ni;++i,pixel+=istep) *pixel=value;
49 T* end_data = data + n*step;
50 while (data!=end_data) { *data=value; data+=step; }
59 int ai,
int aj,
int bi,
int bj,
62 if (ai == bi && aj==bj)
64 if (im.
in_range(ai, aj)) im(ai,aj) = value;
68 int d, x, y, xinc, yinc, incr1, incr2;
88 if (im.
in_range(ai, aj)) im(ai, aj)=value;
106 if (im.
in_range(x, y)) im(x, y)=value;
124 if (im.
in_range(x, y)) im(x, y)=value;
135 unsigned ni = view.
ni(); std::ptrdiff_t istep=view.
istep();
136 assert(j<view.
nj()); std::ptrdiff_t jstep=view.
jstep();
140 for (
unsigned p=0;p<np;++p,row += pstep)
150 assert(i<view.
ni()); std::ptrdiff_t istep=view.
istep();
151 unsigned nj = view.
nj(); std::ptrdiff_t jstep=view.
jstep();
155 for (
unsigned p=0;p<np;++p,col_top += pstep)
167 srcT value,
bool b=
true)
169 unsigned ni = image.
ni(), nj = image.
nj(), np = image.
nplanes();
170 assert(ni==mask.
ni() && nj==mask.
nj());
178 if (mask.
nplanes()==1) pstepB=0;
182 for (
unsigned p=0;p<np;++p,planeA += pstepA,planeB += pstepB)
185 const bool* rowB = planeB;
186 for (
unsigned j=0;j<nj;++j,rowA += jstepA,rowB += jstepB)
189 const bool* pixelB = rowB;
190 for (
unsigned i=0;i<ni;++i,pixelA+=istepA,pixelB+=istepB)
191 if (*pixelB==b) *pixelA=value;
203 unsigned ilo = std::max(0,
int(ci-r));
204 unsigned ihi = std::max(0,std::min(
int(image.
ni()-1),
int(ci+r+1.0)));
205 unsigned jlo = std::max(0,
int(cj-r));
206 unsigned jhi = std::max(0,std::min(
int(image.
nj()-1),
int(cj+r+1.0)));
209 for (
unsigned j=jlo;j<=jhi;++j)
211 double t2 = r2 - (j-cj)*(j-cj);
212 for (
unsigned i=ilo;i<=ihi;++i)
214 if ((i-ci)*(i-ci)<t2)
216 for (
unsigned k=0;k<image.
nplanes();++k) image(i,j,k)=value;
222 #endif // vil_fill_h_ Concrete view of image data of type T held in memory.
bool is_contiguous() const
True if data all in one unbroken block and top_left_ptr() is lowest data address.
std::ptrdiff_t jstep() const
Add this to your pixel pointer to get next j pixel.
void vil_fill_col(vil_image_view< T > &view, unsigned i, T value)
Fill column i in view with given value.
bool in_range(int i, int j) const
Return true if (i,j) is a valid index into this buffer.
unsigned ni() const
Width.
unsigned nj() const
Height.
void vil_fill_line(vil_image_view< T > &im, int ai, int aj, int bi, int bj, T value)
Fill line from (ai,aj) to (bi,bj) using Bresenham's algorithm.
std::ptrdiff_t planestep() const
Add this to your pixel pointer to get pixel on next plane.
void vil_fill_disk(vil_image_view< T > &image, double ci, double cj, double r, T value)
Fills pixels in disk with centre (ci,cj), radius r, with given value.
A base class reference-counting view of some image data.
T * top_left_ptr()
Pointer to the first (top left in plane 0) pixel.
unsigned nplanes() const
Number of planes.
void vil_fill_mask(vil_image_view< srcT > &image, const vil_image_view< bool > &mask, srcT value, bool b=true)
Writes given value into each pixel of image under the elements of the mask set to b.
std::ptrdiff_t istep() const
Add this to your pixel pointer to get next i pixel.
void vil_fill_row(vil_image_view< T > &view, unsigned j, T value)
Fill row j in view with given value.
void vil_fill(vil_image_view< T > &view, T value)
Fill view with given value.