Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
itkConstrainedValueMultiplicationImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: itkConstrainedValueMultiplicationImageFilter.h,v $
5 Language: C++
6 Date: $Date: 2007-09-27 11:36:40 $
7 Version: $Revision: 1.7 $
8
9 Copyright (c) Insight Software Consortium. All rights reserved.
10 See ITKCopyright.txt or https://www.itk.org/HTML/Copyright.htm for details.
11
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
15
16=========================================================================*/
17#ifndef itkConstrainedValueMultiplicationImageFilter_h
18#define itkConstrainedValueMultiplicationImageFilter_h
19
20#include "itkBinaryFunctorImageFilter.h"
21#include "itkNumericTraits.h"
22
23namespace itk
24{
25
52namespace Functor {
53
54template< class TInput1, class TInput2, class TOutput>
56{
57public:
61 {
62 return false;
63 }
64 bool operator==( const ConstrainedValueMultiplication & other ) const
65 {
66 return !(*this != other);
67 }
68 inline TOutput operator()( const TInput1 & A,
69 const TInput2 & B)
70 {
71 const double dA = static_cast<double>( A );
72 const double dB = static_cast<double>( B );
73 const double add = dA * dB;
74 const double cadd1 = ( add < NumericTraits<TOutput>::max() ) ?
75 add : NumericTraits<TOutput>::max();
76 const double cadd2 = ( cadd1 > NumericTraits<TOutput>::NonpositiveMin() ) ?
77 cadd1 : NumericTraits<TOutput>::NonpositiveMin();
78 return static_cast<TOutput>( cadd2 );
79 }
80};
81}
82
83template <class TInputImage1, class TInputImage2, class TOutputImage>
85 public
86BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
87 Functor::ConstrainedValueMultiplication<
88 typename TInputImage1::PixelType,
89 typename TInputImage2::PixelType,
90 typename TOutputImage::PixelType> >
91{
92public:
95 typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
97 typename TInputImage1::PixelType,
98 typename TInputImage2::PixelType,
99 typename TOutputImage::PixelType> >
101 typedef SmartPointer<Self> Pointer;
102 typedef SmartPointer<const Self> ConstPointer;
103
106
109 BinaryFunctorImageFilter);
110
111#ifdef ITK_USE_CONCEPT_CHECKING
113 itkConceptMacro(Input1ConvertibleToDoubleCheck,
114 (Concept::Convertible<typename TInputImage1::PixelType, double>));
115 itkConceptMacro(Input2ConvertibleToDoubleCheck,
116 (Concept::Convertible<typename TInputImage2::PixelType, double>));
117 itkConceptMacro(DoubleConvertibleToOutputCastCheck,
118 (Concept::Convertible<double, typename TOutputImage::PixelType>));
119 itkConceptMacro(DoubleLessThanOutputCheck,
120 (Concept::LessThanComparable<double, typename TOutputImage::PixelType>));
122#endif
123
124protected:
127
128private:
130 void operator=(const Self&) = delete;
131
132};
133
134}
135
136
137#endif
BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage, Functor::ConstrainedValueMultiplication< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > > Superclass
~ConstrainedValueMultiplicationImageFilter() override=default
itkTypeMacro(ConstrainedValueMultiplicationImageFilter, BinaryFunctorImageFilter)
bool operator==(const ConstrainedValueMultiplication &other) const
bool operator!=(const ConstrainedValueMultiplication &) const
Simplified inverse ITK transforms.