ITK  5.2.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  * 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 itkDefaultPixelAccessorFunctor_h
19 #define itkDefaultPixelAccessorFunctor_h
20 
21 #include "itkMacro.h"
22 
23 namespace itk
24 {
46 template <typename TImageType>
48 {
49 public:
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 
116 private:
117  PixelAccessorType m_PixelAccessor; // The pixel accessor
118 };
119 } // namespace itk
120 
121 #endif
itk::DefaultPixelAccessorFunctor::SetBegin
void SetBegin(const InternalPixelType *)
Definition: itkDefaultPixelAccessorFunctor.h:92
itk::DefaultPixelAccessorFunctor::SetVectorLength
static void SetVectorLength(ImageType *, VectorLengthType)
Definition: itkDefaultPixelAccessorFunctor.h:69
itk::DefaultPixelAccessorFunctor::m_PixelAccessor
PixelAccessorType m_PixelAccessor
Definition: itkDefaultPixelAccessorFunctor.h:117
itk::DefaultPixelAccessorFunctor::ImageType
TImageType ImageType
Definition: itkDefaultPixelAccessorFunctor.h:50
itk::DefaultPixelAccessorFunctor
Provides a common API for pixel accessors for Image and VectorImage.
Definition: itkDefaultPixelAccessorFunctor.h:47
itkMacro.h
itk::DefaultPixelAccessorFunctor::Rebind
Definition: itkDefaultPixelAccessorFunctor.h:62
itk::DefaultPixelAccessorFunctor::Get
ExternalPixelType Get(InternalPixelType &input) const
Definition: itkDefaultPixelAccessorFunctor.h:104
itk::DefaultPixelAccessorFunctor::PixelAccessorType
typename ImageType::AccessorType PixelAccessorType
Definition: itkDefaultPixelAccessorFunctor.h:53
itk::DefaultPixelAccessorFunctor::Set
void Set(InternalPixelType &output, const ExternalPixelType &input) const
Definition: itkDefaultPixelAccessorFunctor.h:97
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::DefaultPixelAccessorFunctor::GetVectorLength
static VectorLengthType GetVectorLength(const ImageType *)
Definition: itkDefaultPixelAccessorFunctor.h:73
itk::DefaultPixelAccessorFunctor::VectorLengthType
unsigned int VectorLengthType
Definition: itkDefaultPixelAccessorFunctor.h:54
itk::DefaultPixelAccessorFunctor::InternalPixelType
typename ImageType::InternalPixelType InternalPixelType
Definition: itkDefaultPixelAccessorFunctor.h:51
itk::DefaultPixelAccessorFunctor::ExternalPixelType
typename ImageType::PixelType ExternalPixelType
Definition: itkDefaultPixelAccessorFunctor.h:52
itk::DefaultPixelAccessorFunctor::Get
const ExternalPixelType Get(const InternalPixelType &input) const
Definition: itkDefaultPixelAccessorFunctor.h:111
itk::DefaultPixelAccessorFunctor::SetPixelAccessor
void SetPixelAccessor(const PixelAccessorType &accessor)
Definition: itkDefaultPixelAccessorFunctor.h:83