ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkMultiplyImageFilter.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 itkMultiplyImageFilter_h
19 #define itkMultiplyImageFilter_h
20 
22 
23 namespace itk
24 {
25 namespace Functor
26 {
32 template< typename TInput1, typename TInput2 = TInput1, typename TOutput = TInput1 >
33 class Mult
34 {
35 public:
36  Mult() {}
37  ~Mult() {}
38  bool operator!=(const Mult &) const
39  {
40  return false;
41  }
43 
44  bool operator==(const Mult & other) const
45  {
46  return !( *this != other );
47  }
48 
49  inline TOutput operator()(const TInput1 & A, const TInput2 & B) const
50  { return (TOutput)( A * B ); }
51 };
52 }
69 template< typename TInputImage1, typename TInputImage2 = TInputImage1, typename TOutputImage = TInputImage1 >
71  public
72  BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage,
73  Functor::Mult<
74  typename TInputImage1::PixelType,
75  typename TInputImage2::PixelType,
76  typename TOutputImage::PixelType > >
77 {
78 public:
81  typedef BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage,
83  typename TInputImage1::PixelType,
84  typename TInputImage2::PixelType,
85  typename TOutputImage::PixelType >
89 
91  itkNewMacro(Self);
92 
94  itkTypeMacro(MultiplyImageFilter,
96 
97 #ifdef ITK_USE_CONCEPT_CHECKING
98  // Begin concept checking
99  itkConceptMacro( Input1Input2OutputMultiplyOperatorCheck,
100  ( Concept::MultiplyOperator< typename TInputImage1::PixelType,
101  typename TInputImage2::PixelType,
102  typename TOutputImage::PixelType > ) );
103  // End concept checking
104 #endif
105 
106 protected:
108  virtual ~MultiplyImageFilter() {}
109 
110 private:
111  MultiplyImageFilter(const Self &) ITK_DELETE_FUNCTION;
112  void operator=(const Self &) ITK_DELETE_FUNCTION;
113 };
114 } // end namespace itk
115 
116 #endif
TOutput operator()(const TInput1 &A, const TInput2 &B) const
SmartPointer< const Self > ConstPointer
BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage, Functor::Mult< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > > Superclass
bool operator!=(const Mult &) const
SmartPointer< Self > Pointer
Base class for all process objects that output image data.
bool operator==(const Mult &other) const
Pixel-wise multiplication of two images.
#define itkConceptMacro(name, concept)
Implements pixel-wise generic operation of two images, or of an image and a constant.