NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkInjectSourceImageGreaterThanZeroIntoTargetImageFilter.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef itkInjectSourceImageGreaterThanZeroIntoTargetImageFilter_h
16 #define itkInjectSourceImageGreaterThanZeroIntoTargetImageFilter_h
17 
18 #include <itkBinaryFunctorImageFilter.h>
19 #include <itkNumericTraits.h>
20 
21 namespace itk
22 {
23 
24 namespace Functor
25 {
26 
31 template< class TInput1, class TInput2=TInput1, class TOutput=TInput1 >
33 {
34 public:
37  bool operator!=( const AWhereNoneZeroOtherwiseB& ) const
38  {
39  return false;
40  }
41  bool operator==( const AWhereNoneZeroOtherwiseB& other ) const
42  {
43  return !(*this != other);
44  }
45  inline TOutput operator()( const TInput1 & A, const TInput2 & B)
46  {
47  return static_cast<TOutput>( A != 0 ? A : B );
48  }
49 };
50 
51 } // end namespace Functor
52 
58 template <class TInputImage1, class TInputImage2=TInputImage1, class TOutputImage=TInputImage1>
60  public
61 BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
62  Functor::AWhereNoneZeroOtherwiseB<typename TInputImage1::PixelType,
63  typename TInputImage2::PixelType,
64  typename TOutputImage::PixelType
65  >
66  >
67 {
68 public:
69 
72  typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
74  typename TInputImage1::PixelType,
75  typename TInputImage2::PixelType,
76  typename TOutputImage::PixelType>
78  typedef SmartPointer<Self> Pointer;
79  typedef SmartPointer<const Self> ConstPointer;
80 
82  itkNewMacro(Self);
83 
86  BinaryFunctorImageFilter);
87 
88 #ifdef ITK_USE_CONCEPT_CHECKING
89 
90 // itkConceptMacro(Input1Input2OutputLogicalOperatorsCheck,
91 // (Concept::LogicalOperators<typename TInputImage1::PixelType,
92 // typename TInputImage2::PixelType,
93 // typename TOutputImage::PixelType>));
95 #endif
96 
97 protected:
100 
101 private:
102  InjectSourceImageGreaterThanZeroIntoTargetImageFilter(const Self&); //purposely not implemented
103  void operator=(const Self&); //purposely not implemented
104 
105 };
106 
107 } // end namespace
108 
109 
110 #endif
InjectSourceImageGreaterThanZeroIntoTargetImageFilter Self
Definition: itkInjectSourceImageGreaterThanZeroIntoTargetImageFilter.h:71
bool operator!=(const AWhereNoneZeroOtherwiseB &) const
Definition: itkInjectSourceImageGreaterThanZeroIntoTargetImageFilter.h:37
bool operator==(const AWhereNoneZeroOtherwiseB &other) const
Definition: itkInjectSourceImageGreaterThanZeroIntoTargetImageFilter.h:41
Definition: niftkITKAffineResampleImage.cxx:74
Function object that given two inputs A and B, will return A if A is not zero, and otherwise return B...
Definition: itkInjectSourceImageGreaterThanZeroIntoTargetImageFilter.h:32
SmartPointer< Self > Pointer
Definition: itkInjectSourceImageGreaterThanZeroIntoTargetImageFilter.h:78
SmartPointer< const Self > ConstPointer
Definition: itkInjectSourceImageGreaterThanZeroIntoTargetImageFilter.h:79
BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage, Functor::AWhereNoneZeroOtherwiseB< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > > Superclass
Definition: itkInjectSourceImageGreaterThanZeroIntoTargetImageFilter.h:77
float PixelType
Definition: niftkBreastDCEandADC.cxx:88
virtual ~InjectSourceImageGreaterThanZeroIntoTargetImageFilter()
Definition: itkInjectSourceImageGreaterThanZeroIntoTargetImageFilter.h:99
InjectSourceImageGreaterThanZeroIntoTargetImageFilter()
Definition: itkInjectSourceImageGreaterThanZeroIntoTargetImageFilter.h:98
If first input is != 0, then the first input is copied to output, otherwise, the second input pixel i...
Definition: itkInjectSourceImageGreaterThanZeroIntoTargetImageFilter.h:59
~AWhereNoneZeroOtherwiseB()
Definition: itkInjectSourceImageGreaterThanZeroIntoTargetImageFilter.h:36
TOutput operator()(const TInput1 &A, const TInput2 &B)
Definition: itkInjectSourceImageGreaterThanZeroIntoTargetImageFilter.h:45
AWhereNoneZeroOtherwiseB()
Definition: itkInjectSourceImageGreaterThanZeroIntoTargetImageFilter.h:35