cartodata  4.5.0
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, int sizeT = 1 );
55  VolumeProxy( const VolumeProxy< T >& other );
56  virtual ~VolumeProxy();
57 
58  int getSizeX() const;
59  int getSizeY() const;
60  int getSizeZ() const;
61  int getSizeT() const;
63  std::vector<int> getSize() const;
66  std::vector<float> getVoxelSize() const;
67 
69 
73  virtual void copyHeaderFrom( const PropertySet & other );
74  virtual void copyHeaderFrom( const Object & other );
75 
76  protected:
77 
78  int _sizeX;
79  int _sizeY;
80  int _sizeZ;
81  int _sizeT;
82 
83  };
84 
85 
86  template < typename T >
87  inline
89  {
90 
91  return _sizeX;
92 
93  }
94 
95 
96  template < typename T >
97  inline
99  {
100 
101  return _sizeY;
102 
103  }
104 
105 
106  template < typename T >
107  inline
109  {
110 
111  return _sizeZ;
112 
113  }
114 
115 
116  template < typename T >
117  inline
119  {
120 
121  return _sizeT;
122 
123  }
124 
125 
126  template < typename T >
127  inline
128  std::vector<int> VolumeProxy< T >::getSize() const
129  {
130 
131  std::vector<int> size(4);
132  size[0] = _sizeX;
133  size[1] = _sizeY;
134  size[2] = _sizeZ;
135  size[3] = _sizeT;
136  return size;
137 
138  }
139 
140 
141  template < typename T >
142  inline
144  {
145  copyHeaderFrom( Object::reference( other ) );
146  }
147 
148 
149  // instanciations
150 
151  extern template class VolumeProxy<int8_t>;
152  extern template class VolumeProxy<uint8_t>;
153  // ### remove after everything has been moved to intN_t/uintN_t
154 #if !defined(__sun__) || !defined(_CHAR_IS_SIGNED)
155  extern template class VolumeProxy<char>;
156 #endif
157  extern template class VolumeProxy<int16_t>;
158  extern template class VolumeProxy<uint16_t>;
159  extern template class VolumeProxy<int32_t>;
160  extern template class VolumeProxy<uint32_t>;
161  extern template class VolumeProxy<long>;
162  extern template class VolumeProxy<unsigned long>;
163  extern template class VolumeProxy<float>;
164  extern template class VolumeProxy<double>;
165  extern template class VolumeProxy<cfloat>;
166  extern template class VolumeProxy<cdouble>;
167 }
168 
169 
170 #endif
std::vector< int > getSize() const
get the 4 dimensions in a vector
Definition: volumeproxy.h:128
int getSizeT() const
Definition: volumeproxy.h:118
VolumeProxy< T > & operator=(const VolumeProxy< T > &other)
Definition: volumeproxy_d.h:97
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< float > getVoxelSize() const
get the voxel size from the header, with 4 values defaulting to 1.mm if not present ...
virtual void copyHeaderFrom(const PropertySet &other)
copy properties from other to this, avoiding forbidden properties like size.
Definition: volumeproxy.h:143
virtual ~VolumeProxy()
Definition: volumeproxy_d.h:90
int getSizeZ() const
Definition: volumeproxy.h:108
int getSizeX() const
Definition: volumeproxy.h:88
int getSizeY() const
Definition: volumeproxy.h:98