SimpleITK  
sitkImportImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 sitkImportImageFilter_h
19 #define sitkImportImageFilter_h
20 
21 #include "sitkMacro.h"
22 #include "sitkImage.h"
23 #include "sitkImageReaderBase.h"
25 
26 namespace itk::simple
27 {
28 
48 {
49 public:
51 
52  ~ImportImageFilter() override;
53 
55 
57  std::string
58  ToString() const override;
59 
61  std::string
62  GetName() const override
63  {
64  return std::string("ImportImageFilter");
65  }
66 
67  SITK_RETURN_SELF_TYPE_HEADER
68  SetSize(const std::vector<unsigned int> & size);
69  const std::vector<unsigned int> &
70  GetSize() const;
71 
72  SITK_RETURN_SELF_TYPE_HEADER
73  SetSpacing(const std::vector<double> & spacing);
74  const std::vector<double> &
75  GetSpacing() const;
76 
77  SITK_RETURN_SELF_TYPE_HEADER
78  SetOrigin(const std::vector<double> & origin);
79  const std::vector<double> &
80  GetOrigin() const;
81 
82  SITK_RETURN_SELF_TYPE_HEADER
83  SetDirection(const std::vector<double> & direction);
84  const std::vector<double> &
85  GetDirection() const;
86 
87  SITK_RETURN_SELF_TYPE_HEADER
88  SetBufferAsInt8(int8_t * buffer, unsigned int numberOfComponents = 1);
89  SITK_RETURN_SELF_TYPE_HEADER
90  SetBufferAsUInt8(uint8_t * buffer, unsigned int numberOfComponents = 1);
91  SITK_RETURN_SELF_TYPE_HEADER
92  SetBufferAsInt16(int16_t * buffer, unsigned int numberOfComponents = 1);
93  SITK_RETURN_SELF_TYPE_HEADER
94  SetBufferAsUInt16(uint16_t * buffer, unsigned int numberOfComponents = 1);
95  SITK_RETURN_SELF_TYPE_HEADER
96  SetBufferAsInt32(int32_t * buffer, unsigned int numberOfComponents = 1);
97  SITK_RETURN_SELF_TYPE_HEADER
98  SetBufferAsUInt32(uint32_t * buffer, unsigned int numberOfComponents = 1);
99  SITK_RETURN_SELF_TYPE_HEADER
100  SetBufferAsInt64(int64_t * buffer, unsigned int numberOfComponents = 1);
101  SITK_RETURN_SELF_TYPE_HEADER
102  SetBufferAsUInt64(uint64_t * buffer, unsigned int numberOfComponents = 1);
103  SITK_RETURN_SELF_TYPE_HEADER
104  SetBufferAsFloat(float * buffer, unsigned int numberOfComponents = 1);
105  SITK_RETURN_SELF_TYPE_HEADER
106  SetBufferAsDouble(double * buffer, unsigned int numberOfComponents = 1);
107 
108  Image
109  Execute() override;
110 
111 protected:
112  // Internal method called by the template dispatch system
113  template <class TImageType>
114  Image
115  ExecuteInternal();
116 
117 private:
118  // function pointer type
119  typedef Image (Self::*MemberFunctionType)();
120 
121  // friend to get access to executeInternal member
122  friend struct detail::MemberFunctionAddressor<MemberFunctionType>;
123  std::unique_ptr<detail::MemberFunctionFactory<MemberFunctionType>> m_MemberFactory;
124 
127 
128  std::vector<double> m_Origin;
129  std::vector<double> m_Spacing;
130  std::vector<unsigned int> m_Size;
131  std::vector<double> m_Direction;
132 
133  void * m_Buffer;
134 };
135 
137 ImportAsInt8(int8_t * buffer,
138  const std::vector<unsigned int> & size,
139  const std::vector<double> & spacing = std::vector<double>(3, 1.0),
140  const std::vector<double> & origin = std::vector<double>(3, 0.0),
141  const std::vector<double> & direction = std::vector<double>(),
142  unsigned int numberOfComponents = 1);
143 
145 ImportAsUInt8(uint8_t * buffer,
146  const std::vector<unsigned int> & size,
147  const std::vector<double> & spacing = std::vector<double>(3, 1.0),
148  const std::vector<double> & origin = std::vector<double>(3, 0.0),
149  const std::vector<double> & direction = std::vector<double>(),
150  unsigned int numberOfComponents = 1);
151 
153 ImportAsInt16(int16_t * buffer,
154  const std::vector<unsigned int> & size,
155  const std::vector<double> & spacing = std::vector<double>(3, 1.0),
156  const std::vector<double> & origin = std::vector<double>(3, 0.0),
157  const std::vector<double> & direction = std::vector<double>(),
158  unsigned int numberOfComponents = 1);
159 
161 ImportAsUInt16(uint16_t * buffer,
162  const std::vector<unsigned int> & size,
163  const std::vector<double> & spacing = std::vector<double>(3, 1.0),
164  const std::vector<double> & origin = std::vector<double>(3, 0.0),
165  const std::vector<double> & direction = std::vector<double>(),
166  unsigned int numberOfComponents = 1);
167 
169 ImportAsInt32(int32_t * buffer,
170  const std::vector<unsigned int> & size,
171  const std::vector<double> & spacing = std::vector<double>(3, 1.0),
172  const std::vector<double> & origin = std::vector<double>(3, 0.0),
173  const std::vector<double> & direction = std::vector<double>(),
174  unsigned int numberOfComponents = 1);
175 
177 ImportAsUInt32(uint32_t * buffer,
178  const std::vector<unsigned int> & size,
179  const std::vector<double> & spacing = std::vector<double>(3, 1.0),
180  const std::vector<double> & origin = std::vector<double>(3, 0.0),
181  const std::vector<double> & direction = std::vector<double>(),
182  unsigned int numberOfComponents = 1);
183 
185 ImportAsInt64(int64_t * buffer,
186  const std::vector<unsigned int> & size,
187  const std::vector<double> & spacing = std::vector<double>(3, 1.0),
188  const std::vector<double> & origin = std::vector<double>(3, 0.0),
189  const std::vector<double> & direction = std::vector<double>(),
190  unsigned int numberOfComponents = 1);
191 
193 ImportAsUInt64(uint64_t * buffer,
194  const std::vector<unsigned int> & size,
195  const std::vector<double> & spacing = std::vector<double>(3, 1.0),
196  const std::vector<double> & origin = std::vector<double>(3, 0.0),
197  const std::vector<double> & direction = std::vector<double>(),
198  unsigned int numberOfComponents = 1);
199 
201 ImportAsFloat(float * buffer,
202  const std::vector<unsigned int> & size,
203  const std::vector<double> & spacing = std::vector<double>(3, 1.0),
204  const std::vector<double> & origin = std::vector<double>(3, 0.0),
205  const std::vector<double> & direction = std::vector<double>(),
206  unsigned int numberOfComponents = 1);
207 
209 ImportAsDouble(double * buffer,
210  const std::vector<unsigned int> & size,
211  const std::vector<double> & spacing = std::vector<double>(3, 1.0),
212  const std::vector<double> & origin = std::vector<double>(3, 0.0),
213  const std::vector<double> & direction = std::vector<double>(),
214  unsigned int numberOfComponents = 1);
215 
216 } // namespace itk::simple
217 
218 #endif
itk::simple::Image
The Image class for SimpleITK.
Definition: sitkImage.h:76
itk::simple::ImportAsDouble
Image SITKIO_EXPORT ImportAsDouble(double *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
itk::simple::detail::MemberFunctionAddressor
Definition: sitkDetail.h:29
itk::simple::ImportImageFilter::GetName
std::string GetName() const override
Definition: sitkImportImageFilter.h:62
SITKIO_EXPORT
#define SITKIO_EXPORT
Definition: sitkIO.h:33
itk::simple::ImportImageFilter::m_Direction
std::vector< double > m_Direction
Definition: sitkImportImageFilter.h:131
sitkImage.h
itk::simple::ImportImageFilter::m_Size
std::vector< unsigned int > m_Size
Definition: sitkImportImageFilter.h:130
itk::simple::ImportAsFloat
Image SITKIO_EXPORT ImportAsFloat(float *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
itk::simple::ImportImageFilter::m_Origin
std::vector< double > m_Origin
Definition: sitkImportImageFilter.h:128
sitkMemberFunctionFactory.h
itk::simple::ImportAsInt8
Image SITKIO_EXPORT ImportAsInt8(int8_t *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
itk::simple::ImportImageFilter::m_PixelIDValue
PixelIDValueType m_PixelIDValue
Definition: sitkImportImageFilter.h:126
itk::simple::ImportAsUInt8
Image SITKIO_EXPORT ImportAsUInt8(uint8_t *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
sitkMacro.h
itk::simple::ImportAsInt16
Image SITKIO_EXPORT ImportAsInt16(int16_t *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
itk::simple::ImportImageFilter::m_NumberOfComponentsPerPixel
unsigned int m_NumberOfComponentsPerPixel
Definition: sitkImportImageFilter.h:125
itk::simple::ImportImageFilter
Compose a 2D or 3D image and return a smart pointer to a SimpleITK image.
Definition: sitkImportImageFilter.h:47
sitkImageReaderBase.h
itk::simple::ImportAsInt64
Image SITKIO_EXPORT ImportAsInt64(int64_t *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
itk::simple::ImportImageFilter::m_MemberFactory
std::unique_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
Definition: sitkImportImageFilter.h:123
itk::simple::ImportAsInt32
Image SITKIO_EXPORT ImportAsInt32(int32_t *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
itk::simple::ImportAsUInt16
Image SITKIO_EXPORT ImportAsUInt16(uint16_t *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
itk::simple::ImageReaderBase
An abstract base class for image readers.
Definition: sitkImageReaderBase.h:42
itk::simple::ImportImageFilter::m_Buffer
void * m_Buffer
Definition: sitkImportImageFilter.h:133
itk::simple::ImportAsUInt32
Image SITKIO_EXPORT ImportAsUInt32(uint32_t *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
itk::simple::ProcessObject
Base class for SimpleITK classes based on ProcessObject.
Definition: sitkProcessObject.h:54
itk::simple
Definition: sitkAdditionalProcedures.h:28
itk::simple::ImportAsUInt64
Image SITKIO_EXPORT ImportAsUInt64(uint64_t *buffer, const std::vector< unsigned int > &size, const std::vector< double > &spacing=std::vector< double >(3, 1.0), const std::vector< double > &origin=std::vector< double >(3, 0.0), const std::vector< double > &direction=std::vector< double >(), unsigned int numberOfComponents=1)
itk::simple::PixelIDValueType
int PixelIDValueType
Definition: sitkPixelIDValues.h:30
itk::simple::ImportImageFilter::m_Spacing
std::vector< double > m_Spacing
Definition: sitkImportImageFilter.h:129