ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkNaryFunctorImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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:
43  public InPlaceImageFilter< TInputImage, TOutputImage >
44 
45 {
46 public:
47  ITK_DISALLOW_COPY_AND_ASSIGN(NaryFunctorImageFilter);
48 
54 
56  itkNewMacro(Self);
57 
60 
62  using FunctorType = TFunction;
63  using InputImageType = TInputImage;
64  using InputImagePointer = typename InputImageType::Pointer;
66  using InputImagePixelType = typename InputImageType::PixelType;
67  using OutputImageType = TOutputImage;
68  using OutputImagePointer = typename OutputImageType::Pointer;
70  using OutputImagePixelType = typename OutputImageType::PixelType;
71  using NaryArrayType = std::vector< InputImagePixelType >;
72 
77  FunctorType & GetFunctor() { return m_Functor; }
78 
85  void SetFunctor(FunctorType & functor)
86  {
87  if ( m_Functor != functor )
88  {
89  m_Functor = functor;
90  this->Modified();
91  }
92  }
94 
96  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
97  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
98 
99 #ifdef ITK_USE_CONCEPT_CHECKING
100  // Begin concept checking
101  itkConceptMacro( SameDimensionCheck,
103  itkConceptMacro( OutputHasZeroCheck,
105  // End concept checking
106 #endif
107 
108 protected:
110  ~NaryFunctorImageFilter() override = default;
111 
122  void DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
123 
124 
125 private:
127 };
128 } // end namespace itk
129 
130 #ifndef ITK_MANUAL_INSTANTIATION
131 #include "itkNaryFunctorImageFilter.hxx"
132 #endif
133 
134 #endif
typename OutputImageType::Pointer OutputImagePointer
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
typename OutputImageType::PixelType OutputImagePixelType
typename InputImageType::PixelType InputImagePixelType
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
Perform a generic pixel-wise operation on N images.
void SetFunctor(FunctorType &functor)
typename InputImageType::RegionType InputImageRegionType
Base class for filters that take an image as input and overwrite that image as the output...
#define itkConceptMacro(name, concept)