ANIMA  4.0
animaBaseTransformAgregator.hxx
Go to the documentation of this file.
1 #pragma once
3 
4 namespace anima
5 {
6 
7 template <unsigned int NDimensions>
8 BaseTransformAgregator <NDimensions>::
9 BaseTransformAgregator()
10 {
11  m_InputTransformType = TRANSLATION;
12  m_OutputTransformType = TRANSLATION;
13  m_Output = NULL;
14  m_UpToDate = false;
15  m_VerboseAgregation = true;
16 
17  m_InputTransforms.clear();
18  m_InputOrigins.clear();
19  m_Weights.clear();
20 
21  m_OrthogonalDirectionMatrix.Fill(0);
22 }
23 
24 template <unsigned int NDimensions>
26 ~BaseTransformAgregator()
27 {
28 }
29 
30 template <unsigned int NDimensions>
31 void
33 SetInputTransformType(TRANSFORM_TYPE name)
34 {
35  if (name == SVF)
36  {
37  std::cerr << "SVF input type is not yet supported, check your code" << std::endl;
38  exit(-1);
39  }
40 
41  if (name != m_InputTransformType)
42  m_UpToDate = false;
43 
44  m_InputTransformType = name;
45 }
46 
47 template <unsigned int NDimensions>
48 void
50 SetOutputTransformType(TRANSFORM_TYPE name)
51 {
52  if (name == DIRECTIONAL_AFFINE)
53  {
54  std::cerr << "Directional affine output type is not yet supported, check your code" << std::endl;
55  exit(-1);
56  }
57 
58  if (name != m_OutputTransformType)
59  m_UpToDate = false;
60 
61  m_OutputTransformType = name;
62 }
63 
64 template <unsigned int NDimensions>
67 GetOutput()
68 {
69  bool updateOk = true;
70  if (!m_UpToDate)
71  updateOk = this->Update();
72 
73  if (updateOk)
74  return m_Output;
75  else
76  return NULL;
77 }
78 
79 template <unsigned int NDimensions>
80 void
82 SetOutput(BaseOutputTransformType *output)
83 {
84  m_Output = output;
85 }
86 
87 template <unsigned int NDimensions>
88 void
90 SetInputTransforms(std::vector <BaseInputTransformPointer> &inputTransforms)
91 {
92  m_InputTransforms = inputTransforms;
93 
94  m_UpToDate = false;
95 }
96 
97 
98 template <unsigned int NDimensions>
99 void
101 SetCurrentLinearTransform(BaseInputTransformPointer &inputTransform)
102 {
103  m_CurrentLinearTransform = inputTransform;
104 
105  m_UpToDate = false;
106 }
107 
108 template <unsigned int NDimensions>
109 void
111 SetOrthogonalDirectionMatrix(const MatrixType &inputTransform)
112 {
113  m_OrthogonalDirectionMatrix = inputTransform;
114 
115  m_UpToDate = false;
116 }
117 } // end of namespace anima
itk::Transform< ScalarType, NDimensions, NDimensions > BaseOutputTransformType
BaseInputTransformType::Pointer BaseInputTransformPointer
itk::Matrix< ScalarType, NDimensions, NDimensions > MatrixType