SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MultispectralImage.hpp
Go to the documentation of this file.
1 /*
2  * Copyright(c):
3  * Signal Image and Communications (SIC) Department
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * - University of Poitiers, France http://www.univ-poitiers.fr
6  * - XLIM Institute UMR CNRS 7252 http://www.xlim.fr/
7  *
8  * and
9  *
10  * D2 Fluid, Thermic and Combustion
11  * - University of Poitiers, France http://www.univ-poitiers.fr
12  * - PPRIME Institute - UPR CNRS 3346 http://www.pprime.fr
13  * - ISAE-ENSMA http://www.ensma.fr
14  *
15  * Contributor(s):
16  * The SLIP team,
17  * Benoit Tremblais <tremblais_AT_sic.univ-poitiers.fr>,
18  * Laurent David <laurent.david_AT_lea.univ-poitiers.fr>,
19  * Ludovic Chatellier <ludovic.chatellier_AT_univ-poitiers.fr>,
20  * Lionel Thomas <lionel.thomas_AT_univ-poitiers.fr>,
21  * Denis Arrivault <arrivault_AT_sic.univ-poitiers.fr>,
22  * Julien Dombre <julien.dombre_AT_univ-poitiers.fr>.
23  *
24  * Description:
25  * The Simple Library of Image Processing (SLIP) is a new image processing
26  * library. It is written in the C++ language following as much as possible
27  * the ISO/ANSI C++ standard. It is consequently compatible with any system
28  * satisfying the ANSI C++ complience. It works on different Unix , Linux ,
29  * Mircrosoft Windows and Mac OS X plateforms. SLIP is a research library that
30  * was created by the Signal, Image and Communications (SIC) departement of
31  * the XLIM, UMR 7252 CNRS Institute in collaboration with the Fluids, Thermic
32  * and Combustion departement of the P', UPR 3346 CNRS Institute of the
33  * University of Poitiers.
34  *
35  * The SLIP Library source code has been registered to the APP (French Agency
36  * for the Protection of Programs) by the University of Poitiers and CNRS,
37  * under registration number IDDN.FR.001.300034.000.S.P.2010.000.21000.
38 
39  * http://www.sic.sp2mi.univ-poitiers.fr/slip/
40  *
41  * This software is governed by the CeCILL-C license under French law and
42  * abiding by the rules of distribution of free software. You can use,
43  * modify and/ or redistribute the software under the terms of the CeCILL-C
44  * license as circulated by CEA, CNRS and INRIA at the following URL
45  * http://www.cecill.info.
46  * As a counterpart to the access to the source code and rights to copy,
47  * modify and redistribute granted by the license, users are provided only
48  * with a limited warranty and the software's author, the holder of the
49  * economic rights, and the successive licensors have only limited
50  * liability.
51  *
52  * In this respect, the user's attention is drawn to the risks associated
53  * with loading, using, modifying and/or developing or reproducing the
54  * software by the user in light of its specific status of free software,
55  * that may mean that it is complicated to manipulate, and that also
56  * therefore means that it is reserved for developers and experienced
57  * professionals having in-depth computer knowledge. Users are therefore
58  * encouraged to load and test the software's suitability as regards their
59  * requirements in conditions enabling the security of their systems and/or
60  * data to be ensured and, more generally, to use and operate it in the
61  * same conditions as regards security.
62  *
63  * The fact that you are presently reading this means that you have had
64  * knowledge of the CeCILL-C license and that you accept its terms.
65  */
66 
67 
68 
75 #ifndef SLIP_MULTISPECTRALIMAGE_HPP
76 #define SLIP_MULTISPECTRALIMAGE_HPP
77 
78 #include <iostream>
79 #include <iterator>
80 #include <cassert>
81 #include <numeric>
82 #include <cmath>
83 #include <string>
84 #include <vector>
85 #include <cstddef>
86 #include "stride_iterator.hpp"
87 #include "kstride_iterator.hpp"
88 #include "iterator2d_box.hpp"
89 #include "iterator2d_range.hpp"
90 #include "apply.hpp"
91 #include "Block.hpp"
93 
94 #include <boost/serialization/access.hpp>
95 #include <boost/serialization/split_member.hpp>
96 #include <boost/serialization/version.hpp>
97 #include <boost/serialization/base_object.hpp>
98 
99 
100 namespace slip
101 {
102 
103 template<class T>
104 class stride_iterator;
105 
106 template<class T>
107 class iterator2d_box;
108 
109 template<class T>
110 class iterator2d_range;
111 
112 template<class T>
113 class const_iterator2d_box;
114 
115 template<class T>
116 class const_iterator2d_range;
117 
118 template <class T>
119 class DPoint2d;
120 
121 template <class T>
122 class Point2d;
123 
124 template <class T>
125 class Box2d;
126 
127 template <typename T, std::size_t NB_COMPONENT>
129 
130 
131 
132 
152 template <typename T, std::size_t NB_COMPONENT>
153 class MultispectralImage : public GenericMultiComponent2d<slip::block<T,NB_COMPONENT> >
154 {
155 
156 public:
161 
162  typedef value_type* pointer;
163  typedef const value_type* const_pointer;
165  typedef const value_type& const_reference;
166 
167  typedef ptrdiff_t difference_type;
168  typedef std::size_t size_type;
169 
170  typedef pointer iterator;
172 
173  typedef std::reverse_iterator<iterator> reverse_iterator;
174  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
175 
176  static const std::size_t DIM = 2;
177 public:
182 
187  base()
188  {}
189 
196  const size_type width):
197  base(height,width)
198  {}
199 
207  const size_type width,
208  const slip::block<T,NB_COMPONENT>& val):
209  base(height,width,val)
210  {}
211 
219  const size_type width,
220  const T* val):
221  base(height,width,val)
222  {}
223 
224 
232  const size_type width,
233  const slip::block<T,NB_COMPONENT>* val):
234  base(height,width,val)
235  {}
236 
237 
248  template<typename InputIterator>
250  const size_type width,
251  InputIterator first,
252  InputIterator last):
253  base(height,width,first,last)
254  {}
255 
256 
270  template<typename InputIterator>
272  const size_type width,
273  std::vector<InputIterator> first_iterators_list,
274  InputIterator last):
275  base(height,width,first_iterators_list,last)
276  {}
277 
278 
282  MultispectralImage(const self& rhs):
283  base(rhs)
284  {}
285 
290  {}
291 
292 
304  self& operator=(const slip::block<T,NB_COMPONENT>& val);
305 
306 
312  self& operator=(const T& val);
313 
314 
322  std::string name() const;
323 
324 
325 private :
327  template<class Archive>
328  void save(Archive & ar, const unsigned int version) const
329  {
330  ar & boost::serialization::base_object<slip::GenericMultiComponent2d<slip::block<T,NB_COMPONENT> > >(*this);
331  }
332  template<class Archive>
333  void load(Archive & ar, const unsigned int version)
334  {
335  ar & boost::serialization::base_object<slip::GenericMultiComponent2d<slip::block<T,NB_COMPONENT> > >(*this);
336  }
337  BOOST_SERIALIZATION_SPLIT_MEMBER()
338 };
339 
340 
341 
342 }//slip::
343 
344 namespace slip{
345 
346 }//slip::
347 
348 namespace slip
349 {
350 
351 
352 
353  template<typename T, std::size_t NB_COMPONENT>
354  inline
355  MultispectralImage<T,NB_COMPONENT>&
357  {
358  std::fill_n(this->begin(),this->size(),val);
359  return *this;
360  }
361 
362  template<typename T, std::size_t NB_COMPONENT>
363  inline
366  {
367  std::fill_n(this->begin(),this->size(),val);
368  return *this;
369  }
370 
371  template<typename T, std::size_t NB_COMPONENT>
372  inline
373  std::string
374  MultispectralImage<T, NB_COMPONENT>::name() const {return "MultispectralImage";}
375 
376 
377 }//slip::
378 
379 #endif //SLIP_MULTISPECTRALIMAGE_HPP
friend class boost::serialization::access
This is a GenericMultiComponent2d class. This container statisfies the BidirectionnalContainer concep...
MultispectralImage(const size_type height, const size_type width, const slip::block< T, NB_COMPONENT > *val)
Constructs a MultispectralImage initialized by an array val.
MultispectralImage(const size_type height, const size_type width, InputIterator first, InputIterator last)
Contructs a MultispectralImage from a range.
Provides a class to manipulate multicomponent 2d containers.
Provides a class to manipulate iterator2d within a slip::Box2d. It is used to iterate throw 2d contai...
~MultispectralImage()
Destructor of the MultispectralImage.
Provides a class to iterate a 1d range according to a constant step.
const value_type * const_pointer
MultispectralImage(const self &rhs)
Constructs a copy of the MultispectralImage rhs.
MultispectralImage(const size_type height, const size_type width, const slip::block< T, NB_COMPONENT > &val)
Constructs a MultispectralImage initialized by the scalar value val.
Provides a class to manipulate 1d static and generic arrays.
size_type height() const
Returns the height (first dimension size) in the GenericMultiComponent2d.
std::string name() const
Returns the name of the class.
self & operator=(const slip::block< T, NB_COMPONENT > &val)
Affects all the element of the MulitspectralImage by val.
const value_type & const_reference
MultispectralImage(const size_type height, const size_type width, std::vector< InputIterator > first_iterators_list, InputIterator last)
Contructs a MultispectralImage from a N ranges.
GenericMultiComponent2d< slip::block< T, NB_COMPONENT > > base
slip::GenericMultiComponent2d< slip::block< T, NB_COMPONENT > >::value_type value_type
const MultispectralImage< T, NB_COMPONENT > const_self
size_type width() const
Returns the number of columns (second dimension size) in the GenericMultiComponent2d.
MultispectralImage()
Constructs a MultispectralImage.
MultispectralImage(const size_type height, const size_type width, const T *val)
Constructs a MultispectralImage initialized by an array val.
std::reverse_iterator< const_iterator > const_reverse_iterator
Provides some algorithms to apply C like functions to ranges.
Provides a class to iterate a 1d range according to a step.
std::reverse_iterator< iterator > reverse_iterator
This is a Multi Spectral Image container. This container statisfies the BidirectionnalContainer conce...
static const std::size_t DIM
Provides a class to manipulate iterator2d within a slip::Range. It is used to iterate throw 2d contai...
MultispectralImage(const size_type height, const size_type width)
Constructs a MultispectralImage.
This is a linear (one-dimensional) static container. This container statisfies the RandomAccessContai...
Definition: Block.hpp:94