ANIMA  4.0
animaNonLocalPatchBaseSearcher.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <itkImage.h>
4 #include <itkMacro.h>
5 
6 namespace anima
7 {
8 
14 template <class ImageType>
16 {
17 public:
18  typedef typename ImageType::IndexType IndexType;
19  typedef typename ImageType::SizeType SizeType;
20  typedef typename ImageType::RegionType ImageRegionType;
21  typedef typename ImageType::Pointer ImagePointer;
22  typedef typename ImageType::PixelType PixelType;
23 
26 
27  void SetPatchHalfSize(unsigned int arg) {m_PatchHalfSize = arg;}
28  void SetSearchStepSize(unsigned int arg) {m_SearchStepSize = arg;}
29  void SetMaxAbsDisp(unsigned int arg) {m_MaxAbsDisp = arg;}
30  void SetWeightThreshold(double arg) {m_WeightThreshold = arg;}
31 
32  void SetInputImage(ImageType *arg) {m_InputImage = arg;}
33  itkGetObjectMacro(InputImage, ImageType)
34 
35  void AddComparisonImage(ImageType *arg);
36  ImageType *GetComparisonImage(unsigned int index);
37 
38  itkGetConstReferenceMacro(DatabaseWeights, std::vector <double>)
39  itkGetConstReferenceMacro(DatabaseSamples, std::vector <PixelType>)
40 
41  void UpdateAtPosition(const IndexType &dataIndex);
42 
43 protected:
44  virtual void ComputeInputProperties(const IndexType &refIndex, ImageRegionType &refPatch) {}
45  virtual void ComputeComparisonProperties(unsigned int index, ImageRegionType &movingPatch) {}
46  virtual double ComputeWeightValue(unsigned int index, ImageRegionType &refPatch, ImageRegionType &movingPatch) = 0;
47  virtual bool TestPatchConformity(unsigned int index, const IndexType &refIndex, const IndexType &movingIndex) = 0;
48 
49 private:
50  unsigned int m_PatchHalfSize;
51  unsigned int m_SearchStepSize;
52  unsigned int m_MaxAbsDisp;
53  double m_WeightThreshold;
54 
55  ImagePointer m_InputImage;
56  std::vector <ImagePointer> m_ComparisonImages;
57 
58  std::vector <double> m_DatabaseWeights;
59  std::vector <PixelType> m_DatabaseSamples;
60 };
61 
62 } // end namespace anima
63 
virtual void ComputeComparisonProperties(unsigned int index, ImageRegionType &movingPatch)
virtual bool TestPatchConformity(unsigned int index, const IndexType &refIndex, const IndexType &movingIndex)=0
void UpdateAtPosition(const IndexType &dataIndex)
ImageType * GetComparisonImage(unsigned int index)
virtual double ComputeWeightValue(unsigned int index, ImageRegionType &refPatch, ImageRegionType &movingPatch)=0
virtual void ComputeInputProperties(const IndexType &refIndex, ImageRegionType &refPatch)
itkGetObjectMacro(InputImage, ImageType) void AddComparisonImage(ImageType *arg)