This file is indexed.

/usr/include/vigra/imagecontainer.hxx is in libvigraimpex-dev 1.9.0+dfsg-10+b2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
/************************************************************************/
/*                                                                      */
/*               Copyright 1998-2002 by Ullrich Koethe                  */
/*                                                                      */
/*    This file is part of the VIGRA computer vision library.           */
/*    The VIGRA Website is                                              */
/*        http://hci.iwr.uni-heidelberg.de/vigra/                       */
/*    Please direct questions, bug reports, and contributions to        */
/*        ullrich.koethe@iwr.uni-heidelberg.de    or                    */
/*        vigra@informatik.uni-hamburg.de                               */
/*                                                                      */
/*    Permission is hereby granted, free of charge, to any person       */
/*    obtaining a copy of this software and associated documentation    */
/*    files (the "Software"), to deal in the Software without           */
/*    restriction, including without limitation the rights to use,      */
/*    copy, modify, merge, publish, distribute, sublicense, and/or      */
/*    sell copies of the Software, and to permit persons to whom the    */
/*    Software is furnished to do so, subject to the following          */
/*    conditions:                                                       */
/*                                                                      */
/*    The above copyright notice and this permission notice shall be    */
/*    included in all copies or substantial portions of the             */
/*    Software.                                                         */
/*                                                                      */
/*    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND    */
/*    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES   */
/*    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND          */
/*    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT       */
/*    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,      */
/*    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      */
/*    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR     */
/*    OTHER DEALINGS IN THE SOFTWARE.                                   */
/*                                                                      */
/************************************************************************/

#ifndef VIGRA_IMAGECONTAINER_HXX
#define VIGRA_IMAGECONTAINER_HXX

#include "utilities.hxx"
#include "array_vector.hxx"
#include "copyimage.hxx"

namespace vigra {

/** \addtogroup ImageContainers Image Containers
    Classes to manage multiple images (ImageArray..)
*/
//@{

/********************************************************/
/*                                                      */
/*                      ImageArray                      */
/*                                                      */
/********************************************************/

/** \brief Fundamental class template for arrays of equal-sized images.

    An ImageArray manages an array of images of the type given as
    template parameter. Use it like a ArrayVector<ImageType>, it has
    the same interface, only operator< is missing from ImageArray. It
    offers additional functions for resizing the images and querying
    their common size. See \ref imageSize() for additional notes.

    A customized allocator can be passed as a template argument and via the constructor.
    By default, the allocator of the <tt>ImageType</tt> is reused.

    <b>\#include</b> \<vigra/imagecontainer.hxx\>

    Namespace: vigra
*/
template <class ImageType,
      class Alloc = typename ImageType::allocator_type::template rebind<ImageType>::other >
class ImageArray
{
    Size2D imageSize_;

protected:
    typedef ArrayVector<ImageType, Alloc> ImageVector;
    ImageVector images_;

public:
        /** the type of the contained values/images
         */
    typedef ImageType    value_type;

    typedef typename ImageVector::iterator iterator;
    typedef typename ImageVector::const_iterator const_iterator;
    typedef typename ImageVector::reverse_iterator reverse_iterator;
    typedef typename ImageVector::const_reverse_iterator const_reverse_iterator;
    typedef typename ImageVector::reference reference;
    typedef typename ImageVector::const_reference const_reference;
#if !defined(_MSC_VER) || _MSC_VER >= 1300
    typedef typename ImageVector::pointer pointer;
#endif
    typedef typename ImageVector::difference_type difference_type;
    typedef typename ImageVector::size_type size_type;

        /** init an array of numImages equal-sized images; use the specified allocator.
         */
    ImageArray(unsigned int numImages, const Diff2D &imageSize,
               Alloc const & alloc = Alloc())
        : imageSize_(imageSize),
          images_(numImages, ImageType(), alloc)
    {
        for(unsigned int i=0; i<numImages; i++)
            images_[i].resize(Size2D(imageSize));
    }

        /** Init an array of numImages equal-sized images. The size
            depends on ImageType's default constructor (so it will
            usually be 0x0); use the specified allocator.
         */
    ImageArray(unsigned int numImages= 0, Alloc const & alloc = Alloc())
        : images_(numImages, alloc)
    {
        imageSize_= empty()? Size2D(0, 0) : front().size();
    }

