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 
23 namespace itk
24 {
25 namespace Functor
26 {
27 template <typename TInput, typename TOutput>
29 {
30 public:
32  ~MatrixIndexSelection() = default;
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 
61 private:
62  unsigned int m_I;
63  unsigned int m_J;
64 };
65 } // namespace Functor
66 
84 template <typename TInputImage, typename TOutputImage>
86  : public UnaryFunctorImageFilter<
87  TInputImage,
88  TOutputImage,
89  Functor::MatrixIndexSelection<typename TInputImage::PixelType, typename TOutputImage::PixelType>>
90 {
91 public:
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 
130 protected:
132  ~MatrixIndexSelectionImageFilter() override = default;
133 };
134 } // end namespace itk
135 
136 #endif
itk::Functor::MatrixIndexSelection::~MatrixIndexSelection
~MatrixIndexSelection()=default
itkUnaryFunctorImageFilter.h
itk::Functor::MatrixIndexSelection::m_J
unsigned int m_J
Definition: itkMatrixIndexSelectionImageFilter.h:63
itk::Concept::HasNumericTraits
Definition: itkConceptChecking.h:716
itk::UnaryFunctorImageFilter
Implements pixel-wise generic operation on one image.
Definition: itkUnaryFunctorImageFilter.h:50
itk::Functor::MatrixIndexSelection::operator==
bool operator==(const MatrixIndexSelection &other) const
Definition: itkMatrixIndexSelectionImageFilter.h:48
itk::MatrixIndexSelectionImageFilter
Extracts the selected indices of a matrix image that is the input pixel type.
Definition: itkMatrixIndexSelectionImageFilter.h:85
itk::SmartPointer< Self >
itk::Functor::MatrixIndexSelection::SetIndices
void SetIndices(unsigned int i, unsigned int j)
Definition: itkMatrixIndexSelectionImageFilter.h:41
itk::Functor::MatrixIndexSelection::GetIndices
void GetIndices(unsigned int &i, unsigned int &j) const
Definition: itkMatrixIndexSelectionImageFilter.h:35
itk::MatrixIndexSelectionImageFilter::~MatrixIndexSelectionImageFilter
~MatrixIndexSelectionImageFilter() override=default
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::Functor::MatrixIndexSelection
Definition: itkMatrixIndexSelectionImageFilter.h:28
itk::Functor::MatrixIndexSelection::MatrixIndexSelection
MatrixIndexSelection()
Definition: itkMatrixIndexSelectionImageFilter.h:31
itk::MatrixIndexSelectionImageFilter::GetIndices
void GetIndices(unsigned int &i, unsigned int &j) const
Definition: itkMatrixIndexSelectionImageFilter.h:119
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::MatrixIndexSelectionImageFilter::MatrixIndexSelectionImageFilter
MatrixIndexSelectionImageFilter()=default
itk::UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::MatrixIndexSelection< TInputImage::PixelType, TOutputImage::PixelType > >::GetFunctor
FunctorType & GetFunctor()
Definition: itkUnaryFunctorImageFilter.h:85
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:88
itk::Functor::MatrixIndexSelection::ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(MatrixIndexSelection)
itk::Functor::MatrixIndexSelection::operator()
TOutput operator()(const TInput &A) const
Definition: itkMatrixIndexSelectionImageFilter.h:56
itk::Object::Modified
virtual void Modified() const
itk::Functor::MatrixIndexSelection::m_I
unsigned int m_I
Definition: itkMatrixIndexSelectionImageFilter.h:62
itk::MatrixIndexSelectionImageFilter::SetIndices
void SetIndices(unsigned int i, unsigned int j)
Definition: itkMatrixIndexSelectionImageFilter.h:111