NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
itkCropTargetImageWhereSourceImageNonZero.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 itkCropTargetImageWhereSourceImageNonZero_h
16 #define itkCropTargetImageWhereSourceImageNonZero_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:
38  {
39  return false;
40  }
41  bool operator==( const BWhereANonZeroOtherwiseZero& 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 ? B : 0 );
48  }
49 };
50 
51 } // end namespace Functor
52 
57 template <class TInputImage1, class TInputImage2=TInputImage1, class TOutputImage=TInputImage1>
59  public
60 BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
61  Functor::BWhereANonZeroOtherwiseZero<typename TInputImage1::PixelType,
62  typename TInputImage2::PixelType,
63  typename TOutputImage::PixelType
64  >
65  >
66 {
67 public:
68 
71  typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
73  typename TInputImage1::PixelType,
74  typename TInputImage2::PixelType,
75  typename TOutputImage::PixelType>
77  typedef SmartPointer<Self> Pointer;
78  typedef SmartPointer<const Self> ConstPointer;
79 
81  itkNewMacro(Self);
82 
85  BinaryFunctorImageFilter);
86 
87 #ifdef ITK_USE_CONCEPT_CHECKING
88 
89 // itkConceptMacro(Input1Input2OutputLogicalOperatorsCheck,
90 // (Concept::LogicalOperators<typename TInputImage1::PixelType,
91 // typename TInputImage2::PixelType,
92 // typename TOutputImage::PixelType>));
94 #endif
95 
96 protected:
99 
100 private:
101  CropTargetImageWhereSourceImageNonZeroImageFilter(const Self&); //purposely not implemented
102  void operator=(const Self&); //purposely not implemented
103 
104 };
105 
106 } // end namespace
107 
108 
109 #endif
~BWhereANonZeroOtherwiseZero()
Definition: itkCropTargetImageWhereSourceImageNonZero.h:36
Crops the target (second input) where the source image (first input) is non zero. ...
Definition: itkCropTargetImageWhereSourceImageNonZero.h:58
BWhereANonZeroOtherwiseZero()
Definition: itkCropTargetImageWhereSourceImageNonZero.h:35
Definition: niftkITKAffineResampleImage.cxx:74
TOutput operator()(const TInput1 &A, const TInput2 &B)
Definition: itkCropTargetImageWhereSourceImageNonZero.h:45
bool operator==(const BWhereANonZeroOtherwiseZero &other) const
Definition: itkCropTargetImageWhereSourceImageNonZero.h:41
bool operator!=(const BWhereANonZeroOtherwiseZero &) const
Definition: itkCropTargetImageWhereSourceImageNonZero.h:37
CropTargetImageWhereSourceImageNonZeroImageFilter()
Definition: itkCropTargetImageWhereSourceImageNonZero.h:97
CropTargetImageWhereSourceImageNonZeroImageFilter Self
Definition: itkCropTargetImageWhereSourceImageNonZero.h:70
BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage, Functor::BWhereANonZeroOtherwiseZero< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > > Superclass
Definition: itkCropTargetImageWhereSourceImageNonZero.h:76
float PixelType
Definition: niftkBreastDCEandADC.cxx:88
Function object that given two inputs A and B, will return B if A is not zero, and otherwise return 0...
Definition: itkCropTargetImageWhereSourceImageNonZero.h:32
SmartPointer< Self > Pointer
Definition: itkCropTargetImageWhereSourceImageNonZero.h:77
virtual ~CropTargetImageWhereSourceImageNonZeroImageFilter()
Definition: itkCropTargetImageWhereSourceImageNonZero.h:98
SmartPointer< const Self > ConstPointer
Definition: itkCropTargetImageWhereSourceImageNonZero.h:78