        /** fill constructor: Init an array with numImages copies of
            the given image. (STL-Sequence interface); use the specified allocator.
         */
    ImageArray(unsigned int numImages, const ImageType &image, Alloc const & alloc = Alloc())
        : imageSize_(image.size()),
          images_(numImages, image, alloc)
    {
    }

        /** range constructor: Construct an array containing copies of
            the images in [begin, end). Those images must all have the
            same size, see \ref imageSize(). (STL-Sequence interface);
            use the specified allocator.
         */
    template<class InputIterator>
    ImageArray(InputIterator begin, InputIterator end, Alloc const & alloc = Alloc())
        : imageSize_(begin!=end? (*begin).size() : Size2D(0,0)),
          images_(begin, end, alloc)
    {
    }

    virtual ~ImageArray() {}

        /** Operator for a vector-like access to the contained images
            (STL-Vector interface)
         */
    reference operator [](size_type index)
    {
        return images_[index];
    }

        /** Operator for a vector-like access to the contained images
            (STL-Vector interface)
         */
    const_reference operator [](size_type index) const
    {
        return images_[index];
    }

        /** Returns an iterator pointing to the first image
            (STL-Container interface)
         */
    iterator begin()
    {
        return images_.begin();
    }

        /** Returns an iterator pointing to the first image
            (STL-Container interface)
         */
    const_iterator begin() const
    {
        return images_.begin();
    }

        /** Returns an iterator pointing behind the last image
            (STL-Container interface)
         */
    iterator end()
    {
        return images_.end();
    }

        /** Returns an iterator pointing behind the last image
            (STL-Container interface)
         */
    const_iterator end() const
    {
        return images_.end();
    }

        /** Returns a reverse_iterator pointing to the first image of
            the reversed view of this array (STL-Reversable Container
            interface)
         */
    reverse_iterator rbegin()
    {
        return images_.rbegin();
    }

        /** Returns a reverse_iterator pointing to the first image of
            the reversed view of this array (STL-Reversable Container
            interface)
         */
    const_reverse_iterator rbegin() const
    {
        return images_.rbegin();
    }

        /** Returns a reverse_iterator pointing behind the last image
            of the reversed view of this array (STL-Reversable
            Container interface)
         */
    reverse_iterator rend()
    {
        return images_.rend();
    }

        /** Returns a reverse_iterator pointing behind the last image
            of the reversed view of this array (STL-Reversable
            Container interface)
         */
    const_reverse_iterator rend() const
    {
        return images_.rend();
    }

        /** Query size of this ImageArray, that is: the number of
            images. (STL-Container interface)
        */
    size_type size() const
    {
        return images_.size();
    }

        /** Query maximum size of this ImageArray, that is: the
            max. parameter you may pass to resize(). (STL-Container
            interface)
        */
    size_type max_size() const
    {
        return images_.max_size();
    }

        /** Returns true if and only if there are no contained
            images. (STL-Container interface)
        */
    bool empty()
    {
        return images_.empty();
    }

        /** Returns true if and only if both ImageArrays have exactly
            the same contents and all images did compare equal with the
            corresponding image in the other ImageArray. (STL-Forward
            Container interface)
         */
    bool operator ==(const ImageArray<ImageType, Alloc> &other)
    {
        return (imageSize() == other.imageSize())
                && (images_ == other.images_);
    }

        /** Insert image at/before pos. (STL-Sequence interface)
         */
    iterator insert(iterator pos, const_reference image)
    {
        return images_.insert(pos, image);
    }

        /** Insert count copies of image at/before pos. (STL-Sequence
            interface)
         */
    void insert (iterator pos, size_type count, const_reference image);

        /** Insert copies of images from [begin, end) at/before
            pos. (STL-Sequence interface)
         */
    template<class InputIterator>
    void insert(iterator pos, InputIterator begin, InputIterator end)
    {
        images_.insert(pos, begin, end);
    }

        /** Removes the image at pos from this array. (STL-Sequence
            interface)
         */
    iterator erase(iterator pos)
    {
        return images_.erase(pos);
    }

        /** Removes the images from [begin, end) from this
            array. (STL-Sequence interface)
         */
    iterator erase(iterator begin, iterator end)
    {
        return images_.erase(begin, end);
    }

        /** Empty this array. (STL-Sequence interface)
         */
    void clear()
    {
        images_.clear();
    }

