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 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
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
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
137ImportAsInt8(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
145ImportAsUInt8(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
153ImportAsInt16(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
161ImportAsUInt16(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
169ImportAsInt32(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
177ImportAsUInt32(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
185ImportAsInt64(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
193ImportAsUInt64(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
201ImportAsFloat(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
209ImportAsDouble(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
The Image class for SimpleITK.
Definition sitkImage.h:77
Self & SetBufferAsUInt64(uint64_t *buffer, unsigned int numberOfComponents=1)
Self & SetBufferAsFloat(float *buffer, unsigned int numberOfComponents=1)
const std::vector< double > & GetDirection() const
std::string ToString() const override
const std::vector< unsigned int > & GetSize() const
Self & SetSpacing(const std::vector< double > &spacing)
std::unique_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
Self & SetSize(const std::vector< unsigned int > &size)
Self & SetBufferAsUInt32(uint32_t *buffer, unsigned int numberOfComponents=1)
Self & SetBufferAsDouble(double *buffer, unsigned int numberOfComponents=1)
Image Execute() override
Set/Get The output PixelType of the image.
Self & SetDirection(const std::vector< double > &direction)
Self & SetBufferAsInt8(int8_t *buffer, unsigned int numberOfComponents=1)
std::string GetName() const override
Self & SetBufferAsInt64(int64_t *buffer, unsigned int numberOfComponents=1)
Self & SetOrigin(const std::vector< double > &origin)
std::vector< unsigned int > m_Size
Self & SetBufferAsInt32(int32_t *buffer, unsigned int numberOfComponents=1)
const std::vector< double > & GetSpacing() const
Self & SetBufferAsInt16(int16_t *buffer, unsigned int numberOfComponents=1)
const std::vector< double > & GetOrigin() const
Self & SetBufferAsUInt16(uint16_t *buffer, unsigned int numberOfComponents=1)
Self & SetBufferAsUInt8(uint8_t *buffer, unsigned int numberOfComponents=1)
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