go home Home | Main Page | Topics | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Loading...
Searching...
No Matches
itkNDImageBase.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
19#ifndef itkNDImageBase_h
20#define itkNDImageBase_h
21
22#include "itkImage.h"
23#include "itkArray.h"
24#include <string>
25#include "itkImageFileWriter.h"
26
27namespace itk
28{
29
56
57template <typename TPixel>
58class ITK_TEMPLATE_EXPORT NDImageBase : public Object
59{
60public:
62
65 using Superclass = Object;
66 using Pointer = SmartPointer<Self>;
67 using ConstPointer = SmartPointer<const Self>;
68
70 // itkNewMacro( Self );
71 // not declared, because instantiating an object of this
72 // (abstract) type makes no sense.
73
76
77 using DataObjectPointer = DataObject::Pointer;
78
80 using PixelType = typename Image<TPixel, 2>::PixelType;
81 using ValueType = typename Image<TPixel, 2>::ValueType;
82 using InternalPixelType = typename Image<TPixel, 2>::InternalPixelType;
83 using AccessorType = typename Image<TPixel, 2>::AccessorType;
84 using PixelContainer = typename Image<TPixel, 2>::PixelContainer;
85 using PixelContainerPointer = typename Image<TPixel, 2>::PixelContainerPointer;
86 using PixelContainerConstPointer = typename Image<TPixel, 2>::PixelContainerConstPointer;
87
88 using Spacing2DType = typename ImageBase<2>::SpacingType;
89 using Point2DType = typename ImageBase<2>::PointType;
90
91 using SpacingValueType = typename Spacing2DType::ValueType;
92 using PointValueType = typename Point2DType::ValueType;
93 using OffsetValueType = typename ImageBase<2>::OffsetValueType;
94
100 using IndexType = Array<IndexValueType>;
101 using SizeType = Array<SizeValueType>;
102 using SpacingType = Array<SpacingValueType>;
103 using PointType = Array<PointValueType>;
104 using OffsetType = Array<OffsetValueType>;
106
108
109 // using typename Superclass::RegionType;
110
118
119 // void SetRegions(RegionType region) = 0;
120 virtual void
122
123 virtual void
124 SetRequestedRegion(DataObject * data) = 0;
125
126 virtual void
127 Allocate() = 0;
128
129 virtual void
131
132 virtual void
133 FillBuffer(const TPixel & value) = 0;
134
135 virtual void
136 SetPixel(const IndexType & index, const TPixel & value) = 0;
137
138 virtual const TPixel &
139 GetPixel(const IndexType & index) const = 0;
140
141 virtual TPixel &
142 GetPixel(const IndexType & index) = 0;
143
144 TPixel &
145 operator[](const IndexType & index)
146 {
147 return this->GetPixel(index);
148 }
149 const TPixel &
150 operator[](const IndexType & index) const
151 {
152 return this->GetPixel(index);
153 }
154
155 virtual TPixel *
157
158 virtual const TPixel *
159 GetBufferPointer() const = 0;
160
161 virtual PixelContainer *
163
164 virtual const PixelContainer *
165 GetPixelContainer() const = 0;
166
167 virtual void
169
170 virtual AccessorType
172
173 virtual const AccessorType
174 GetPixelAccessor() const = 0;
175
176 virtual void
177 SetSpacing(const SpacingType & spacing) = 0;
178
179 virtual void
180 SetOrigin(const PointType & origin) = 0;
181
182 /* Get Spacing/Origin return copies; not a const &, like
183 * itkImage; necessary because of the conversion to arrays */
184 virtual SpacingType
186
187 virtual PointType
189
191
192 virtual void
193 CopyInformation(const DataObject * data) = 0;
194
195 virtual const OffsetValueType *
196 GetOffsetTable() const = 0;
197
198 virtual OffsetValueType
199 ComputeOffset(const IndexType & ind) const = 0;
200
201 virtual IndexType
202 ComputeIndex(OffsetValueType offset) const = 0;
203
205
207 virtual unsigned int
209
210 virtual unsigned int
212
213 virtual void
215
216 virtual ImageIOBase *
218
219 virtual void
221
222 virtual ImageIOBase *
224
226 virtual void
227 Write() = 0;
228
230 virtual void
231 Read() = 0;
232
234 virtual void
236
238 virtual void
239 SetOutputFileName(const char *) = 0;
240
241 virtual void
242 SetInputFileName(const char *) = 0;
243
244 virtual const char *
246
247 virtual const char *
249
250 static Pointer
251 NewNDImage(unsigned int dim);
252
253protected:
254 NDImageBase() = default;
255 ~NDImageBase() override = default;
256
257 // virtual void PrintSelf(std::ostream& os, Indent indent) const = 0;
258};
259
260} // end namespace itk
261
262#include "itkNDImageTemplate.h"
263
264namespace itk
265{
266
267template <typename TPixel>
268auto
270{
271 switch (dim)
272 {
273 case 1:
274 return NDImageTemplate<TPixel, 1>::New().GetPointer();
275 case 2:
276 return NDImageTemplate<TPixel, 2>::New().GetPointer();
277 case 3:
278 return NDImageTemplate<TPixel, 3>::New().GetPointer();
279 case 4:
280 return NDImageTemplate<TPixel, 4>::New().GetPointer();
281 case 5:
282 return NDImageTemplate<TPixel, 5>::New().GetPointer();
283 // add here more dimensions if needed...
284 // we could do this also with a recursive
285 // template and a #define MAXDIM,
286 // or something like that....
287 default:
288 return nullptr;
289 }
290}
291
292
293} // end namespace itk
294
295#endif // end #ifndef itkNDImageBase_h
virtual void Initialize()=0
typename Spacing2DType::ValueType SpacingValueType
virtual void Allocate()=0
virtual const TPixel * GetBufferPointer() const =0
Array< IndexValueType > IndexType
Array< SizeValueType > SizeType
virtual void SetSpacing(const SpacingType &spacing)=0
const TPixel & operator[](const IndexType &index) const
static Pointer NewNDImage(unsigned int dim)
virtual void CreateNewImage()=0
virtual void FillBuffer(const TPixel &value)=0
virtual void Read()=0
typename ImageBase< 2 >::OffsetValueType OffsetValueType
virtual void SetImageIOWriter(ImageIOBase *_arg)=0
typename Image< TPixel, 2 >::PixelContainer PixelContainer
virtual TPixel & GetPixel(const IndexType &index)=0
virtual void CopyInformation(const DataObject *data)=0
virtual const TPixel & GetPixel(const IndexType &index) const =0
SmartPointer< const Self > ConstPointer
~NDImageBase() override=default
virtual unsigned int ImageDimension()=0
virtual OffsetValueType ComputeOffset(const IndexType &ind) const =0
typename ImageBase< 2 >::PointType Point2DType
Array< OffsetValueType > OffsetType
virtual void SetInputFileName(const char *)=0
virtual void SetRequestedRegion(DataObject *data)=0
virtual const OffsetValueType * GetOffsetTable() const =0
Array< PointValueType > PointType
virtual void SetPixelContainer(PixelContainer *container)=0
virtual IndexType ComputeIndex(OffsetValueType offset) const =0
typename Image< TPixel, 2 >::PixelContainerConstPointer PixelContainerConstPointer
virtual PointType GetOrigin()=0
virtual const AccessorType GetPixelAccessor() const =0
virtual SpacingType GetSpacing()=0
virtual void SetImageIOReader(ImageIOBase *_arg)=0
virtual PixelContainer * GetPixelContainer()=0
virtual unsigned int GetImageDimension()=0
virtual const char * GetOutputFileName()=0
typename ImageBase< 2 >::SpacingType Spacing2DType
Array< SpacingValueType > SpacingType
typename Image< TPixel, 2 >::AccessorType AccessorType
virtual TPixel * GetBufferPointer()=0
virtual void SetOutputFileName(const char *)=0
ITK_DISALLOW_COPY_AND_MOVE(NDImageBase)
virtual ImageIOBase * GetImageIOReader()=0
NDImageBase()=default
typename Image< TPixel, 2 >::InternalPixelType InternalPixelType
typename Point2DType::ValueType PointValueType
itkOverrideGetNameOfClassMacro(NDImageBase)
SmartPointer< Self > Pointer
virtual void SetPixel(const IndexType &index, const TPixel &value)=0
virtual ImageIOBase * GetImageIOWriter()=0
virtual AccessorType GetPixelAccessor()=0
TPixel & operator[](const IndexType &index)
virtual const PixelContainer * GetPixelContainer() const =0
typename Image< TPixel, 2 >::ValueType ValueType
DataObject::Pointer DataObjectPointer
virtual void SetRegions(SizeType size)=0
virtual void SetOrigin(const PointType &origin)=0
virtual const char * GetInputFileName()=0
virtual void Write()=0
typename Image< TPixel, 2 >::PixelContainerPointer PixelContainerPointer
static Pointer New()


Generated on 1774142652 for elastix by doxygen 1.15.0 elastix logo