ITK  6.0.0
Insight Toolkit
itkDefaultPixelAccessorFunctor.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 * https://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 itkDefaultPixelAccessorFunctor_h
19#define itkDefaultPixelAccessorFunctor_h
20
21#include "itkMacro.h"
22
23namespace itk
24{
46template <typename TImageType>
48{
49public:
50 using ImageType = TImageType;
51 using InternalPixelType = typename ImageType::InternalPixelType;
52 using ExternalPixelType = typename ImageType::PixelType;
53 using PixelAccessorType = typename ImageType::AccessorType;
54 using VectorLengthType = unsigned int;
55
61 template <typename UImageType>
62 struct Rebind
63 {
65 };
66
67
68 static void
70 {}
71
72 static VectorLengthType
74 {
75 return 1;
76 }
77
82 inline void
84 {
85 m_PixelAccessor = accessor;
86 }
87
91 inline void
92 SetBegin(const InternalPixelType * itkNotUsed(begin))
93 {}
94
96 inline void
97 Set(InternalPixelType & output, const ExternalPixelType & input) const
98 {
99 m_PixelAccessor.Set(output, input);
100 }
101
103 inline ExternalPixelType
104 Get(InternalPixelType & input) const
105 {
106 return m_PixelAccessor.Get(input);
107 }
108
110 inline const ExternalPixelType
111 Get(const InternalPixelType & input) const
112 {
113 return m_PixelAccessor.Get(input);
114 }
115
116private:
117 PixelAccessorType m_PixelAccessor; // The pixel accessor
118};
119} // namespace itk
120
121#endif
Provides a common API for pixel accessors for Image and VectorImage.
typename ImageType::AccessorType PixelAccessorType
typename ImageType::PixelType ExternalPixelType
static void SetVectorLength(ImageType *, VectorLengthType)
typename ImageType::InternalPixelType InternalPixelType
ExternalPixelType Get(InternalPixelType &input) const
void Set(InternalPixelType &output, const ExternalPixelType &input) const
const ExternalPixelType Get(const InternalPixelType &input) const
static VectorLengthType GetVectorLength(const ImageType *)
void SetBegin(const InternalPixelType *)
void SetPixelAccessor(const PixelAccessorType &accessor)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....