ITK  5.2.0
Insight Toolkit
itkNaryFunctorImageFilter.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 itkNaryFunctorImageFilter_h
19 #define itkNaryFunctorImageFilter_h
20 
21 #include "itkInPlaceImageFilter.h"
22 #include "itkImageIterator.h"
23 #include "itkArray.h"
24 
25 namespace itk
26 {
41 template <typename TInputImage, typename TOutputImage, typename TFunction>
42 class ITK_TEMPLATE_EXPORT NaryFunctorImageFilter : public InPlaceImageFilter<TInputImage, TOutputImage>
43 
44 {
45 public:
46  ITK_DISALLOW_COPY_AND_MOVE(NaryFunctorImageFilter);
47 
53 
55  itkNewMacro(Self);
56 
59 
61  using FunctorType = TFunction;
62  using InputImageType = TInputImage;
63  using InputImagePointer = typename InputImageType::Pointer;
65  using InputImagePixelType = typename InputImageType::PixelType;
66  using OutputImageType = TOutputImage;
67  using OutputImagePointer = typename OutputImageType::Pointer;
69  using OutputImagePixelType = typename OutputImageType::PixelType;
70  using NaryArrayType = std::vector<InputImagePixelType>;
71 
76  FunctorType &
78  {
79  return m_Functor;
80  }
81 
88  void
90  {
91  if (m_Functor != functor)
92  {
93  m_Functor = functor;
94  this->Modified();
95  }
96  }
98 
100  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
101  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
102 
103 #ifdef ITK_USE_CONCEPT_CHECKING
104  // Begin concept checking
107  // End concept checking
108 #endif
109 
110 protected:
112  ~NaryFunctorImageFilter() override = default;
113 
124  void
125  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
126 
127 
128 private:
130 };
131 } // end namespace itk
132 
133 #ifndef ITK_MANUAL_INSTANTIATION
134 # include "itkNaryFunctorImageFilter.hxx"
135 #endif
136 
137 #endif
itkImageIterator.h
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::NaryFunctorImageFilter::m_Functor
FunctorType m_Functor
Definition: itkNaryFunctorImageFilter.h:129
itk::Concept::HasZero
Definition: itkConceptChecking.h:787
itk::NaryFunctorImageFilter::GetFunctor
FunctorType & GetFunctor()
Definition: itkNaryFunctorImageFilter.h:77
itk::InPlaceImageFilter
Base class for filters that take an image as input and overwrite that image as the output.
Definition: itkInPlaceImageFilter.h:77
itk::NaryFunctorImageFilter
Perform a generic pixel-wise operation on N images.
Definition: itkNaryFunctorImageFilter.h:42
itk::SmartPointer< Self >
itk::Concept::SameDimension
Definition: itkConceptChecking.h:694
itk::ImageToImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkImageToImageFilter.h:133
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkArray.h
itk::Functor::Maximum1< TInputImage::PixelType, TInputImage::PixelType >
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkInPlaceImageFilter.h
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::NaryFunctorImageFilter::SetFunctor
void SetFunctor(FunctorType &functor)
Definition: itkNaryFunctorImageFilter.h:89
itk::NaryFunctorImageFilter< TInputImage, TOutputImage, Functor::Maximum1< TInputImage::PixelType, TInputImage::PixelType > >::NaryArrayType
std::vector< InputImagePixelType > NaryArrayType
Definition: itkNaryFunctorImageFilter.h:70
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90