cartodata  5.0.5
volumeproxy.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 #ifndef CARTODATA_VOLUME_VOLUMEPROXY_H
35 #define CARTODATA_VOLUME_VOLUMEPROXY_H
36 
37 
39 
40 
41 namespace carto
42 {
43 
44 
48  template < typename T >
49  class VolumeProxy : public Headered
50  {
51 
52  public:
53 
54  explicit VolumeProxy( int sizeX = 1, int sizeY = 1, int sizeZ = 1,
55  int sizeT = 1 );
56  explicit VolumeProxy( const std::vector<int> & size );
57  VolumeProxy( const VolumeProxy< T >& other );
58  virtual ~VolumeProxy();
59 
60  int getSizeX() const;
61  int getSizeY() const;
62  int getSizeZ() const;
63  int getSizeT() const;
65  std::vector<int> getSize() const;
68  std::vector<float> getVoxelSize() const;
69 
71 
75  virtual void copyHeaderFrom( const PropertySet & other );
76  virtual void copyHeaderFrom( const Object & other );
77 
78  protected:
79 
80  std::vector<int> _size;
81 
82  };
83 
84 
85  template < typename T >
86  inline
88  {
89 
90  return _size[0];
91 
92  }
93 
94 
95  template < typename T >
96  inline
98  {
99 
100  return _size[1];
101 
102  }
103 
104 
105  template < typename T >
106  inline
108  {
109 
110  return _size[2];
111 
112  }
113 
114 
115  template < typename T >
116  inline
118  {
119 
120  return _size[3];
121 
122  }
123 
124 
125  template < typename T >
126  inline
127  std::vector<int> VolumeProxy< T >::getSize() const
128  {
129 
130  return _size;
131 
132  }
133 
134 
135  template < typename T >
136  inline
138  {
139  copyHeaderFrom( Object::reference( other ) );
140  }
141 
142 
143  // instanciations
144 
145  extern template class VolumeProxy<int8_t>;
146  extern template class VolumeProxy<uint8_t>;
147  // ### remove after everything has been moved to intN_t/uintN_t
148 #if !defined(__sun__) || !defined(_CHAR_IS_SIGNED)
149  extern template class VolumeProxy<char>;
150 #endif
151  extern template class VolumeProxy<int16_t>;
152  extern template class VolumeProxy<uint16_t>;
153  extern template class VolumeProxy<int32_t>;
154  extern template class VolumeProxy<uint32_t>;
155  extern template class VolumeProxy<long>;
156  extern template class VolumeProxy<unsigned long>;
157  extern template class VolumeProxy<float>;
158  extern template class VolumeProxy<double>;
159  extern template class VolumeProxy<cfloat>;
160  extern template class VolumeProxy<cdouble>;
161 }
162 
163 
164 #endif
int getSizeZ() const
Definition: volumeproxy.h:107
VolumeProxy< T > & operator=(const VolumeProxy< T > &other)
VolumeProxy(int sizeX=1, int sizeY=1, int sizeZ=1, int sizeT=1)
Definition: volumeproxy_d.h:46
static Object reference(T &value)
VolumeProxy is the base class for volumes.
Definition: volumeproxy.h:49
std::vector< int > getSize() const
get the 4 dimensions in a vector
Definition: volumeproxy.h:127
int getSizeX() const
Definition: volumeproxy.h:87
virtual void copyHeaderFrom(const PropertySet &other)
copy properties from other to this, avoiding forbidden properties like size.
Definition: volumeproxy.h:137
virtual ~VolumeProxy()
std::vector< int > _size
Definition: volumeproxy.h:80
std::vector< float > getVoxelSize() const
get the voxel size from the header, with 4 values defaulting to 1.mm if not present ...
int getSizeY() const
Definition: volumeproxy.h:97
int getSizeT() const
Definition: volumeproxy.h:117