ANIMA  4.0
animaBalooSVFTransformAgregator.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include <itkStationaryVelocityFieldTransform.h>
5 
6 namespace anima
7 {
8 
9 template <unsigned int NDimensions = 3>
11 public BaseTransformAgregator <NDimensions>
12 {
13 public:
15  typedef typename Superclass::PointType PointType;
18  typedef typename itk::StationaryVelocityFieldTransform<ScalarType,NDimensions> BaseOutputTransformType;
20 
21  typedef itk::Image <ScalarType,NDimensions> WeightImageType;
22  typedef typename WeightImageType::Pointer WeightImagePointer;
23 
24  typedef itk::MatrixOffsetTransformBase <InternalScalarType, NDimensions, NDimensions> BaseMatrixTransformType;
25  typedef typename BaseMatrixTransformType::ParametersType ParametersType;
26 
27  typedef typename BaseOutputTransformType::VectorFieldType VelocityFieldType;
28  typedef typename VelocityFieldType::Pointer VelocityFieldPointer;
29  typedef typename VelocityFieldType::IndexType VelocityFieldIndexType;
30  typedef typename VelocityFieldType::PixelType VelocityFieldPixelType;
31  typedef typename VelocityFieldType::PointType VelocityFieldPointType;
32  typedef typename VelocityFieldType::RegionType VelocityFieldRegionType;
33  typedef typename VelocityFieldType::SpacingType VelocityFieldSpacingType;
34  typedef typename VelocityFieldType::DirectionType VelocityFieldDirectionType;
35 
38 
39  virtual bool Update();
40 
41  void SetExtrapolationSigma(double sigma) {m_ExtrapolationSigma = sigma;}
43 
44  void SetOutlierRejectionSigma(double sigma) {m_OutlierRejectionSigma = sigma;}
46 
47  void SetNumberOfWorkUnits(unsigned int num) {m_NumberOfThreads = num;}
48  unsigned int GetNumberOfWorkUnits() {return m_NumberOfThreads;}
49 
50  template <class TInputImageType> void SetGeometryInformation(const TInputImageType *geomImage)
51  {
52  if (geomImage == NULL)
53  return;
54 
55  m_Origin = geomImage->GetOrigin();
56  m_LargestRegion = geomImage->GetLargestPossibleRegion();
57  m_Spacing = geomImage->GetSpacing();
58  m_Direction = geomImage->GetDirection();
59  }
60 
61 protected:
64 
65  VelocityFieldPointType m_Origin;
66  VelocityFieldRegionType m_LargestRegion;
67  VelocityFieldSpacingType m_Spacing;
68  VelocityFieldDirectionType m_Direction;
69 
70  unsigned int m_NumberOfThreads;
71 
72 private:
73  void estimateSVFFromTranslations();
74  void estimateSVFFromRigidTransforms();
75  void estimateSVFFromAffineTransforms();
76 
77  template <unsigned int NDegreesOfFreedom>
78  void
79  filterInputs(WeightImageType *weights, typename itk::Image < itk::Vector <ScalarType, NDegreesOfFreedom>, NDimensions >::Pointer &output,
80  std::vector < itk::Vector <ScalarType, NDegreesOfFreedom> > &curTrsfs,
81  std::vector < typename itk::Image < itk::Vector <ScalarType, NDegreesOfFreedom>, NDimensions >::IndexType > &posIndexes);
82 
83  double m_ZeroWeight;
84 };
85 
86 } // end of namespace anima
87 
VelocityFieldType::IndexType VelocityFieldIndexType
itk::Point< InternalScalarType, NDimensions > PointType
BaseOutputTransformType::VectorFieldType VelocityFieldType
BaseTransformAgregator< NDimensions > Superclass
itk::MatrixOffsetTransformBase< InternalScalarType, NDimensions, NDimensions > BaseMatrixTransformType
VelocityFieldType::PixelType VelocityFieldPixelType
VelocityFieldType::DirectionType VelocityFieldDirectionType
Superclass::InternalScalarType InternalScalarType
VelocityFieldType::PointType VelocityFieldPointType
void SetGeometryInformation(const TInputImageType *geomImage)
Superclass::BaseInputTransformType BaseInputTransformType
VelocityFieldType::RegionType VelocityFieldRegionType
itk::StationaryVelocityFieldTransform< ScalarType, NDimensions > BaseOutputTransformType
itk::Transform< InternalScalarType, NDimensions, NDimensions > BaseInputTransformType
BaseMatrixTransformType::ParametersType ParametersType
VelocityFieldType::SpacingType VelocityFieldSpacingType
itk::Image< ScalarType, NDimensions > WeightImageType