        /** Resize this ImageArray, throwing the last images away if
            you make the array smaller or appending new images of the
            right size at the end of the array if you make it
            larger. (STL-Sequence interface)
        */
    void resize(size_type newSize)
    {
        if (newSize != size())
        {
            size_type oldSize= size();
            images_.resize(newSize);
            for (size_type i= oldSize; i<newSize; i++)
                images_[i].resize(imageSize());
        }
    }

        /** Resize this ImageArray, throwing the last images away if
            you make the array smaller or appending new copies of image
            at the end of the array if you make it larger.
            precondition: <tt>image.size() == imageSize()</tt>
            (STL-Sequence interface)
        */
    void resize(size_type newSize, ImageType &image)
    {
        if (newSize != size())
        {
            vigra_precondition(image.size() == imageSize(),
                               "trying to append images of wrong size to ImageArray with resize()");
            images_.resize(newSize, image);
        }
    }

        /** return the first image. (STL-Sequence interface)
         */
    reference front()
    {
        return images_.front();
    }

        /** return the first image. (STL-Sequence interface)
         */
    const_reference front() const
    {
        return images_.front();
    }

        /** return the last image. (STL-Vector interface)
         */
    reference back()
    {
        return images_.back();
    }

        /** return the last image. (STL-Vector interface)
         */
    const_reference back() const
    {
        return images_.back();
    }

        /** append image to array (STL-Back Insertion Sequence interface)
         */
    void push_back(const_reference image)
    {
        images_.push_back(image);
    }

        /** remove last image from array (STL-Back Insertion Sequence interface)
         */
    void pop_back()
    {
        images_.pop_back();
    }

        /** swap contents of this array with the contents of other
            (STL-Container interface)
         */
    void swap(const_reference other)
    {
        Size2D oldImageSize = imageSize_;
        images_.swap(other.images_);
        imageSize_ = other.imageSize_;
        other.imageSize_ = oldImageSize;
    }

        /** number of image objects for which memory has been allocated
            (STL-Vector interface)
        */
    size_type capacity() const
    {
        return images_.capacity();
    }

        /** increase capacity(). (STL-Vector interface)
         */
    void reserve(size_type n)
    {
        images_.reserve(n);
    }

        /** Query the size of the contained images. ImageArray will
            maintain an array of equal-sized images of this
            size. However, <em>do not resize the contained images
            manually</em>. ImageArray currently has no way to detect or
            prevent this.
         */
    Size2D imageSize() const
        { return imageSize_; }

        /** Resize all images to a common new size (No-op if
            <tt>newSize == imageSize()</tt>). See \ref imageSize() for
            an important note about resizing the images.
        */
    virtual void resizeImages(const Diff2D &newSize)
    {
        if (newSize!=imageSize())
        {
            for(unsigned int i=0; i<size(); i++)
                images_[i].resize(Size2D(newSize));
            imageSize_= newSize;
        }
    }

        /** Resize all images to a common new size (No-op if
            <tt>newSize == imageSize()</tt>). See \ref imageSize() for
            an important note about resizing the images.

            (Convenience function, same as calling
            <tt>resizeImages(Diff2D(width, height));</tt>.)
        */
    void resizeImages(int width, int height)
    {
        resizeImages(Size2D(width, height));
    }
};

/********************************************************/
/*                                                      */
/*                      ImagePyramid                    */
/*                                                      */
/********************************************************/

/** \brief Class template for logarithmically tapering image pyramids.

    An ImagePyramid manages an array of images of the type given as
    template parameter, where each level has half the width and height
    of its predecessor.  It actually represents a sequence of pyramid
    levels whose start and end index are configurable.  For Burt-style
    pyramids, see also \ref pyramidReduceBurtFilter and \ref
    pyramidExpandBurtFilter.

    A customized allocator can be passed as a template argument and
    via the constructor.  By default, the allocator of the
    <tt>ImageType</tt> is reused.

    <b>\#include</b> \<vigra/imagecontainer.hxx\>

    Namespace: vigra
*/
template <class ImageType,
      class Alloc = typename ImageType::allocator_type::template rebind<ImageType>::other >
class ImagePyramid
{
    int lowestLevel_, highestLevel_;

protected:
    typedef ArrayVector<ImageType, Alloc> ImageVector;
    ImageVector images_;

public:
        /** the type of the contained values/images
         */
    typedef ImageType    value_type;

