SimpleITK  1.2.4
sitkPimpleImageBase.h
Go to the documentation of this file.
1 /*=========================================================================
2 *
3 * Copyright Insight Software Consortium
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18 #ifndef sitkPimpleImageBase_h
19 #define sitkPimpleImageBase_h
20 
21 #include <vector>
22 #include "sitkPixelIDTokens.h"
23 #include "sitkTemplateFunctions.h"
24 
25 namespace itk
26 {
27  namespace simple
28  {
29 
41  {
42  public:
43  virtual ~PimpleImageBase( void ) { };
44 
45  virtual PixelIDValueEnum GetPixelID(void) const = 0;
46  virtual unsigned int GetDimension( void ) const = 0;
47  virtual uint64_t GetNumberOfPixels( void ) const = 0;
48  virtual unsigned int GetNumberOfComponentsPerPixel( void ) const = 0;
49 
50  virtual PimpleImageBase *ShallowCopy(void) const = 0;
51  virtual PimpleImageBase *DeepCopy(void) const = 0;
52  virtual itk::DataObject* GetDataBase( void ) = 0;
53  virtual const itk::DataObject* GetDataBase( void ) const = 0;
54 
55  virtual unsigned int GetWidth( void ) const { return this->GetSize( 0 ); }
56  virtual unsigned int GetHeight( void ) const { return this->GetSize( 1 ); }
57  virtual unsigned int GetDepth( void ) const { return this->GetSize( 2 ); }
58 
59  virtual std::vector< unsigned int > GetSize( void ) const = 0;
60  virtual unsigned int GetSize( unsigned int dimension ) const = 0;
61 
62 
63  virtual std::vector<double> GetOrigin( void ) const = 0;
64  virtual void SetOrigin( const std::vector<double> &orgn ) = 0;
65  virtual std::vector<double> GetSpacing( void ) const = 0;
66  virtual void SetSpacing( const std::vector<double> &spc ) = 0;
67 
68  virtual std::vector< double > GetDirection( void ) const = 0;
69  virtual void SetDirection( const std::vector< double > &direction ) = 0;
70 
71  virtual std::vector<int64_t> TransformPhysicalPointToIndex( const std::vector<double> &pt) const = 0;
72  virtual std::vector<double> TransformIndexToPhysicalPoint( const std::vector<int64_t> &idx) const = 0;
73  virtual std::vector<double> TransformPhysicalPointToContinuousIndex( const std::vector<double> &pt) const = 0;
74  virtual std::vector<double> TransformContinuousIndexToPhysicalPoint( const std::vector<double> &idx) const = 0;
75 
76  virtual std::string ToString() const = 0;
77 
78 
79  virtual int GetReferenceCountOfImage() const = 0;
80 
81  virtual int8_t GetPixelAsInt8( const std::vector<uint32_t> &idx) const = 0;
82  virtual uint8_t GetPixelAsUInt8( const std::vector<uint32_t> &idx) const = 0;
83  virtual int16_t GetPixelAsInt16( const std::vector<uint32_t> &idx ) const = 0;
84  virtual uint16_t GetPixelAsUInt16( const std::vector<uint32_t> &idx ) const = 0;
85  virtual int32_t GetPixelAsInt32( const std::vector<uint32_t> &idx ) const = 0;
86  virtual uint32_t GetPixelAsUInt32( const std::vector<uint32_t> &idx ) const = 0;
87  virtual int64_t GetPixelAsInt64( const std::vector<uint32_t> &idx ) const = 0;
88  virtual uint64_t GetPixelAsUInt64( const std::vector<uint32_t> &idx ) const = 0;
89  virtual float GetPixelAsFloat( const std::vector<uint32_t> &idx ) const = 0;
90  virtual double GetPixelAsDouble( const std::vector<uint32_t> &idx ) const = 0;
91 
92  virtual std::vector<int8_t> GetPixelAsVectorInt8( const std::vector<uint32_t> &idx) const = 0;
93  virtual std::vector<uint8_t> GetPixelAsVectorUInt8( const std::vector<uint32_t> &idx) const = 0;
94  virtual std::vector<int16_t> GetPixelAsVectorInt16( const std::vector<uint32_t> &idx ) const = 0;
95  virtual std::vector<uint16_t> GetPixelAsVectorUInt16( const std::vector<uint32_t> &idx ) const = 0;
96  virtual std::vector<int32_t> GetPixelAsVectorInt32( const std::vector<uint32_t> &idx ) const = 0;
97  virtual std::vector<uint32_t> GetPixelAsVectorUInt32( const std::vector<uint32_t> &idx ) const = 0;
98  virtual std::vector<int64_t> GetPixelAsVectorInt64( const std::vector<uint32_t> &idx ) const = 0;
99  virtual std::vector<uint64_t> GetPixelAsVectorUInt64( const std::vector<uint32_t> &idx ) const = 0;
100  virtual std::vector<float> GetPixelAsVectorFloat32( const std::vector<uint32_t> &idx ) const = 0;
101  virtual std::vector<double> GetPixelAsVectorFloat64( const std::vector<uint32_t> &idx ) const = 0;
102 
103  virtual std::complex<float> GetPixelAsComplexFloat32( const std::vector<uint32_t> &idx ) const = 0;
104  virtual std::complex<double> GetPixelAsComplexFloat64( const std::vector<uint32_t> &idx ) const = 0;
105 
106  virtual void SetPixelAsInt8( const std::vector<uint32_t> &idx, int8_t v ) = 0;
107  virtual void SetPixelAsUInt8( const std::vector<uint32_t> &idx, uint8_t v ) = 0;
108  virtual void SetPixelAsInt16( const std::vector<uint32_t> &idx, int16_t v ) = 0;
109  virtual void SetPixelAsUInt16( const std::vector<uint32_t> &idx, uint16_t v ) = 0;
110  virtual void SetPixelAsInt32( const std::vector<uint32_t> &idx, int32_t v ) = 0;
111  virtual void SetPixelAsUInt32( const std::vector<uint32_t> &idx, uint32_t v ) = 0;
112  virtual void SetPixelAsInt64( const std::vector<uint32_t> &idx, int64_t v ) = 0;
113  virtual void SetPixelAsUInt64( const std::vector<uint32_t> &idx, uint64_t v ) = 0;
114  virtual void SetPixelAsFloat( const std::vector<uint32_t> &idx, float v ) = 0;
115  virtual void SetPixelAsDouble( const std::vector<uint32_t> &idx, double v ) = 0;
116 
117  virtual void SetPixelAsVectorInt8( const std::vector<uint32_t> &idx, const std::vector<int8_t> &v ) = 0;
118  virtual void SetPixelAsVectorUInt8( const std::vector<uint32_t> &idx, const std::vector<uint8_t> &v ) = 0;
119  virtual void SetPixelAsVectorInt16( const std::vector<uint32_t> &idx, const std::vector<int16_t> &v ) = 0;
120  virtual void SetPixelAsVectorUInt16( const std::vector<uint32_t> &idx, const std::vector<uint16_t> &v ) = 0;
121  virtual void SetPixelAsVectorInt32( const std::vector<uint32_t> &idx, const std::vector<int32_t> &v ) = 0;
122  virtual void SetPixelAsVectorUInt32( const std::vector<uint32_t> &idx, const std::vector<uint32_t> &v ) = 0;
123  virtual void SetPixelAsVectorInt64( const std::vector<uint32_t> &idx, const std::vector<int64_t> &v ) = 0;
124  virtual void SetPixelAsVectorUInt64( const std::vector<uint32_t> &idx, const std::vector<uint64_t> &v ) = 0;
125  virtual void SetPixelAsVectorFloat32( const std::vector<uint32_t> &idx, const std::vector<float> &v ) = 0;
126  virtual void SetPixelAsVectorFloat64( const std::vector<uint32_t> &idx, const std::vector<double> &v ) = 0;
127 
128  virtual void SetPixelAsComplexFloat32( const std::vector<uint32_t> &idx, const std::complex<float> v ) = 0;
129  virtual void SetPixelAsComplexFloat64( const std::vector<uint32_t> &idx, const std::complex<double> v ) = 0;
130 
131 
132  virtual int8_t *GetBufferAsInt8( ) = 0;
133  virtual uint8_t *GetBufferAsUInt8( ) = 0;
134  virtual int16_t *GetBufferAsInt16( ) = 0;
135  virtual uint16_t *GetBufferAsUInt16( ) = 0;
136  virtual int32_t *GetBufferAsInt32( ) = 0;
137  virtual uint32_t *GetBufferAsUInt32( ) = 0;
138  virtual int64_t *GetBufferAsInt64( ) = 0;
139  virtual uint64_t *GetBufferAsUInt64( ) = 0;
140  virtual float *GetBufferAsFloat( ) = 0;
141  virtual double *GetBufferAsDouble( ) = 0;
142 
143  virtual const int8_t *GetBufferAsInt8( ) const = 0;
144  virtual const uint8_t *GetBufferAsUInt8( ) const = 0;
145  virtual const int16_t *GetBufferAsInt16( ) const = 0;
146  virtual const uint16_t *GetBufferAsUInt16( ) const = 0;
147  virtual const int32_t *GetBufferAsInt32( ) const = 0;
148  virtual const uint32_t *GetBufferAsUInt32( ) const = 0;
149  virtual const int64_t *GetBufferAsInt64( ) const = 0;
150  virtual const uint64_t *GetBufferAsUInt64( ) const = 0;
151  virtual const float *GetBufferAsFloat( ) const = 0;
152  virtual const double *GetBufferAsDouble( ) const = 0;
153  };
154 
155  } // end namespace simple
156 } // end namespace itk
157 
158 
159 #endif // sitkPimpleImageBase_h
virtual unsigned int GetHeight(void) const
virtual unsigned int GetDepth(void) const
PixelIDValueEnum
Enumerated values of pixelIDs.
::uint8_t uint8_t
::uint16_t uint16_t
::uint32_t uint32_t
virtual unsigned int GetWidth(void) const
Private implementation idiom image base class.
::int64_t int64_t
::int8_t int8_t
::int32_t int32_t
::uint64_t uint64_t
::int16_t int16_t
#define SITKCommon_HIDDEN
Definition: sitkCommon.h:44