[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

basicimageview.hxx |

1 /************************************************************************/
2 /* */
3 /* Copyright 1998-2002 by Ullrich Koethe */
4 /* */
5 /* This file is part of the VIGRA computer vision library. */
6 /* The VIGRA Website is */
7 /* http://hci.iwr.uni-heidelberg.de/vigra/ */
8 /* Please direct questions, bug reports, and contributions to */
9 /* ullrich.koethe@iwr.uni-heidelberg.de or */
10 /* vigra@informatik.uni-hamburg.de */
11 /* */
12 /* Permission is hereby granted, free of charge, to any person */
13 /* obtaining a copy of this software and associated documentation */
14 /* files (the "Software"), to deal in the Software without */
15 /* restriction, including without limitation the rights to use, */
16 /* copy, modify, merge, publish, distribute, sublicense, and/or */
17 /* sell copies of the Software, and to permit persons to whom the */
18 /* Software is furnished to do so, subject to the following */
19 /* conditions: */
20 /* */
21 /* The above copyright notice and this permission notice shall be */
22 /* included in all copies or substantial portions of the */
23 /* Software. */
24 /* */
25 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND */
26 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES */
27 /* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
28 /* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */
29 /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, */
30 /* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING */
31 /* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR */
32 /* OTHER DEALINGS IN THE SOFTWARE. */
33 /* */
34 /************************************************************************/
35
36 #ifndef VIGRA_BASICIMAGEVIEW_HXX
37 #define VIGRA_BASICIMAGEVIEW_HXX
38
39 #include "imageiterator.hxx"
40 #include "initimage.hxx"
41
42 // Bounds checking Macro used if VIGRA_CHECK_BOUNDS is defined.
43 #ifdef VIGRA_CHECK_BOUNDS
44 #define VIGRA_ASSERT_INSIDE(diff) \
45 vigra_precondition(this->isInside(diff), "Index out of bounds")
46 #else
47 #define VIGRA_ASSERT_INSIDE(diff)
48 #endif
49
50
51 namespace vigra {
52
53
54 /********************************************************/
55 /* */
56 /* BasicImageView */
57 /* */
58 /********************************************************/
59
60 /** \brief BasicImage using foreign memory.
61
62 <b>deprecated</b>, use \ref vigra::MultiArrayView instead
63
64 This class provides the same interface as \ref vigra::BasicImage
65 (with the exception of <tt>resize()</tt>) but the image's
66 memory is provided from the outside instead of allocated internally.
67
68 A <tt>BasicImageView</tt> can also be created from a
69 \ref vigra::MultiArrayView with the appropriate shape -- see
70 \ref MultiArrayToImage.
71
72 <b>\#include</b> <vigra/basicimageview.hxx> <br/>
73 Namespace: vigra
74 */
75 template <class PIXELTYPE>
76 class BasicImageView
77 {
78 public:
79
80 /** the BasicImageView's pixel type
81 */
82 typedef PIXELTYPE value_type;
83
84 /** the BasicImageView's pixel type
85 */
86 typedef PIXELTYPE PixelType;
87
88 /** the BasicImageView's reference type (i.e. the
89 return type of image[diff] and image(dx,dy))
90 */
91 typedef PIXELTYPE & reference;
92
93 /** the BasicImageView's const reference type (i.e. the
94 return type of image[diff] and image(dx,dy) when image is const)
95 */
96 typedef PIXELTYPE const & const_reference;
97
98 /** the BasicImageView's pointer type
99 */
100 typedef PIXELTYPE * pointer;
101
102 /** the BasicImageView's const pointer type
103 */
104 typedef PIXELTYPE const * const_pointer;
105
106 /** the BasicImageView's 1D random access iterator
107 (note: lower case 'iterator' is a STL compatible 1D random
108 access iterator, don't confuse with capitalized Iterator)
109 */
110 typedef PIXELTYPE * iterator;
111
112 /** deprecated, use <TT>iterator</TT> instead
113 */
114 typedef PIXELTYPE * ScanOrderIterator;
115
116 /** the BasicImageView's 1D random access const iterator
117 (note: lower case 'const_iterator' is a STL compatible 1D
118 random access const iterator)
119 */
120 typedef PIXELTYPE const * const_iterator;
121
122 /** deprecated, use <TT>const_iterator</TT> instead
123 */
124 typedef PIXELTYPE const * ConstScanOrderIterator;
125
126 /** the BasicImageView's 2D random access iterator ('traverser')
127 */
128 typedef ImageIterator<value_type> traverser;
129
130 /** deprecated, use <TT>traverser</TT> instead
131 */
132 typedef ImageIterator<value_type> Iterator;
133
134 /** the BasicImageView's 2D random access const iterator ('const traverser')
135 */
136 typedef ConstImageIterator<value_type> const_traverser;
137
138 /** deprecated, use <TT>const_traverser</TT> instead
139 */
140 typedef ConstImageIterator<value_type> ConstIterator;
141
142 /** the row iterator associated with the traverser
143 */
144 typedef typename traverser::row_iterator row_iterator;
145
146 /** the const row iterator associated with the const_traverser
147 */
148 typedef typename const_traverser::row_iterator const_row_iterator;
149
150 /** the column iterator associated with the traverser
151 */
152 typedef typename traverser::column_iterator column_iterator;
153
154 /** the const column iterator associated with the const_traverser
155 */
156 typedef typename const_traverser::column_iterator const_column_iterator;
157
158 /** the BasicImageView's difference type (argument type of image[diff])
159 */
160 typedef Diff2D difference_type;
161
162 /** the BasicImageView's size type (result type of image.size())
163 */
164 typedef Size2D size_type;
165
166 /** the BasicImageView's default accessor
167 */
168 typedef typename
169 IteratorTraits<traverser>::DefaultAccessor Accessor;
170
171 /** the BasicImageView's default const accessor
172 */
173 typedef typename
174 IteratorTraits<const_traverser>::DefaultAccessor ConstAccessor;
175
176 /** construct image of size 0x0
177 */
178 BasicImageView()
179 : data_(0),
180 width_(0),
181 height_(0),
182 stride_(0)
183 {}
184
185 /** construct view of size w x h
186 */
187 BasicImageView(const_pointer data, std::ptrdiff_t w, std::ptrdiff_t h, std::ptrdiff_t stride = 0)
188 : data_(const_cast<pointer>(data)),
189 width_(w),
190 height_(h),
191 stride_(stride == 0 ? w : stride)
192 {}
193
194 /** construct view of size size.x x size.y
195 */
196 BasicImageView(const_pointer data, difference_type const & size, std::ptrdiff_t stride = 0)
197 : data_(const_cast<pointer>(data)),
198 width_(size.x),
199 height_(size.y),
200 stride_(stride == 0 ? size.x : stride)
201 {}
202
203 /** set Image with const value
204 */
205 BasicImageView & init(value_type const & pixel)
206 {
207 initImage(upperLeft(), lowerRight(), accessor(), pixel);
208
209 return *this;
210 }
211
212 /** width of Image
213 */
214 std::ptrdiff_t width() const
215 {
216 return width_;
217 }
218
219 /** height of Image
220 */
221 std::ptrdiff_t height() const
222 {
223 return height_;
224 }
225
226 /** stride of Image.
227 Memory offset between the start of two successive rows.
228 */
229 std::ptrdiff_t stride() const
230 {
231 return stride_;
232 }
233
234 /** size of Image
235 */
236 size_type size() const
237 {
238 return size_type(width(), height());
239 }
240
241 /** test whether a given coordinate is inside the image
242 */
243 bool isInside(difference_type const & d) const
244 {
245 return d.x >= 0 && d.y >= 0 &&
246 d.x < width() && d.y < height();
247 }
248
249 /** access pixel at given location. <br>
250 usage: <TT> value_type value = image[Diff2D(1,2)] </TT>
251 */
252 reference operator[](difference_type const & d)
253 {
254 VIGRA_ASSERT_INSIDE(d);
255 return data_[d.y*stride_ + d.x];
256 }
257
258 /** read pixel at given location. <br>
259 usage: <TT> value_type value = image[Diff2D(1,2)] </TT>
260 */
261 const_reference operator[](difference_type const & d) const
262 {
263 VIGRA_ASSERT_INSIDE(difference_type(d));
264 return data_[d.y*stride_ + d.x];
265 }
266
267 /** access pixel at given location. <br>
268 usage: <TT> value_type value = image(1,2) </TT>
269 */
270 reference operator()(std::ptrdiff_t dx, std::ptrdiff_t dy)
271 {
272 VIGRA_ASSERT_INSIDE(difference_type(dx,dy));
273 return data_[dy*stride_ + dx];
274 }
275
276 /** read pixel at given location. <br>
277 usage: <TT> value_type value = image(1,2) </TT>
278 */
279 const_reference operator()(std::ptrdiff_t dx, std::ptrdiff_t dy) const
280 {
281 VIGRA_ASSERT_INSIDE(difference_type(dx, dy));
282 return data_[dy*stride_ + dx];
283 }
284
285 /** access pixel at given location.
286 Note that the 'x' index is the trailing index. <br>
287 usage: <TT> value_type value = image[2][1] </TT>
288 */
289 pointer operator[](std::ptrdiff_t dy)
290 {
291 VIGRA_ASSERT_INSIDE(difference_type(0, dy));
292 return data_ + dy*stride_;
293 }
294
295 /** read pixel at given location.
296 Note that the 'x' index is the trailing index. <br>
297 usage: <TT> value_type value = image[2][1] </TT>
298 */
299 const_pointer operator[](std::ptrdiff_t dy) const
300 {
301 VIGRA_ASSERT_INSIDE(difference_type(0,dy));
302 return data_ + dy*stride_;
303 }
304
305 /** init 2D random access iterator pointing to upper left pixel
306 */
307 traverser upperLeft()
308 {
309 return traverser(data_, stride_);
310 }
311
312 /** init 2D random access iterator pointing to
313 pixel(width, height), i.e. one pixel right and below lower right
314 corner of the image as is common in C/C++.
315 */
316 traverser lowerRight()
317 {
318 return upperLeft() + size();
319 }
320
321 /** init 2D random access const iterator pointing to upper left pixel
322 */
323 const_traverser upperLeft() const
324 {
325 return const_traverser(data_, stride_);
326 }
327
328 /** init 2D random access const iterator pointing to
329 pixel(width, height), i.e. one pixel right and below lower right
330 corner of the image as is common in C/C++.
331 */
332 const_traverser lowerRight() const
333 {
334 return upperLeft() + size();
335 }
336
337 /** init 1D random access iterator pointing to first pixel.
338 Note: Only works if stride equals width.
339 */
340 iterator begin()
341 {
342 vigra_precondition(stride_ == width_,
343 "BasicImageView::begin(): "
344 "can only create scan order iterator if width() == stride().");
345 return data_;
346 }
347
348 /** init 1D random access iterator pointing past the end.
349 Note: Only works if stride equals width.
350 */
351 iterator end()
352 {
353 vigra_precondition(stride_ == width_,
354 "BasicImageView::end(): "
355 "can only create scan order iterator if width() == stride().");
356 return data_ + width() * height();
357 }
358
359 /** init 1D random access const iterator pointing to first pixel.
360 Note: Only works if stride equals width.
361 */
362 const_iterator begin() const
363 {
364 vigra_precondition(stride_ == width_,
365 "BasicImageView::begin(): "
366 "can only create scan order iterator if width() == stride().");
367 return data_;
368 }
369
370 /** init 1D random access const iterator pointing past the end.
371 Note: Only works if stride equals width.
372 */
373 const_iterator end() const
374 {
375 vigra_precondition(stride_ == width_,
376 "BasicImageView::end(): "
377 "can only create scan order iterator if width() == stride().");
378 return data_ + width() * height();
379 }
380
381 /** init 1D random access iterator pointing to first pixel of row \a y
382 */
383 row_iterator rowBegin(std::ptrdiff_t y)
384 {
385 return data_ + stride_ * y;
386 }
387
388 /** init 1D random access iterator pointing past the end of row \a y
389 */
390 row_iterator rowEnd(std::ptrdiff_t y)
391 {
392 return rowBegin(y) + width();
393 }
394
395 /** init 1D random access const iterator pointing to first pixel of row \a y
396 */
397 const_row_iterator rowBegin(std::ptrdiff_t y) const
398 {
399 return data_ + stride_ * y;
400 }
401
402 /** init 1D random access const iterator pointing past the end of row \a y
403 */
404 const_row_iterator rowEnd(std::ptrdiff_t y) const
405 {
406 return rowBegin(y) + width();
407 }
408
409 /** init 1D random access iterator pointing to first pixel of column \a x
410 */
411 column_iterator columnBegin(std::ptrdiff_t x)
412 {
413 typedef typename column_iterator::BaseType Iter;
414 return column_iterator(Iter(data_ + x, stride_));
415 }
416
417 /** init 1D random access iterator pointing past the end of column \a x
418 */
419 column_iterator columnEnd(std::ptrdiff_t x)
420 {
421 return columnBegin(x) + height();
422 }
423
424 /** init 1D random access const iterator pointing to first pixel of column \a x
425 */
426 const_column_iterator columnBegin(std::ptrdiff_t x) const
427 {
428 typedef typename const_column_iterator::BaseType Iter;
429 return const_column_iterator(Iter(data_ + x, stride_));
430 }
431
432 /** init 1D random access const iterator pointing past the end of column \a x
433 */
434 const_column_iterator columnEnd(std::ptrdiff_t x) const
435 {
436 return columnBegin(x) + height();
437 }
438
439 /** get a pointer to the internal data
440 */
441 const_pointer data() const
442 {
443 return data_;
444 }
445
446 /** return default accessor
447 */
448 Accessor accessor()
449 {
450 return Accessor();
451 }
452
453 /** return default const accessor
454 */
455 ConstAccessor accessor() const
456 {
457 return ConstAccessor();
458 }
459
460 private:
461
462 pointer data_;
463 std::ptrdiff_t width_, height_, stride_;
464 };
465
466
467 /********************************************************/
468 /* */
469 /* argument object factories */
470 /* */
471 /********************************************************/
472
473 template <class PixelType, class Accessor>
474 inline triple<typename BasicImageView<PixelType>::const_traverser,
475 typename BasicImageView<PixelType>::const_traverser, Accessor>
476 srcImageRange(BasicImageView<PixelType> const & img, Accessor a)
477 {
478 return triple<typename BasicImageView<PixelType>::const_traverser,
479 typename BasicImageView<PixelType>::const_traverser,
480 Accessor>(img.upperLeft(),
481 img.lowerRight(),
482 a);
483 }
484
485 template <class PixelType, class Accessor>
486 inline triple<typename BasicImageView<PixelType>::const_traverser,
487 typename BasicImageView<PixelType>::const_traverser, Accessor>
488 srcImageRange(BasicImageView<PixelType> const & img, Rect2D const & roi, Accessor a)
489 {
490 vigra_precondition(roi.left() >= 0 && roi.top() >= 0 &&
491 roi.right() <= img.width() && roi.bottom() <= img.height(),
492 "srcImageRange(): ROI rectangle outside image.");
493 return triple<typename BasicImageView<PixelType>::const_traverser,
494 typename BasicImageView<PixelType>::const_traverser,
495 Accessor>(img.upperLeft() + roi.upperLeft(),
496 img.upperLeft() + roi.lowerRight(),
497 a);
498 }
499
500 template <class PixelType, class Accessor>
501 inline pair<typename BasicImageView<PixelType>::const_traverser, Accessor>
502 srcImage(BasicImageView<PixelType> const & img, Accessor a)
503 {
504 return pair<typename BasicImageView<PixelType>::const_traverser,
505 Accessor>(img.upperLeft(), a);
506 }
507
508 template <class PixelType, class Accessor>
509 inline pair<typename BasicImageView<PixelType>::const_traverser, Accessor>
510 srcImage(BasicImageView<PixelType> const & img, Point2D const & ul, Accessor a)
511 {
512 vigra_precondition(img.isInside(ul),
513 "srcImage(): ROI rectangle outside image.");
514 return pair<typename BasicImageView<PixelType>::const_traverser,
515 Accessor>(img.upperLeft() + ul, a);
516 }
517
518 template <class PixelType, class Accessor>
519 inline triple<typename BasicImageView<PixelType>::traverser,
520 typename BasicImageView<PixelType>::traverser, Accessor>
521 destImageRange(BasicImageView<PixelType> & img, Accessor a)
522 {
523 return triple<typename BasicImageView<PixelType>::traverser,
524 typename BasicImageView<PixelType>::traverser,
525 Accessor>(img.upperLeft(),
526 img.lowerRight(),
527 a);
528 }
529
530 template <class PixelType, class Accessor>
531 inline triple<typename BasicImageView<PixelType>::traverser,
532 typename BasicImageView<PixelType>::traverser, Accessor>
533 destImageRange(BasicImageView<PixelType> & img, Rect2D const & roi, Accessor a)
534 {
535 vigra_precondition(roi.left() >= 0 && roi.top() >= 0 &&
536 roi.right() <= img.width() && roi.bottom() <= img.height(),
537 "destImageRange(): ROI rectangle outside image.");
538 return triple<typename BasicImageView<PixelType>::traverser,
539 typename BasicImageView<PixelType>::traverser,
540 Accessor>(img.upperLeft() + roi.upperLeft(),
541 img.upperLeft() + roi.lowerRight(),
542 a);
543 }
544
545 template <class PixelType, class Accessor>
546 inline pair<typename BasicImageView<PixelType>::traverser, Accessor>
547 destImage(BasicImageView<PixelType> & img, Accessor a)
548 {
549 return pair<typename BasicImageView<PixelType>::traverser,
550 Accessor>(img.upperLeft(), a);
551 }
552
553 template <class PixelType, class Accessor>
554 inline pair<typename BasicImageView<PixelType>::traverser, Accessor>
555 destImage(BasicImageView<PixelType> & img, Point2D const & ul, Accessor a)
556 {
557 vigra_precondition(img.isInside(ul),
558 "destImage(): ROI rectangle outside image.");
559 return pair<typename BasicImageView<PixelType>::traverser,
560 Accessor>(img.upperLeft() + ul, a);
561 }
562
563 template <class PixelType, class Accessor>
564 inline pair<typename BasicImageView<PixelType>::const_traverser, Accessor>
565 maskImage(BasicImageView<PixelType> const & img, Accessor a)
566 {
567 return pair<typename BasicImageView<PixelType>::const_traverser,
568 Accessor>(img.upperLeft(), a);
569 }
570
571 template <class PixelType, class Accessor>
572 inline pair<typename BasicImageView<PixelType>::const_traverser, Accessor>
573 maskImage(BasicImageView<PixelType> const & img, Point2D const & ul, Accessor a)
574 {
575 vigra_precondition(img.isInside(ul),
576 "maskImage(): ROI rectangle outside image.");
577 return pair<typename BasicImageView<PixelType>::const_traverser,
578 Accessor>(img.upperLeft() + ul, a);
579 }
580
581 /****************************************************************/
582
583 template <class PixelType>
584 inline triple<typename BasicImageView<PixelType>::const_traverser,
585 typename BasicImageView<PixelType>::const_traverser,
586 typename BasicImageView<PixelType>::ConstAccessor>
587 srcImageRange(BasicImageView<PixelType> const & img)
588 {
589 return triple<typename BasicImageView<PixelType>::const_traverser,
590 typename BasicImageView<PixelType>::const_traverser,
591 typename BasicImageView<PixelType>::ConstAccessor>(img.upperLeft(),
592 img.lowerRight(),
593 img.accessor());
594 }
595
596 template <class PixelType>
597 inline triple<typename BasicImageView<PixelType>::const_traverser,
598 typename BasicImageView<PixelType>::const_traverser,
599 typename BasicImageView<PixelType>::ConstAccessor>
600 srcImageRange(BasicImageView<PixelType> const & img, Rect2D const & roi)
601 {
602 vigra_precondition(roi.left() >= 0 && roi.top() >= 0 &&
603 roi.right() <= img.width() && roi.bottom() <= img.height(),
604 "srcImageRange(): ROI rectangle outside image.");
605 return triple<typename BasicImageView<PixelType>::const_traverser,
606 typename BasicImageView<PixelType>::const_traverser,
607 typename BasicImageView<PixelType>::ConstAccessor>(img.upperLeft() + roi.upperLeft(),
608 img.upperLeft() + roi.lowerRight(),
609 img.accessor());
610 }
611
612 template <class PixelType>
613 inline pair< typename BasicImageView<PixelType>::const_traverser,
614 typename BasicImageView<PixelType>::ConstAccessor>
615 srcImage(BasicImageView<PixelType> const & img)
616 {
617 return pair<typename BasicImageView<PixelType>::const_traverser,
618 typename BasicImageView<PixelType>::ConstAccessor>(img.upperLeft(),
619 img.accessor());
620 }
621
622 template <class PixelType>
623 inline pair< typename BasicImageView<PixelType>::const_traverser,
624 typename BasicImageView<PixelType>::ConstAccessor>
625 srcImage(BasicImageView<PixelType> const & img, Point2D const & ul)
626 {
627 vigra_precondition(img.isInside(ul),
628 "srcImage(): ROI rectangle outside image.");
629 return pair<typename BasicImageView<PixelType>::const_traverser,
630 typename BasicImageView<PixelType>::ConstAccessor>(img.upperLeft() + ul,
631 img.accessor());
632 }
633
634 template <class PixelType>
635 inline triple< typename BasicImageView<PixelType>::traverser,
636 typename BasicImageView<PixelType>::traverser,
637 typename BasicImageView<PixelType>::Accessor>
638 destImageRange(BasicImageView<PixelType> & img)
639 {
640 return triple<typename BasicImageView<PixelType>::traverser,
641 typename BasicImageView<PixelType>::traverser,
642 typename BasicImageView<PixelType>::Accessor>(img.upperLeft(),
643 img.lowerRight(),
644 img.accessor());
645 }
646
647 template <class PixelType>
648 inline triple< typename BasicImageView<PixelType>::traverser,
649 typename BasicImageView<PixelType>::traverser,
650 typename BasicImageView<PixelType>::Accessor>
651 destImageRange(BasicImageView<PixelType> & img, Rect2D const & roi)
652 {
653 vigra_precondition(roi.left() >= 0 && roi.top() >= 0 &&
654 roi.right() <= img.width() && roi.bottom() <= img.height(),
655 "destImageRange(): ROI rectangle outside image.");
656 return triple<typename BasicImageView<PixelType>::traverser,
657 typename BasicImageView<PixelType>::traverser,
658 typename BasicImageView<PixelType>::Accessor>(img.upperLeft() + roi.upperLeft(),
659 img.upperLeft() + roi.lowerRight(),
660 img.accessor());
661 }
662
663 template <class PixelType>
664 inline pair< typename BasicImageView<PixelType>::traverser,
665 typename BasicImageView<PixelType>::Accessor>
666 destImage(BasicImageView<PixelType> & img)
667 {
668 return pair<typename BasicImageView<PixelType>::traverser,
669 typename BasicImageView<PixelType>::Accessor>(img.upperLeft(),
670 img.accessor());
671 }
672
673 template <class PixelType>
674 inline pair< typename BasicImageView<PixelType>::traverser,
675 typename BasicImageView<PixelType>::Accessor>
676 destImage(BasicImageView<PixelType> & img, Point2D const & ul)
677 {
678 vigra_precondition(img.isInside(ul),
679 "destImage(): ROI rectangle outside image.");
680 return pair<typename BasicImageView<PixelType>::traverser,
681 typename BasicImageView<PixelType>::Accessor>(img.upperLeft() + ul,
682 img.accessor());
683 }
684
685 template <class PixelType>
686 inline pair< typename BasicImageView<PixelType>::const_traverser,
687 typename BasicImageView<PixelType>::ConstAccessor>
688 maskImage(BasicImageView<PixelType> const & img)
689 {
690 return pair<typename BasicImageView<PixelType>::const_traverser,
691 typename BasicImageView<PixelType>::ConstAccessor>(img.upperLeft(),
692 img.accessor());
693 }
694
695 template <class PixelType>
696 inline pair< typename BasicImageView<PixelType>::const_traverser,
697 typename BasicImageView<PixelType>::ConstAccessor>
698 maskImage(BasicImageView<PixelType> const & img, Point2D const & ul)
699 {
700 vigra_precondition(img.isInside(ul),
701 "maskImage(): ROI rectangle outside image.");
702 return pair<typename BasicImageView<PixelType>::const_traverser,
703 typename BasicImageView<PixelType>::ConstAccessor>(img.upperLeft() + ul,
704 img.accessor());
705 }
706
707 } // namespace vigra
708 #undef VIGRA_ASSERT_INSIDE
709 #endif /* VIGRA_BASICIMAGEVIEW_HXX */
vigra::BasicImageView::Accessor
IteratorTraits< traverser >::DefaultAccessor Accessor
Definition: basicimageview.hxx:169
vigra::BasicImageView::BasicImageView
BasicImageView(const_pointer data, std::ptrdiff_t w, std::ptrdiff_t h, std::ptrdiff_t stride=0)
Definition: basicimageview.hxx:187
vigra::BasicImageView::operator[]
reference operator[](difference_type const &d)
Definition: basicimageview.hxx:252
vigra::BasicImageView::upperLeft
const_traverser upperLeft() const
Definition: basicimageview.hxx:323
vigra::BasicImageView::operator()
const_reference operator()(std::ptrdiff_t dx, std::ptrdiff_t dy) const
Definition: basicimageview.hxx:279
vigra::BasicImageView::Iterator
ImageIterator< value_type > Iterator
Definition: basicimageview.hxx:132
vigra::BasicImageView::pointer
PIXELTYPE * pointer
Definition: basicimageview.hxx:100
vigra::BasicImageView::const_reference
PIXELTYPE const & const_reference
Definition: basicimageview.hxx:96
vigra::initImage
void initImage(...)
Write a value to every pixel in an image or rectangular ROI.
vigra::Diff2D::y
int y
Definition: diff2d.hxx:392
vigra::BasicImageView::rowEnd
const_row_iterator rowEnd(std::ptrdiff_t y) const
Definition: basicimageview.hxx:404
vigra::BasicImageView::operator()
reference operator()(std::ptrdiff_t dx, std::ptrdiff_t dy)
Definition: basicimageview.hxx:270
vigra::BasicImageView::columnEnd
const_column_iterator columnEnd(std::ptrdiff_t x) const
Definition: basicimageview.hxx:434
vigra::BasicImageView::rowEnd
row_iterator rowEnd(std::ptrdiff_t y)
Definition: basicimageview.hxx:390
vigra::BasicImageView::reference
PIXELTYPE & reference
Definition: basicimageview.hxx:91
vigra::Diff2D::x
int x
Definition: diff2d.hxx:385
vigra::ImageIteratorBase< ImageIterator< PIXELTYPE >, PIXELTYPE, PIXELTYPE &, PIXELTYPE * >::row_iterator
RowIteratorSelector::res row_iterator
Definition: imageiterator.hxx:605
vigra::Diff2D
Two dimensional difference vector.
Definition: diff2d.hxx:185
vigra::BasicImageView::lowerRight
traverser lowerRight()
Definition: basicimageview.hxx:316
vigra::BasicImageView::rowBegin
row_iterator rowBegin(std::ptrdiff_t y)
Definition: basicimageview.hxx:383
vigra::ImageIteratorBase< ImageIterator< PIXELTYPE >, PIXELTYPE, PIXELTYPE &, PIXELTYPE * >::column_iterator
ColumnIteratorSelector::res column_iterator
Definition: imageiterator.hxx:609
vigra::BasicImageView::size_type
Size2D size_type
Definition: basicimageview.hxx:164
vigra::BasicImageView::ScanOrderIterator
PIXELTYPE * ScanOrderIterator
Definition: basicimageview.hxx:114
vigra::BasicImageView::traverser
ImageIterator< value_type > traverser
Definition: basicimageview.hxx:128
vigra::BasicImageView::column_iterator
traverser::column_iterator column_iterator
Definition: basicimageview.hxx:152
vigra::ConstImageIterator
Standard 2D random access const iterator for images that store the data as a linear array...
Definition: imageiterator.hxx:893
vigra::BasicImageView::height
std::ptrdiff_t height() const
Definition: basicimageview.hxx:221
vigra::BasicImageView::ConstIterator
ConstImageIterator< value_type > ConstIterator
Definition: basicimageview.hxx:140
vigra::BasicImageView::const_iterator
PIXELTYPE const * const_iterator
Definition: basicimageview.hxx:120
vigra::BasicImageView::const_row_iterator
const_traverser::row_iterator const_row_iterator
Definition: basicimageview.hxx:148
vigra::Size2D
Two dimensional size object.
Definition: diff2d.hxx:482
vigra::BasicImageView::accessor
ConstAccessor accessor() const
Definition: basicimageview.hxx:455
vigra::BasicImageView::end
const_iterator end() const
Definition: basicimageview.hxx:373
vigra::BasicImageView::row_iterator
traverser::row_iterator row_iterator
Definition: basicimageview.hxx:144
vigra::BasicImageView::iterator
PIXELTYPE * iterator
Definition: basicimageview.hxx:110
vigra::BasicImageView::end
iterator end()
Definition: basicimageview.hxx:351
vigra::BasicImageView::operator[]
pointer operator[](std::ptrdiff_t dy)
Definition: basicimageview.hxx:289
vigra::BasicImageView::isInside
bool isInside(difference_type const &d) const
Definition: basicimageview.hxx:243
vigra::BasicImageView::operator[]
const_reference operator[](difference_type const &d) const
Definition: basicimageview.hxx:261
vigra::BasicImageView::columnEnd
column_iterator columnEnd(std::ptrdiff_t x)
Definition: basicimageview.hxx:419
vigra::BasicImageView::difference_type
Diff2D difference_type
Definition: basicimageview.hxx:160
vigra::BasicImageView::BasicImageView
BasicImageView()
Definition: basicimageview.hxx:178
vigra::BasicImageView::const_column_iterator
const_traverser::column_iterator const_column_iterator
Definition: basicimageview.hxx:156
vigra::BasicImageView::width
std::ptrdiff_t width() const
Definition: basicimageview.hxx:214
vigra::BasicImageView::data
const_pointer data() const
Definition: basicimageview.hxx:441
vigra::BasicImageView::lowerRight
const_traverser lowerRight() const
Definition: basicimageview.hxx:332
vigra::BasicImageView::init
BasicImageView & init(value_type const &pixel)
Definition: basicimageview.hxx:205
vigra::BasicImageView
BasicImage using foreign memory.
Definition: basicimageview.hxx:76
vigra::BasicImageView::value_type
PIXELTYPE value_type
Definition: basicimageview.hxx:82
vigra::BasicImageView::upperLeft
traverser upperLeft()
Definition: basicimageview.hxx:307
vigra::BasicImageView::columnBegin
column_iterator columnBegin(std::ptrdiff_t x)
Definition: basicimageview.hxx:411
vigra::BasicImageView::begin
iterator begin()
Definition: basicimageview.hxx:340
vigra::BasicImageView::columnBegin
const_column_iterator columnBegin(std::ptrdiff_t x) const
Definition: basicimageview.hxx:426
vigra::BasicImageView::const_traverser
ConstImageIterator< value_type > const_traverser
Definition: basicimageview.hxx:136
vigra::BasicImageView::ConstAccessor
IteratorTraits< const_traverser >::DefaultAccessor ConstAccessor
Definition: basicimageview.hxx:174
vigra::ImageIterator
Standard 2D random access iterator for images that store the data in a linear array.
Definition: imageiterator.hxx:848
vigra::BasicImageView::begin
const_iterator begin() const
Definition: basicimageview.hxx:362
vigra::BasicImageView::accessor
Accessor accessor()
Definition: basicimageview.hxx:448
vigra::BasicImageView::rowBegin
const_row_iterator rowBegin(std::ptrdiff_t y) const
Definition: basicimageview.hxx:397
vigra::StandardAccessor
Encapsulate access to the values an iterator points to.
Definition: accessor.hxx:133
vigra::BasicImageView::operator[]
const_pointer operator[](std::ptrdiff_t dy) const
Definition: basicimageview.hxx:299
vigra::BasicImageView::size
size_type size() const
Definition: basicimageview.hxx:236
vigra::BasicImageView::ConstScanOrderIterator
PIXELTYPE const * ConstScanOrderIterator
Definition: basicimageview.hxx:124
vigra::BasicImageView::const_pointer
PIXELTYPE const * const_pointer
Definition: basicimageview.hxx:104
vigra::BasicImageView::PixelType
PIXELTYPE PixelType
Definition: basicimageview.hxx:86
vigra::BasicImageView::BasicImageView
BasicImageView(const_pointer data, difference_type const &size, std::ptrdiff_t stride=0)
Definition: basicimageview.hxx:196
vigra::BasicImageView::stride
std::ptrdiff_t stride() const
Definition: basicimageview.hxx:229

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python vigra 1.11.0 (Fri May 19 2017)