ITK  4.2.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< class TInput1, class TInput2 = TInput1, class 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< class TInputImage1, class TInputImage2 = TInputImage1, class TOutputImage = TInputImage1 >
70 class ITK_EXPORT MultiplyImageFilter:
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 
99  itkConceptMacro( Input1Input2OutputMultiplyOperatorCheck,
100  ( Concept::MultiplyOperator< typename TInputImage1::PixelType,
101  typename TInputImage2::PixelType,
102  typename TOutputImage::PixelType > ) );
103 
105 #endif
106 protected:
108  virtual ~MultiplyImageFilter() {}
109 private:
110  MultiplyImageFilter(const Self &); //purposely not implemented
111  void operator=(const Self &); //purposely not implemented
112 };
113 } // end namespace itk
115 
116 #endif
117