    typedef typename ImageVector::iterator iterator;
    typedef typename ImageVector::const_iterator const_iterator;
    typedef typename ImageVector::reverse_iterator reverse_iterator;
    typedef typename ImageVector::const_reverse_iterator const_reverse_iterator;
    typedef typename ImageVector::reference reference;
    typedef typename ImageVector::const_reference const_reference;
#if !defined(_MSC_VER) || _MSC_VER >= 1300
    typedef typename ImageVector::pointer pointer;
#endif
    typedef typename ImageVector::difference_type difference_type;
    typedef int size_type;

        /** Init a pyramid between the given levels (inclusive).
         *
         * Allocate the given \a imageSize at the pyramid level given
         * in \a sizeAppliesToLevel (default: level 0 / bottom) and
         * size the other levels using recursive reduction/expansion
         * by factors of 2.  Use the specified allocator for image
         * creation.  The image type must be default constructible and
         * resizable.  sizeAppliesToLevel must be the in range
         * lowestLevel..highestLevel (inclusive).
         */
    ImagePyramid(int lowestLevel, int highestLevel,
                 const Diff2D &imageSize, int sizeAppliesToLevel = 0,
                 Alloc const & alloc = Alloc())
        : lowestLevel_(0), highestLevel_(-1),
          images_(alloc)
    {
        resize(lowestLevel, highestLevel, imageSize, sizeAppliesToLevel);
    }

        /**
         * Init a pyramid between the given levels (inclusive).
         *
         * Copy the given \a image into the pyramid level given in \a
         * copyImageToLevel (default: level 0 / bottom) and size the
         * other levels using recursive reduction/expansion by factors
         * of 2 (their image data is not initialized).  Use the
         * specified allocator for image creation.  The image type
         * must be default constructible and resizable.
         * sizeAppliesToLevel must be the in range
         * lowestLevel..highestLevel (inclusive).
         */
    ImagePyramid(int lowestLevel, int highestLevel,
                 const ImageType &image, int copyImageToLevel = 0,
                 Alloc const & alloc = Alloc())
        : lowestLevel_(0), highestLevel_(-1),
          images_(alloc)
    {
        resize(lowestLevel, highestLevel, image.size(), copyImageToLevel);
        copyImage(srcImageRange(image), destImage((*this)[copyImageToLevel]));
    }

        /**
         * Init a pyramid between the given levels (inclusive).
         *
         * Copy the image given by the range \a ul to \a lr into the
         * pyramid level given in \a copyImageToLevel (default: level
         * 0 / bottom) and size the other levels using recursive
         * reduction/expansion by factors of 2 (their image data is
         * not initialized).  Use the specified allocator for image
         * creation.  The image type must be default constructible and
         * resizable.  sizeAppliesToLevel must be the in range
         * lowestLevel..highestLevel (inclusive).
         */
    template <class SrcIterator, class SrcAccessor>
    ImagePyramid(int lowestLevel, int highestLevel,
                 SrcIterator ul, SrcIterator lr, SrcAccessor src,
                 int copyImageToLevel = 0,
                 Alloc const & alloc = Alloc())
        : lowestLevel_(0), highestLevel_(-1),
          images_(alloc)
    {
        resize(lowestLevel, highestLevel, lr - ul, copyImageToLevel);
        copyImage(srcIterRange(ul, lr, src), destImage((*this)[copyImageToLevel]));
    }

        /** Init an empty pyramid.  Use the specified allocator.
         */
    ImagePyramid(Alloc const & alloc = Alloc())
        : lowestLevel_(0), highestLevel_(-1),
          images_(alloc)
    {}

    virtual ~ImagePyramid() {}

        /** Get the index of the lowest allocated level of the pyramid.
        */
    int lowestLevel() const
    {
        return lowestLevel_;
    }

        /** Get the index of the highest allocated level of the pyramid.
        */
    int highestLevel() const
    {
        return highestLevel_;
    }

        /** Operator for a vector-like access to the contained images
            (STL-Vector interface)
         */
    reference operator [](size_type index)
    {
        return images_[index - lowestLevel_];
    }

        /** Operator for a vector-like access to the contained images
            (STL-Vector interface)
         */
    const_reference operator [](size_type index) const
    {
        return images_[index - lowestLevel_];
    }

        /** Returns an iterator pointing to the first image
            (STL-Container interface)
         */
    iterator begin()
    {
        return images_.begin();
    }

        /** Returns an iterator pointing to the first image
            (STL-Container interface)
         */
    const_iterator begin() const
    {
        return images_.begin();
    }

        /** Returns an iterator pointing behind the last image
            (STL-Container interface)
         */
    iterator end()
    {
        return images_.end();
    }

