Slicer  5.3
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
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 
23 namespace itk
24 {
25 
54 namespace Functor {
55 
56 template< class TInput1, class TInput2, class TOutput>
58 {
59 public:
63  {
64  return false;
65  }
66  bool operator==( const ConstrainedValueMultiplication & other ) const
67  {
68  return !(*this != other);
69  }
70  inline TOutput operator()( const TInput1 & A,
71  const TInput2 & B)
72  {
73  const double dA = static_cast<double>( A );
74  const double dB = static_cast<double>( B );
75  const double add = dA * dB;
76  const double cadd1 = ( add < NumericTraits<TOutput>::max() ) ?
77  add : NumericTraits<TOutput>::max();
78  const double cadd2 = ( cadd1 > NumericTraits<TOutput>::NonpositiveMin() ) ?
79  cadd1 : NumericTraits<TOutput>::NonpositiveMin();
80  return static_cast<TOutput>( cadd2 );
81  }
82 };
83 }
84 
85 template <class TInputImage1, class TInputImage2, class TOutputImage>
87  public
88 BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
89  Functor::ConstrainedValueMultiplication<
90  typename TInputImage1::PixelType,
91  typename TInputImage2::PixelType,
92  typename TOutputImage::PixelType> >
93 {
94 public:
97  typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
99  typename TInputImage1::PixelType,
100  typename TInputImage2::PixelType,
101  typename TOutputImage::PixelType> >
103  typedef SmartPointer<Self> Pointer;
104  typedef SmartPointer<const Self> ConstPointer;
105 
107  itkNewMacro(Self);
108 
111  BinaryFunctorImageFilter);
112 
113 #ifdef ITK_USE_CONCEPT_CHECKING
114 
115  itkConceptMacro(Input1ConvertibleToDoubleCheck,
116  (Concept::Convertible<typename TInputImage1::PixelType, double>));
117  itkConceptMacro(Input2ConvertibleToDoubleCheck,
118  (Concept::Convertible<typename TInputImage2::PixelType, double>));
119  itkConceptMacro(DoubleConvertibleToOutputCastCheck,
120  (Concept::Convertible<double, typename TOutputImage::PixelType>));
121  itkConceptMacro(DoubleLessThanOutputCheck,
122  (Concept::LessThanComparable<double, typename TOutputImage::PixelType>));
124 #endif
125 
126 protected:
128  ~ConstrainedValueMultiplicationImageFilter() override = default;
129 
130 private:
132  void operator=(const Self&) = delete;
133 
134 };
135 
136 }
137 
138 
139 #endif
bool operator==(const ConstrainedValueMultiplication &other) const
itkTypeMacro(ConstrainedValueMultiplicationImageFilter, BinaryFunctorImageFilter)
Simplified inverse ITK transforms.
~ConstrainedValueMultiplicationImageFilter() override=default
BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage, Functor::ConstrainedValueMultiplication< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > > Superclass
* itkConceptMacro(OutputEqualityComparableCheck, *(Concept::EqualityComparable< OutputImagePixelType >))
Implements pixel-wise the computation of constrained value addition.
bool operator!=(const ConstrainedValueMultiplication &) const