ITK  4.6.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 >
43  public InPlaceImageFilter< TInputImage, TOutputImage >
44 
45 {
46 public:
52 
54  itkNewMacro(Self);
55 
58 
60  typedef TFunction FunctorType;
61  typedef TInputImage InputImageType;
62  typedef typename InputImageType::Pointer InputImagePointer;
63  typedef typename InputImageType::RegionType InputImageRegionType;
64  typedef typename InputImageType::PixelType InputImagePixelType;
65  typedef TOutputImage OutputImageType;
66  typedef typename OutputImageType::Pointer OutputImagePointer;
67  typedef typename OutputImageType::RegionType OutputImageRegionType;
68  typedef typename OutputImageType::PixelType OutputImagePixelType;
69  typedef std::vector< InputImagePixelType > NaryArrayType;
70 
76 
83  void SetFunctor(FunctorType & functor)
84  {
85  if ( m_Functor != functor )
86  {
87  m_Functor = functor;
88  this->Modified();
89  }
90  }
92 
94  itkStaticConstMacro(
95  InputImageDimension, unsigned int, TInputImage::ImageDimension);
96  itkStaticConstMacro(
97  OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
99 
100 #ifdef ITK_USE_CONCEPT_CHECKING
101  // Begin concept checking
102  itkConceptMacro( SameDimensionCheck,
104  itkConceptMacro( OutputHasZeroCheck,
106  // End concept checking
107 #endif
108 
109 protected:
112 
123  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
124  ThreadIdType threadId);
125 
126 private:
127  NaryFunctorImageFilter(const Self &); //purposely not implemented
128  void operator=(const Self &); //purposely not implemented
129 
131 };
132 } // end namespace itk
133 
134 #ifndef ITK_MANUAL_INSTANTIATION
135 #include "itkNaryFunctorImageFilter.hxx"
136 #endif
137 
138 #endif
InputImageType::Pointer InputImagePointer
InputImageType::PixelType InputImagePixelType
SmartPointer< const Self > ConstPointer
static const unsigned int OutputImageDimension
OutputImageType::PixelType OutputImagePixelType
Base class for all process objects that output image data.
std::vector< InputImagePixelType > NaryArrayType
static const unsigned int InputImageDimension
Perform a generic pixel-wise operation on N images.
void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, ThreadIdType threadId)
virtual void Modified() const
void SetFunctor(FunctorType &functor)
OutputImageType::RegionType OutputImageRegionType
InPlaceImageFilter< TInputImage, TOutputImage > Superclass
void operator=(const Self &)
InputImageType::RegionType InputImageRegionType
Base class for filters that take an image as input and overwrite that image as the output...
#define itkConceptMacro(name, concept)
OutputImageType::Pointer OutputImagePointer
unsigned int ThreadIdType
Definition: itkIntTypes.h:159