go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkNDImageTemplate.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
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 itkNDImageTemplate_h
19#define itkNDImageTemplate_h
20
21#include "itkNDImageBase.h"
22#include "itkImageFileReader.h"
23
24namespace itk
25{
26
44template <class TPixel, unsigned int VDimension>
45class ITK_TEMPLATE_EXPORT NDImageTemplate : public NDImageBase<TPixel>
46{
47public:
49
53 using Pointer = SmartPointer<Self>;
54 using ConstPointer = SmartPointer<const Self>;
55
57 itkNewMacro(Self);
58
61
66 itkStaticConstMacro(Dimension, unsigned int, VDimension);
67
68 using typename Superclass::DataObjectPointer;
69
71 using typename Superclass::PixelType;
72 using typename Superclass::ValueType;
73 using typename Superclass::InternalPixelType;
74 using typename Superclass::AccessorType;
75 using typename Superclass::PixelContainer;
78
79 using typename Superclass::SpacingValueType;
80 using typename Superclass::PointValueType;
81 using typename Superclass::IndexValueType;
82 using typename Superclass::SizeValueType;
83 using typename Superclass::OffsetValueType;
84
86 using typename Superclass::IndexType;
87 using typename Superclass::SizeType;
88 using typename Superclass::SpacingType;
89 using typename Superclass::PointType;
90 using typename Superclass::OffsetType;
91
94 using ImagePointer = typename ImageType::Pointer;
96 using WriterPointer = typename WriterType::Pointer;
97 using ReaderType = ImageFileReader<ImageType>;
98 using ReaderPointer = typename ReaderType::Pointer;
99
101 using IndexTypeD = typename ImageType::IndexType;
102 using SizeTypeD = typename ImageType::SizeType;
103 using SpacingTypeD = typename ImageType::SpacingType;
104 using PointTypeD = typename ImageType::PointType;
105 using OffsetTypeD = typename ImageType::OffsetType;
106
107 void
108 SetRegions(SizeType size) override;
109
110 void
111 SetRequestedRegion(DataObject * data) override;
112
113 void
114 Allocate() override;
115
116 void
117 Initialize() override;
118
119 void
120 FillBuffer(const TPixel & value) override;
121
122 void
123 SetPixel(const IndexType & index, const TPixel & value) override;
124
125 const TPixel &
126 GetPixel(const IndexType & index) const override;
127
128 TPixel &
129 GetPixel(const IndexType & index) override;
130
131 TPixel *
133
134 const TPixel *
135 GetBufferPointer() const override;
136
139
140 const PixelContainer *
141 GetPixelContainer() const override;
142
143 void
144 SetPixelContainer(PixelContainer * container) override;
145
148
149 const AccessorType
150 GetPixelAccessor() const override;
151
152 void
153 SetSpacing(const SpacingType & spacing) override;
154
155 void
156 SetOrigin(const PointType & origin) override;
157
159 GetSpacing() override;
160
162 GetOrigin() override;
163
166 void
167 CopyInformation(const DataObject * data) override;
168
169 const OffsetValueType *
170 GetOffsetTable() const override;
171
173 ComputeOffset(const IndexType & ind) const override;
174
176 ComputeIndex(OffsetValueType offset) const override;
177
181 unsigned int
182 ImageDimension() override;
183
184 unsigned int
186
189 itkGetModifiableObjectMacro(Writer, ProcessObject);
190 itkGetModifiableObjectMacro(Reader, ProcessObject);
191
193 void
194 Write() override;
195
197 void
198 Read() override;
199
201 void
202 CreateNewImage() override;
203
204 void
206
209
210 void
212
215
217 void
218 SetOutputFileName(const char * name) override;
219
220 void
221 SetInputFileName(const char * name) override;
222
223 const char *
225
226 const char *
228
229protected:
230 NDImageTemplate() = default;
231 ~NDImageTemplate() override = default;
232
233 // virtual void PrintSelf(std::ostream& os, Indent indent) const;
234
235 ImagePointer m_Image{ nullptr };
236 WriterPointer m_Writer{ nullptr };
237 ReaderPointer m_Reader{ nullptr };
238
239 template <class TIn, class TOut>
240 class ITK_TEMPLATE_EXPORT ConvertToDynamicArray
241 {
242 public:
243 static TOut
244 DO(const TIn & in)
245 {
246 TOut out(VDimension);
247
248 for (unsigned int i = 0; i < VDimension; ++i)
249 {
250 out[i] = in[i];
251 }
252 return out;
253 }
254 };
255
256 template <class TIn, class TOut>
257 class ITK_TEMPLATE_EXPORT ConvertToStaticArray
258 {
259 public:
260 static TOut
261 DO(const TIn & in)
262 {
263 TOut out;
264
265 for (unsigned int i = 0; i < VDimension; ++i)
266 {
267 out[i] = in[i];
268 }
269 return out;
270 }
271 };
272};
273
274} // end namespace itk
275
276#ifndef ITK_MANUAL_INSTANTIATION
277# include "itkNDImageTemplate.hxx"
278#endif
279
280#endif // end #ifndef itkNDImageTemplate_h
An image whose dimension can be specified at runtime.
typename Spacing2DType::ValueType SpacingValueType
Array< IndexValueType > IndexType
Array< SizeValueType > SizeType
typename ImageBase< 2 >::OffsetValueType OffsetValueType
typename Image< TPixel, 2 >::PixelContainer PixelContainer
Array< OffsetValueType > OffsetType
Array< PointValueType > PointType
typename ImageBase< 2 >::SizeValueType SizeValueType
typename Image< TPixel, 2 >::PixelContainerConstPointer PixelContainerConstPointer
Array< SpacingValueType > SpacingType
typename Image< TPixel, 2 >::AccessorType AccessorType
typename Image< TPixel, 2 >::InternalPixelType InternalPixelType
typename Point2DType::ValueType PointValueType
typename Image< TPixel, 2 >::ValueType ValueType
DataObject::Pointer DataObjectPointer
typename ImageBase< 2 >::IndexValueType IndexValueType
typename Image< TPixel, 2 >::PixelContainerPointer PixelContainerPointer
This class is a specialization of the NDImageBase, which acts as a wrap around an itk::Image.
IndexType ComputeIndex(OffsetValueType offset) const override
PointType GetOrigin() override
typename ImageType::SpacingType SpacingTypeD
itkGetModifiableObjectMacro(Image, DataObject)
const TPixel * GetBufferPointer() const override
Array< IndexValueType > IndexType
Array< SizeValueType > SizeType
void SetImageIOWriter(ImageIOBase *_arg) override
void SetOrigin(const PointType &origin) override
void SetOutputFileName(const char *name) override
PixelContainer * GetPixelContainer() override
typename ReaderType::Pointer ReaderPointer
void Write() override
void FillBuffer(const TPixel &value) override
itkStaticConstMacro(Dimension, unsigned int, VDimension)
typename ImageBase< 2 >::OffsetValueType OffsetValueType
typename Image< TPixel, 2 >::PixelContainer PixelContainer
typename ImageType::PointType PointTypeD
const TPixel & GetPixel(const IndexType &index) const override
TPixel & GetPixel(const IndexType &index) override
void SetRegions(SizeType size) override
ITK_DISALLOW_COPY_AND_MOVE(NDImageTemplate)
~NDImageTemplate() override=default
void SetPixel(const IndexType &index, const TPixel &value) override
typename ImageType::Pointer ImagePointer
itkGetModifiableObjectMacro(Writer, ProcessObject)
itkGetModifiableObjectMacro(Reader, ProcessObject)
Array< PointValueType > PointType
const OffsetValueType * GetOffsetTable() const override
void Initialize() override
AccessorType GetPixelAccessor() override
ImageIOBase * GetImageIOReader() override
typename ImageType::IndexType IndexTypeD
const PixelContainer * GetPixelContainer() const override
void SetInputFileName(const char *name) override
void Allocate() override
typename WriterType::Pointer WriterPointer
const char * GetOutputFileName() override
void CreateNewImage() override
NDImageTemplate()=default
Array< SpacingValueType > SpacingType
typename Image< TPixel, 2 >::AccessorType AccessorType
void SetRequestedRegion(DataObject *data) override
const AccessorType GetPixelAccessor() const override
ImageFileReader< ImageType > ReaderType
unsigned int GetImageDimension() override
SmartPointer< const Self > ConstPointer
void SetPixelContainer(PixelContainer *container) override
void Read() override
unsigned int ImageDimension() override
void SetImageIOReader(ImageIOBase *_arg) override
SpacingType GetSpacing() override
TPixel * GetBufferPointer() override
void SetSpacing(const SpacingType &spacing) override
typename ImageType::OffsetType OffsetTypeD
ImageIOBase * GetImageIOWriter() override
typename ImageType::SizeType SizeTypeD
const char * GetInputFileName() override
void CopyInformation(const DataObject *data) override
OffsetValueType ComputeOffset(const IndexType &ind) const override


Generated on 2023-01-13 for elastix by doxygen 1.9.6 elastix logo