Image Utilities (IU)
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Groups Pages
volume.h
1 #pragma once
2 
3 #include "coredefs.h"
4 
5 #include <ostream>
6 #include <typeinfo>
7 
8 namespace iu{
29 class Volume
30 {
31 public:
33  Volume() :
34  size_()
35  {
36  }
37 
39  virtual ~Volume()
40  {
41  }
42 
48  Volume(unsigned int width, unsigned int height, unsigned int depth) :
49  size_(width, height, depth)
50  {
51  }
52 
57  size_(size)
58  {
59  }
60 
65  bool sameType(const Volume &from)
66  {
67  return typeid(from)==typeid(*this);
68  }
69 
73  iu::Size<3> size() const
74  {
75  return size_;
76  }
77 
81  unsigned int width() const
82  {
83  return size_.width;
84  }
85 
89  unsigned int height() const
90  {
91  return size_.height;
92  }
93 
97  unsigned int depth() const
98  {
99  return size_.depth;
100  }
101 
103  size_t numel() const
104  {
105  return (size_.width * size_.height * size_.depth);
106  }
107 
109  virtual size_t bytes() const {return 0;};
110 
112  virtual size_t pitch() const {return 0;};
113 
115  virtual size_t stride() const {return 0;};
116 
118  virtual size_t slice_stride() const {return 0;};
119 
121  virtual unsigned int bitDepth() const {return 0;};
122 
124  virtual bool onDevice() const {return false;};
125 
127  friend std::ostream& operator<<(std::ostream & out,
128  Volume const& volume)
129  {
130  out << "Volume: " << volume.size() << " stride="
131  << volume.stride() << " slice_stride=" << volume.slice_stride()
132  << " onDevice=" << volume.onDevice();
133  return out;
134  }
135 
136 private:
138  iu::Size<3> size_;
139 
140 private:
142  Volume(const Volume&);
144  Volume& operator=(const Volume&);
145 };
146  // end of Volume
148 
149 } // namespace iuprivate
150 
Volume(unsigned int width, unsigned int height, unsigned int depth)
Definition: volume.h:48
unsigned int & depth
Definition: vector.h:613
virtual size_t stride() const
Definition: volume.h:115
unsigned int width() const
Definition: volume.h:81
unsigned int & height
Definition: vector.h:611
Template specialization for 3-d unsigned int vectors (size vectors).
Definition: vector.h:605
bool sameType(const Volume &from)
Definition: volume.h:65
unsigned int height() const
Definition: volume.h:89
unsigned int depth() const
Definition: volume.h:97
friend std::ostream & operator<<(std::ostream &out, Volume const &volume)
Definition: volume.h:127
Volume()
Definition: volume.h:33
Base class for 3D volumes (pitched memory).
Definition: volume.h:29
Volume(const iu::Size< 3 > &size)
Definition: volume.h:56
virtual bool onDevice() const
Definition: volume.h:124
unsigned int & width
Definition: vector.h:609
size_t numel() const
Definition: volume.h:103
virtual unsigned int bitDepth() const
Definition: volume.h:121
virtual size_t bytes() const
Definition: volume.h:109
virtual size_t pitch() const
Definition: volume.h:112
virtual ~Volume()
Definition: volume.h:39
iu::Size< 3 > size() const
Definition: volume.h:73
virtual size_t slice_stride() const
Definition: volume.h:118