NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkExcludeImageFilter.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 itkExcludeImageFilter_h
16 #define itkExcludeImageFilter_h
17 #include <itkBinaryFunctorImageFilter.h>
18 #include <itkNumericTraits.h>
19 
20 
21 namespace itk
22 {
23 
33 namespace Functor
34 {
35 
36 template< class TInput1, class TInput2=TInput1, class TOutput=TInput1>
38 {
39 public:
40  typedef typename NumericTraits< TInput1 >::AccumulateType AccumulatorType;
43 
44  bool operator!=( const ConnectionBreak & ) const
45  {
46  return false;
47  }
48 
49  bool operator==( const ConnectionBreak & other ) const
50  {
51  return !(*this != other);
52  }
53 
54  inline TOutput operator() ( const TInput1 & A, const TInput2 & B) const
55  {
56  //const AccumulatorType sum = A;
57 
58  if( (A != 0) && (B == 0))
59  {
60  return static_cast<TOutput>(1);
61  }
62  else
63  {
64  return static_cast<TOutput>(0);
65  }
66  }
67 
68 }; //end of class ConnectionBreak
69 
70 } //end of namespace Functor
71 
72 
73 template <class TInputImage1, class TInputImage2=TInputImage1, class TOutputImage=TInputImage1>
74 class ITK_EXPORT ExcludeImageFilter : public BinaryFunctorImageFilter<TInputImage1,
75  TInputImage2,
76  TOutputImage,
77  Functor::ConnectionBreak< typename TInputImage1::PixelType, typename TInputImage2::PixelType,
78  typename TOutputImage::PixelType > >
79 {
80 public:
83  typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
85  typename TInputImage2::PixelType,
87  typedef SmartPointer<Self> Pointer;
88  typedef SmartPointer<const Self> ConstPointer;
89 
91  itkNewMacro(Self);
92 
94  itkTypeMacro(ExcludeImageFilter,
95  BinaryFunctorImageFilter);
96 
97 #ifdef ITK_USE_CONCEPT_CHECKING
98 
99  itkConceptMacro(Input1Input2OutputAdditiveOperatorsCheck,
100  (Concept::AdditiveOperators<typename TInputImage1::PixelType,
101  typename TInputImage2::PixelType,
102  typename TOutputImage::PixelType>));
104 #endif
105 
106 protected:
108  virtual ~ExcludeImageFilter() {}
109 
110 private:
111  ExcludeImageFilter(const Self&); //purposely not implemented
112  void operator=(const Self&); //purposely not implemented
113 
114 };
115 
116 } // end namespace itk
117 
118 
119 
120 #endif /* ITKEXCLUDEIMAGEFILTER_H_ */
virtual ~ExcludeImageFilter()
Definition: itkExcludeImageFilter.h:108
TOutput operator()(const TInput1 &A, const TInput2 &B) const
Definition: itkExcludeImageFilter.h:54
SmartPointer< Self > Pointer
Definition: itkExcludeImageFilter.h:87
ExcludeImageFilter()
Definition: itkExcludeImageFilter.h:107
Definition: niftkITKAffineResampleImage.cxx:74
Definition: itkExcludeImageFilter.h:37
~ConnectionBreak()
Definition: itkExcludeImageFilter.h:42
BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage, Functor::ConnectionBreak< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > > Superclass
Definition: itkExcludeImageFilter.h:86
NumericTraits< TInput1 >::AccumulateType AccumulatorType
Definition: itkExcludeImageFilter.h:40
float PixelType
Definition: niftkBreastDCEandADC.cxx:88
ExcludeImageFilter Self
Definition: itkExcludeImageFilter.h:82
ConnectionBreak()
Definition: itkExcludeImageFilter.h:41
Performs the connection breaker algorithm as in "Interactive Algorithms for the segmentation and quan...
Definition: itkExcludeImageFilter.h:74
SmartPointer< const Self > ConstPointer
Definition: itkExcludeImageFilter.h:88
bool operator==(const ConnectionBreak &other) const
Definition: itkExcludeImageFilter.h:49
bool operator!=(const ConnectionBreak &) const
Definition: itkExcludeImageFilter.h:44