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
26namespace itk::simple
27{
28
48{
49public:
51
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 void
68 SetSize(const std::vector<unsigned int> & size);
69 const std::vector<unsigned int> &
70 GetSize() const;
71
72 void
73 SetSpacing(const std::vector<double> & spacing);
74 const std::vector<double> &
75 GetSpacing() const;
76
77 void
78 SetOrigin(const std::vector<double> & origin);
79 const std::vector<double> &
80 GetOrigin() const;
81
82 void
83 SetDirection(const std::vector<double> & direction);
84 const std::vector<double> &
85 GetDirection() const;
86
87 void
88 SetBufferAsInt8(int8_t * buffer, unsigned int numberOfComponents = 1);
89 void
90 SetBufferAsUInt8(uint8_t * buffer, unsigned int numberOfComponents = 1);
91 void
92 SetBufferAsInt16(int16_t * buffer, unsigned int numberOfComponents = 1);
93 void
94 SetBufferAsUInt16(uint16_t * buffer, unsigned int numberOfComponents = 1);
95 void
96 SetBufferAsInt32(int32_t * buffer, unsigned int numberOfComponents = 1);
97 void
98 SetBufferAsUInt32(uint32_t * buffer, unsigned int numberOfComponents = 1);
99 void
100 SetBufferAsInt64(int64_t * buffer, unsigned int numberOfComponents = 1);
101 void
102 SetBufferAsUInt64(uint64_t * buffer, unsigned int numberOfComponents = 1);
103 void
104 SetBufferAsFloat(float * buffer, unsigned int numberOfComponents = 1);
105 void
106 SetBufferAsDouble(double * buffer, unsigned int numberOfComponents = 1);
107
108 Image
109 Execute() override;
110
111protected:
112 // Internal method called by the template dispatch system
113 template <class TImageType>
114 Image
116
117private:
118 // function pointer type
120
121 // friend to get access to executeInternal member
125
128
129 std::vector<double> m_Origin{ std::vector<double>(3, 0.0) };
130 std::vector<double> m_Spacing{ std::vector<double>(3, 1.0) };
131 std::vector<unsigned int> m_Size;
132 std::vector<double> m_Direction;
133
134 void * m_Buffer{ nullptr };
135};
136
138ImportAsInt8(int8_t * buffer,
139 const std::vector<unsigned int> & size,
140 const std::vector<double> & spacing = std::vector<double>(3, 1.0),
141 const std::vector<double> & origin = std::vector<double>(3, 0.0),
142 const std::vector<double> & direction = std::vector<double>(),
143 unsigned int numberOfComponents = 1);
144
146ImportAsUInt8(uint8_t * buffer,
147 const std::vector<unsigned int> & size,
148 const std::vector<double> & spacing = std::vector<double>(3, 1.0),
149 const std::vector<double> & origin = std::vector<double>(3, 0.0),
150 const std::vector<double> & direction = std::vector<double>(),
151 unsigned int numberOfComponents = 1);
152
154ImportAsInt16(int16_t * buffer,
155 const std::vector<unsigned int> & size,
156 const std::vector<double> & spacing = std::vector<double>(3, 1.0),
157 const std::vector<double> & origin = std::vector<double>(3, 0.0),
158 const std::vector<double> & direction = std::vector<double>(),
159 unsigned int numberOfComponents = 1);
160
162ImportAsUInt16(uint16_t * buffer,
163 const std::vector<unsigned int> & size,
164 const std::vector<double> & spacing = std::vector<double>(3, 1.0),
165 const std::vector<double> & origin = std::vector<double>(3, 0.0),
166 const std::vector<double> & direction = std::vector<double>(),
167 unsigned int numberOfComponents = 1);
168
170ImportAsInt32(int32_t * buffer,
171 const std::vector<unsigned int> & size,
172 const std::vector<double> & spacing = std::vector<double>(3, 1.0),
173 const std::vector<double> & origin = std::vector<double>(3, 0.0),
174 const std::vector<double> & direction = std::vector<double>(),
175 unsigned int numberOfComponents = 1);
176
178ImportAsUInt32(uint32_t * buffer,
179 const std::vector<unsigned int> & size,
180 const std::vector<double> & spacing = std::vector<double>(3, 1.0),
181 const std::vector<double> & origin = std::vector<double>(3, 0.0),
182 const std::vector<double> & direction = std::vector<double>(),
183 unsigned int numberOfComponents = 1);
184
186ImportAsInt64(int64_t * buffer,
187 const std::vector<unsigned int> & size,
188 const std::vector<double> & spacing = std::vector<double>(3, 1.0),
189 const std::vector<double> & origin = std::vector<double>(3, 0.0),
190 const std::vector<double> & direction = std::vector<double>(),
191 unsigned int numberOfComponents = 1);
192
194ImportAsUInt64(uint64_t * buffer,
195 const std::vector<unsigned int> & size,
196 const std::vector<double> & spacing = std::vector<double>(3, 1.0),
197 const std::vector<double> & origin = std::vector<double>(3, 0.0),
198 const std::vector<double> & direction = std::vector<double>(),
199 unsigned int numberOfComponents = 1);
200
202ImportAsFloat(float * buffer,
203 const std::vector<unsigned int> & size,
204 const std::vector<double> & spacing = std::vector<double>(3, 1.0),
205 const std::vector<double> & origin = std::vector<double>(3, 0.0),
206 const std::vector<double> & direction = std::vector<double>(),
207 unsigned int numberOfComponents = 1);
208
210ImportAsDouble(double * buffer,
211 const std::vector<unsigned int> & size,
212 const std::vector<double> & spacing = std::vector<double>(3, 1.0),
213 const std::vector<double> & origin = std::vector<double>(3, 0.0),
214 const std::vector<double> & direction = std::vector<double>(),
215 unsigned int numberOfComponents = 1);
216
217} // namespace itk::simple
218
219#endif
The Image class for SimpleITK.
Definition sitkImage.h:77
const std::vector< double > & GetDirection() const
std::string ToString() const override
const std::vector< unsigned int > & GetSize() const
void SetBufferAsUInt64(uint64_t *buffer, unsigned int numberOfComponents=1)
void SetSize(const std::vector< unsigned int > &size)
void SetBufferAsInt32(int32_t *buffer, unsigned int numberOfComponents=1)
void SetBufferAsUInt8(uint8_t *buffer, unsigned int numberOfComponents=1)
void SetBufferAsUInt32(uint32_t *buffer, unsigned int numberOfComponents=1)
void SetDirection(const std::vector< double > &direction)
void SetBufferAsUInt16(uint16_t *buffer, unsigned int numberOfComponents=1)
std::string GetName() const override
void SetBufferAsDouble(double *buffer, unsigned int numberOfComponents=1)
static const detail::MemberFunctionFactory< MemberFunctionType > & GetMemberFunctionFactory()
std::vector< unsigned int > m_Size
void SetBufferAsInt64(int64_t *buffer, unsigned int numberOfComponents=1)
void SetBufferAsInt8(int8_t *buffer, unsigned int numberOfComponents=1)
const std::vector< double > & GetSpacing() const
void SetSpacing(const std::vector< double > &spacing)
void SetOrigin(const std::vector< double > &origin)
void SetBufferAsInt16(int16_t *buffer, unsigned int numberOfComponents=1)
void SetBufferAsFloat(float *buffer, unsigned int numberOfComponents=1)
const std::vector< double > & GetOrigin() const
A class used to instantiate and generate function object to templated member functions.
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
#define SITKIO_EXPORT
Definition sitkIO.h:33