ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkDivideImageFilter.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 itkDivideImageFilter_h
19 #define itkDivideImageFilter_h
20 
23 #include "itkNumericTraits.h"
24 #include "itkMath.h"
25 
26 namespace itk
27 {
28 
46 template< typename TInputImage1, typename TInputImage2, typename TOutputImage >
47 class ITK_TEMPLATE_EXPORT DivideImageFilter:
48  public
49  BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage,
50  Functor::Div<
51  typename TInputImage1::PixelType,
52  typename TInputImage2::PixelType,
53  typename TOutputImage::PixelType > >
54 {
55 public:
60 
64  typedef BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage,
66  typename TInputImage1::PixelType,
67  typename TInputImage2::PixelType,
68  typename TOutputImage::PixelType >
70 
76 
80  itkNewMacro(Self);
81 
83  itkTypeMacro(DivideImageFilter,
85 
86 #ifdef ITK_USE_CONCEPT_CHECKING
87  // Begin concept checking
88  itkConceptMacro( IntConvertibleToInput2Check,
90  itkConceptMacro( Input1Input2OutputDivisionOperatorsCheck,
91  ( Concept::DivisionOperators< typename TInputImage1::PixelType,
92  typename TInputImage2::PixelType,
93  typename TOutputImage::PixelType > ) );
94  // End concept checking
95 #endif
96 
97 protected:
99  virtual ~DivideImageFilter() ITK_OVERRIDE {}
100 
101  void GenerateData() ITK_OVERRIDE
102  {
103  const typename Superclass::DecoratedInput2ImagePixelType *input
104  = dynamic_cast< const typename Superclass::DecoratedInput2ImagePixelType * >(
105  this->ProcessObject::GetInput(1) );
107  {
108  itkGenericExceptionMacro(<<"The constant value used as denominator should not be set to zero");
109  }
110  else
111  {
112  Superclass::GenerateData();
113  }
114  }
115 
116 private:
117  ITK_DISALLOW_COPY_AND_ASSIGN(DivideImageFilter);
118 
119 };
120 } // end namespace itk
121 
122 #endif
virtual ~DivideImageFilter() override
Base class for all process objects that output image data.
SmartPointer< const Self > ConstPointer
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
bool AlmostEquals(T1 x1, T2 x2)
Provide consistent equality checks between values of potentially different scalar or complex types...
Definition: itkMath.h:672
#define itkConceptMacro(name, concept)
SmartPointer< Self > Pointer
Implements pixel-wise generic operation of two images, or of an image and a constant.
BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage, Functor::Div< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > > Superclass
Pixel-wise division of two images.