DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
itkFunctorBaseVectorImageFilter.h
Go to the documentation of this file.
1 
12 #ifndef itkFunctorBaseVectorImageFilter_h
13 #define itkFunctorBaseVectorImageFilter_h
14 
16 #include "utlCoreMacro.h"
17 #include "utlTypeinfo.h"
18 
19 namespace itk
20 {
36 template< typename TInputImage, typename TOutputImage, typename TFunction, class TMaskImage=Image<double,3> >
38  :public MaskedImageToImageFilter< TInputImage, TOutputImage, TMaskImage >
39 {
40 public:
44  typedef SmartPointer< Self > Pointer;
45  typedef SmartPointer< const Self > ConstPointer;
46 
48  itkNewMacro(Self);
49 
52 
54  typedef TFunction FunctorType;
55 
56  typedef TInputImage InputImageType;
57  typedef typename InputImageType::Pointer InputImagePointer;
58  typedef typename InputImageType::ConstPointer InputImageConstPointer;
59  typedef typename InputImageType::IndexType InputImageIndexType;
60  typedef typename InputImageType::SizeType InputImageSizeType;
61  typedef typename InputImageType::SpacingType InputImageSpacingType;
62  typedef typename InputImageType::PixelType InputImagePixelType;
63  typedef typename InputImageType::RegionType InputImageRegionType;
64 
65  typedef TOutputImage OutputImageType;
66  typedef typename OutputImageType::Pointer OutputImagePointer;
67  typedef typename OutputImageType::IndexType OutputImageIndexType;
68  typedef typename OutputImageType::SizeType OutputImageSizeType;
69  typedef typename OutputImageType::SpacingType OutputImageSpacingType;
70  typedef typename OutputImageType::PixelType OutputImagePixelType;
71  typedef typename OutputImageType::RegionType OutputImageRegionType;
72 
73  typedef typename Superclass::MaskImageType MaskImageType;
74 
75  itkSetGetMacro(VectorAxis, int);
76 
81  FunctorType & GetFunctor() { return m_Functor; }
82  const FunctorType & GetFunctor() const { return m_Functor; }
83 
90  void SetFunctor(const FunctorType & functor)
91  {
92  if ( m_Functor != functor )
93  {
94  m_Functor = functor;
95  this->Modified();
96  }
97  }
98 
99 protected:
101  {
102  this->SetNumberOfRequiredInputs(1);
103  }
105 
106 
107 protected:
108 
109  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE
110  {
111  Superclass::PrintSelf(os, indent);
112  utlLogOSVar(os << indent, m_VectorAxis);
113  m_Functor.Print(os <<indent << "m_Functor : "<< utl::TypeName(m_Functor)<< " ("<< &m_Functor <<") = \n");
114  }
115 
116  typename LightObject::Pointer InternalClone() const ITK_OVERRIDE
117  {
118  typename LightObject::Pointer loPtr = Superclass::InternalClone();
119 
120  typename Self::Pointer rval = dynamic_cast<Self *>(loPtr.GetPointer());
121  if(rval.IsNull())
122  {
123  itkExceptionMacro(<< "downcast to type " << this->GetNameOfClass()<< " failed.");
124  }
125  rval->m_Functor = m_Functor;
126  rval->m_VectorAxis = m_VectorAxis;
127  return loPtr;
128  }
129 
131  FunctorType m_Functor;
132 
134  int m_VectorAxis=3;
135 
136 private:
138  void operator=(const Self &) ITK_DELETE_FUNCTION;
139 
140 };
141 } // end namespace itk
142 
143 #endif
std::string TypeName()
Definition: utlTypeinfo.h:121
Created "07-04-2016.
Implements vector-valued generic operation on one image.
#define utlLogOSVar(os,...)
Definition: utlCoreMacro.h:285
InputImageType::ConstPointer InputImageConstPointer
void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
#define ITK_DELETE_FUNCTION
Definition: utlITKMacro.h:49
void SetFunctor(const FunctorType &functor)
LightObject::Pointer InternalClone() const ITK_OVERRIDE
#define ITK_OVERRIDE
Definition: utlITKMacro.h:46
MaskedImageToImageFilter< TInputImage, TOutputImage, TMaskImage > Superclass
ImageToImageFilter with mask and threaded logger support.
#define itkSetGetMacro(name, type)
Definition: utlITKMacro.h:134
macros for utlCore
OutputImageType::SpacingType OutputImageSpacingType