1 #ifndef vil_threshold_hxx_ 2 #define vil_threshold_hxx_ 15 unsigned ni = src.
ni(),nj = src.
nj(),np = src.
nplanes();
22 for (
unsigned p=0;p<np;++p,planeA += pstepA,planeB += pstepB)
24 const srcT* rowA = planeA;
26 for (
unsigned j=0;j<nj;++j,rowA += jstepA,rowB += jstepB)
28 const srcT* pixelA = rowA;
30 for (
unsigned i=0;i<ni;++i,pixelA+=istepA,pixelB+=istepB)
41 unsigned ni = src.
ni(),nj = src.
nj(),np = src.
nplanes();
48 for (
unsigned p=0;p<np;++p,planeA += pstepA,planeB += pstepB)
50 const srcT* rowA = planeA;
52 for (
unsigned j=0;j<nj;++j,rowA += jstepA,rowB += jstepB)
54 const srcT* pixelA = rowA;
56 for (
unsigned i=0;i<ni;++i,pixelA+=istepA,pixelB+=istepB)
67 unsigned ni = src.
ni(),nj = src.
nj(),np = src.
nplanes();
74 for (
unsigned p=0;p<np;++p,planeA += pstepA,planeB += pstepB)
76 const srcT* rowA = planeA;
78 for (
unsigned j=0;j<nj;++j,rowA += jstepA,rowB += jstepB)
80 const srcT* pixelA = rowA;
82 for (
unsigned i=0;i<ni;++i,pixelA+=istepA,pixelB+=istepB)
83 *pixelB = (t0<=*pixelA) && (*pixelA<=t1);
93 unsigned ni = src.
ni(),nj = src.
nj(),np = src.
nplanes();
100 for (
unsigned p=0;p<np;++p,planeA += pstepA,planeB += pstepB)
102 const srcT* rowA = planeA;
104 for (
unsigned j=0;j<nj;++j,rowA += jstepA,rowB += jstepB)
106 const srcT* pixelA = rowA;
108 for (
unsigned i=0;i<ni;++i,pixelA+=istepA,pixelB+=istepB)
109 *pixelB = (*pixelA<=t0) || (*pixelA>=t1);
114 #undef VIL_THRESHOLD_INSTANTIATE 115 #define VIL_THRESHOLD_INSTANTIATE(srcT) \ 116 template void vil_threshold_above(const vil_image_view<srcT >& src, \ 117 vil_image_view<bool >& dest, srcT t); \ 118 template void vil_threshold_below(const vil_image_view<srcT >& src, \ 119 vil_image_view<bool >& dest, srcT t); \ 120 template void vil_threshold_inside(const vil_image_view<srcT >& src, \ 121 vil_image_view<bool >& dest, srcT t0, srcT t1); \ 122 template void vil_threshold_outside(const vil_image_view<srcT >& src, \ 123 vil_image_view<bool >& dest, srcT t0, srcT t1) 125 #endif // vil_threshold_hxx_ Apply thresholds to image data.
void vil_threshold_below(const vil_image_view< srcT > &src, vil_image_view< bool > &dest, srcT t)
Apply threshold such that dest(i,j,p)=true if src(i,j,p)<=t.
void vil_threshold_above(const vil_image_view< srcT > &src, vil_image_view< bool > &dest, srcT t)
Apply threshold such that dest(i,j,p)=true if src(i,j,p)>=t.
Concrete view of image data of type T held in memory.
void set_size(unsigned ni, unsigned nj) override
resize current planes to ni x nj.
std::ptrdiff_t jstep() const
Add this to your pixel pointer to get next j pixel.
unsigned ni() const
Width.
unsigned nj() const
Height.
std::ptrdiff_t planestep() const
Add this to your pixel pointer to get pixel on next plane.
void vil_threshold_inside(const vil_image_view< srcT > &src, vil_image_view< bool > &dest, srcT t0, srcT t1)
Apply threshold such that dest(i,j,p)=true if t0<=src(i,j,p)<=t1.
T * top_left_ptr()
Pointer to the first (top left in plane 0) pixel.
unsigned nplanes() const
Number of planes.
std::ptrdiff_t istep() const
Add this to your pixel pointer to get next i pixel.
void vil_threshold_outside(const vil_image_view< srcT > &src, vil_image_view< bool > &dest, srcT t0, srcT t1)
Apply threshold such that dest(i,j,p)=true if src(i,j,p)<=t0 or src(i,j,p)>=t1.