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::OffsetValueType;
82
84 using typename Superclass::IndexType;
85 using typename Superclass::SizeType;
86 using typename Superclass::SpacingType;
87 using typename Superclass::PointType;
88 using typename Superclass::OffsetType;
89
92 using ImagePointer = typename ImageType::Pointer;
94 using WriterPointer = typename WriterType::Pointer;
95 using ReaderType = ImageFileReader<ImageType>;
96 using ReaderPointer = typename ReaderType::Pointer;
97
99 using IndexTypeD = typename ImageType::IndexType;
100 using SizeTypeD = typename ImageType::SizeType;
101 using SpacingTypeD = typename ImageType::SpacingType;
102 using PointTypeD = typename ImageType::PointType;
103 using OffsetTypeD = typename ImageType::OffsetType;
104
105 void
106 SetRegions(SizeType size) override;
107
108 void
109 SetRequestedRegion(DataObject * data) override;
110
111 void
112 Allocate() override;
113
114 void
115 Initialize() override;
116
117 void
118 FillBuffer(const TPixel & value) override;
119
120 void
121 SetPixel(const IndexType & index, const TPixel & value) override;
122
123 const TPixel &
124 GetPixel(const IndexType & index) const override;
125
126 TPixel &
127 GetPixel(const IndexType & index) override;
128
129 TPixel *
131
132 const TPixel *
133 GetBufferPointer() const override;
134
137
138 const PixelContainer *
139 GetPixelContainer() const override;
140
141 void
142 SetPixelContainer(PixelContainer * container) override;
143
146
147 const AccessorType
148 GetPixelAccessor() const override;
149
150 void
151 SetSpacing(const SpacingType & spacing) override;
152
153 void
154 SetOrigin(const PointType & origin) override;
155
157 GetSpacing() override;
158
160 GetOrigin() override;
161
164 void
165 CopyInformation(const DataObject * data) override;
166
167 const OffsetValueType *
168 GetOffsetTable() const override;
169
171 ComputeOffset(const IndexType & ind) const override;
172
174 ComputeIndex(OffsetValueType offset) const override;
175
179 unsigned int
180 ImageDimension() override;
181
182 unsigned int
184
187 itkGetModifiableObjectMacro(Writer, ProcessObject);
188 itkGetModifiableObjectMacro(Reader, ProcessObject);
189
191 void
192 Write() override;
193
195 void
196 Read() override;
197
199 void
200 CreateNewImage() override;
201
202 void
204
207
208 void
210
213
215 void
216 SetOutputFileName(const char * name) override;
217
218 void
219 SetInputFileName(const char * name) override;
220
221 const char *
223
224 const char *
226
227protected:
228 NDImageTemplate() = default;
229 ~NDImageTemplate() override = default;
230
231 // virtual void PrintSelf(std::ostream& os, Indent indent) const;
232
233 ImagePointer m_Image{ nullptr };
234 WriterPointer m_Writer{ nullptr };
235 ReaderPointer m_Reader{ nullptr };
236
237 template <class TIn, class TOut>
238 class ITK_TEMPLATE_EXPORT ConvertToDynamicArray
239 {
240 public:
241 static TOut
242 DO(const TIn & in)
243 {
244 TOut out(VDimension);
245
246 for (unsigned int i = 0; i < VDimension; ++i)
247 {
248 out[i] = in[i];
249 }
250 return out;
251 }
252 };
253
254 template <class TIn, class TOut>
255 class ITK_TEMPLATE_EXPORT ConvertToStaticArray
256 {
257 public:
258 static TOut
259 DO(const TIn & in)
260 {
261 TOut out;
262
263 for (unsigned int i = 0; i < VDimension; ++i)
264 {
265 out[i] = in[i];
266 }
267 return out;
268 }
269 };
270};
271
272} // end namespace itk
273
274#ifndef ITK_MANUAL_INSTANTIATION
275# include "itkNDImageTemplate.hxx"
276#endif
277
278#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 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 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 2024-07-17 for elastix by doxygen 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) elastix logo