NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkBinaryIntersectWithPaddingImageFilter.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 itkBinaryIntersectWithPaddingImageFilter_h
16 #define itkBinaryIntersectWithPaddingImageFilter_h
17 
18 #include <itkBinaryFunctorImageFilter.h>
19 
20 namespace itk
21 {
22 
23 namespace Functor {
24 
31 template<class TInput, class TOutput>
33 {
34 public:
38  {
39  return false;
40  }
41  bool operator==(const BinaryIntersectWithPadding& other) const
42  {
43  return !(*this != other);
44  }
51  inline TOutput operator()(const TInput& value1, const TInput& value2)
52  {
53  TInput returnValue = 0;
54 
55  if (value1 != m_PaddingValue && value2 != m_PaddingValue)
56  returnValue = 1;
57  return returnValue;
58  }
62  void SetPaddingValue(const TInput& paddingValue)
63  {
64  m_PaddingValue = paddingValue;
65  }
66  TInput GetPaddingValue() const
67  {
68  return m_PaddingValue;
69  }
70 
71 private:
75  TInput m_PaddingValue;
76 };
77 } // End of namespace functor.
78 
79 
88 template <class TInputImage, class TOutputImage>
90  public BinaryFunctorImageFilter<TInputImage,TInputImage,TOutputImage,
91  Functor::BinaryIntersectWithPadding<
92  typename TInputImage::PixelType,
93  typename TOutputImage::PixelType> >
94 {
95 public:
100  typedef BinaryFunctorImageFilter<TInputImage,TInputImage,TOutputImage,
102  typename TInputImage::PixelType,
104  typedef SmartPointer<Self> Pointer;
105  typedef SmartPointer<const Self> ConstPointer;
109  itkNewMacro(Self);
113  itkTypeMacro(BinaryIntersectWithPaddingImageFilter, BinaryFunctorImageFilter);
117  itkSetMacro(PaddingValue, typename TInputImage::PixelType);
118  itkGetMacro(PaddingValue, typename TInputImage::PixelType);
119 
120 protected:
122  {
123  m_PaddingValue = NumericTraits<typename TInputImage::PixelType>::Zero;
124  }
126  void PrintSelf(std::ostream& os, Indent indent) const;
127  void BeforeThreadedGenerateData();
128 
129 private:
131  void operator=(const Self&);
135  typename TInputImage::PixelType m_PaddingValue;
136 
137 };
138 
139 } // end namespace itk
140 
141 #ifndef ITK_MANUAL_INSTANTIATION
142 #include "itkBinaryIntersectWithPaddingImageFilter.txx"
143 #endif
144 
145 
146 #endif
147 
148 
Calculate the intersection of two images using padding value.
Definition: itkBinaryIntersectWithPaddingImageFilter.h:89
BinaryFunctorImageFilter< TInputImage, TInputImage, TOutputImage, Functor::BinaryIntersectWithPadding< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
Definition: itkBinaryIntersectWithPaddingImageFilter.h:103
TInput GetPaddingValue() const
Definition: itkBinaryIntersectWithPaddingImageFilter.h:66
TOutput operator()(const TInput &value1, const TInput &value2)
Definition: itkBinaryIntersectWithPaddingImageFilter.h:51
SmartPointer< Self > Pointer
Definition: itkBinaryIntersectWithPaddingImageFilter.h:104
Definition: niftkITKAffineResampleImage.cxx:74
float PixelType
Definition: niftkBreastDCEandADC.cxx:88
BinaryIntersectWithPaddingImageFilter()
Definition: itkBinaryIntersectWithPaddingImageFilter.h:121
bool operator!=(const BinaryIntersectWithPadding &) const
Definition: itkBinaryIntersectWithPaddingImageFilter.h:37
SmartPointer< const Self > ConstPointer
Definition: itkBinaryIntersectWithPaddingImageFilter.h:105
Provide the operator to calculate the intersection of two pixels using padding value: return 1...
Definition: itkBinaryIntersectWithPaddingImageFilter.h:32
bool operator==(const BinaryIntersectWithPadding &other) const
Definition: itkBinaryIntersectWithPaddingImageFilter.h:41
~BinaryIntersectWithPadding()
Definition: itkBinaryIntersectWithPaddingImageFilter.h:36
virtual ~BinaryIntersectWithPaddingImageFilter()
Definition: itkBinaryIntersectWithPaddingImageFilter.h:125
void SetPaddingValue(const TInput &paddingValue)
Definition: itkBinaryIntersectWithPaddingImageFilter.h:62
BinaryIntersectWithPaddingImageFilter Self
Definition: itkBinaryIntersectWithPaddingImageFilter.h:99
BinaryIntersectWithPadding()
Definition: itkBinaryIntersectWithPaddingImageFilter.h:35