        /** Returns an iterator pointing behind the last image
            (STL-Container interface)
         */
    const_iterator end() const
    {
        return images_.end();
    }

        /** Returns a reverse_iterator pointing to the first image of
            the reversed view of this array (STL-Reversable Container
            interface)
         */
    reverse_iterator rbegin()
    {
        return images_.rbegin();
    }

        /** Returns a reverse_iterator pointing to the first image of
            the reversed view of this array (STL-Reversable Container
            interface)
         */
    const_reverse_iterator rbegin() const
    {
        return images_.rbegin();
    }

        /** Returns a reverse_iterator pointing behind the last image
            of the reversed view of this array (STL-Reversable
            Container interface)
         */
    reverse_iterator rend()
    {
        return images_.rend();
    }

        /** Returns a reverse_iterator pointing behind the last image
            of the reversed view of this array (STL-Reversable
            Container interface)
         */
    const_reverse_iterator rend() const
    {
        return images_.rend();
    }

        /** Query size of this ImageArray, that is: the number of
            images. (STL-Container interface)
        */
    size_type size() const
    {
        return images_.size();
    }

        /** Returns true if and only if there are no contained
            images. (STL-Container interface)
        */
    bool empty()
    {
        return images_.empty();
    }

        /** Returns true if and only if both ImageArrays have exactly
            the same contents and all images did compare equal with the
            corresponding image in the other ImageArray. (STL-Forward
            Container interface)
         */
    bool operator ==(const ImagePyramid<ImageType, Alloc> &other) const
    {
        return (lowestLevel_ == other.lowestLevel_) && (highestLevel_ == other.highestLevel_) &&
                (images_ == other.images_);
    }

        /** Empty this array. (STL-Sequence interface)
         */
    void clear()
    {
        images_.clear();
        lowestLevel_ = 0;
        highestLevel_ = -1;
    }

        /** Resize this ImageArray, throwing the last images away if
            you make the array smaller or appending new images of the
            right size at the end of the array if you make it
            larger. (STL-Sequence interface)
        */
    void resize(int lowestLevel, int highestLevel,
                const Diff2D &imageSize, int sizeAppliesToLevel = 0)
    {
        vigra_precondition(lowestLevel <= highestLevel,
           "ImagePyramid::resize(): lowestLevel <= highestLevel required.");
        vigra_precondition(lowestLevel <= sizeAppliesToLevel && sizeAppliesToLevel <= highestLevel,
           "ImagePyramid::resize(): sizeAppliesToLevel must be between lowest and highest level (inclusive).");

        ImageVector images(highestLevel - lowestLevel + 1, ImageType());

        images[sizeAppliesToLevel - lowestLevel].resize(imageSize);
        for(int i=sizeAppliesToLevel + 1; i<=highestLevel; ++i)
        {
            unsigned int w = (images[i - 1 - lowestLevel].width() + 1) / 2;
            unsigned int h = (images[i - 1 - lowestLevel].height() + 1) / 2;
            images[i - lowestLevel].resize(w, h);
        }
        for(int i=sizeAppliesToLevel - 1; i>=lowestLevel; --i)
        {
            unsigned int w = 2*images[i + 1 - lowestLevel].width() - 1;
            unsigned int h = 2*images[i + 1 - lowestLevel].height() - 1;
            images[i - lowestLevel].resize(w, h);
        }

        images_.swap(images);
        lowestLevel_ = lowestLevel;
        highestLevel_ = highestLevel;
    }

        /** return the first image (lowestLevel()). (STL-Sequence interface)
         */
    reference front()
    {
        return images_.front();
    }

        /** return the first image (lowestLevel()). (STL-Sequence interface)
         */
    const_reference front() const
    {
        return images_.front();
    }

        /** return the last image (highestLevel()). (STL-Vector interface)
         */
    reference back()
    {
        return images_.back();
    }

        /** return the last image (highestLevel()). (STL-Vector interface)
         */
    const_reference back() const
    {
        return images_.back();
    }

        /** swap contents of this array with the contents of other
            (STL-Container interface)
         */
    void swap(const ImagePyramid<ImageType, Alloc> &other)
    {
        images_.swap(other.images_);
        std::swap(lowestLevel_, other.lowestLevel_);
        std::swap(highestLevel_, other.highestLevel_);
    }
};

//@}

} // namespace vigra

#endif // VIGRA_IMAGECONTAINER_HXX