ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkDivideImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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
26namespace itk
27{
28
47template <typename TInputImage1, typename TInputImage2, typename TOutputImage>
48class ITK_TEMPLATE_EXPORT DivideImageFilter
49 : public BinaryGeneratorImageFilter<TInputImage1, TInputImage2, TOutputImage>
50{
51public:
52 ITK_DISALLOW_COPY_AND_MOVE(DivideImageFilter);
53
58
63
71
75 itkNewMacro(Self);
76
78 itkOverrideGetNameOfClassMacro(DivideImageFilter);
79
81 itkConceptMacro(Input1Input2OutputDivisionOperatorsCheck,
82 (Concept::DivisionOperators<typename TInputImage1::PixelType,
83 typename TInputImage2::PixelType,
84 typename TOutputImage::PixelType>));
85
86protected:
88 {
89#if !defined(ITK_WRAPPING_PARSER)
91#endif
92 }
93
94 ~DivideImageFilter() override = default;
95
96 void
97 VerifyPreconditions() const override
98 {
100
101 const auto * input =
102 dynamic_cast<const typename Superclass::DecoratedInput2ImagePixelType *>(this->ProcessObject::GetInput(1));
103 if (input != nullptr && itk::Math::AlmostEquals(input->Get(), typename TInputImage2::PixelType{}))
104 {
105 itkGenericExceptionMacro("The constant value used as denominator should not be set to zero");
106 }
107 }
108};
109
110} // end namespace itk
111
112#endif
SimpleDataObjectDecorator< Input2ImagePixelType > DecoratedInput2ImagePixelType
void SetFunctor(const std::function< ConstRefFunctionType > &f)
void VerifyPreconditions() const override
Verifies that the process object has been configured correctly, that all required inputs are set,...
Functor::Div< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > FunctorType
SmartPointer< Self > Pointer
BinaryGeneratorImageFilter< TInputImage1, TInputImage2, TOutputImage > Superclass
~DivideImageFilter() override=default
SmartPointer< const Self > ConstPointer
virtual void VerifyPreconditions() const
Verifies that the process object has been configured correctly, that all required inputs are set,...
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
Implements transparent reference counting.
Functor::Add2< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > FunctorType
#define itkConceptMacro(name, concept)
bool AlmostEquals(T1 x1, T2 x2)
Provide consistent equality checks between values of potentially different scalar or complex types.
Definition itkMath.h:682
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....