ITK  6.0.0
Insight Toolkit
itkMatrixIndexSelectionImageFilter.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 itkMatrixIndexSelectionImageFilter_h
19#define itkMatrixIndexSelectionImageFilter_h
20
22
23namespace itk
24{
25namespace Functor
26{
27template <typename TInput, typename TOutput>
29{
30public:
33
34 void
35 GetIndices(unsigned int & i, unsigned int & j) const
36 {
37 i = m_I;
38 j = m_J;
39 }
40 void
41 SetIndices(unsigned int i, unsigned int j)
42 {
43 m_I = i;
44 m_J = j;
45 }
46
47 bool
48 operator==(const MatrixIndexSelection & other) const
49 {
50 return m_I == other.m_I && m_J == other.m_J;
51 }
52
54
55 inline TOutput
56 operator()(const TInput & A) const
57 {
58 return static_cast<TOutput>(A[m_I][m_J]);
59 }
60
61private:
62 unsigned int m_I;
63 unsigned int m_J;
64};
65} // namespace Functor
66
84template <typename TInputImage, typename TOutputImage>
87 TInputImage,
88 TOutputImage,
89 Functor::MatrixIndexSelection<typename TInputImage::PixelType, typename TOutputImage::PixelType>>
90{
91public:
92 ITK_DISALLOW_COPY_AND_MOVE(MatrixIndexSelectionImageFilter);
93
97 TInputImage,
98 TOutputImage,
102
104 itkOverrideGetNameOfClassMacro(MatrixIndexSelectionImageFilter);
105
107 itkNewMacro(Self);
108
110 void
111 SetIndices(unsigned int i, unsigned int j)
112 {
113 this->GetFunctor().SetIndices(i, j);
114 this->Modified();
115 }
118 void
119 GetIndices(unsigned int & i, unsigned int & j) const
120 {
121 return this->GetFunctor().GetIndices(i, j);
122 }
123
124#ifdef ITK_USE_CONCEPT_CHECKING
125 // Begin concept checking
127 // End concept checking
128#endif
129
130protected:
133};
134} // end namespace itk
135
136#endif
bool operator==(const MatrixIndexSelection &other) const
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(MatrixIndexSelection)
void GetIndices(unsigned int &i, unsigned int &j) const
void SetIndices(unsigned int i, unsigned int j)
Base class for all process objects that output image data.
Templated n-dimensional image class.
Definition: itkImage.h:89
Extracts the selected indices of a matrix image that is the input pixel type.
void SetIndices(unsigned int i, unsigned int j)
void GetIndices(unsigned int &i, unsigned int &j) const
~MatrixIndexSelectionImageFilter() override=default
virtual void Modified() const
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Implements pixel-wise generic operation on one image.
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....