ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkMultiTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkMultiTransform_h
19 #define itkMultiTransform_h
20 
21 #include "itkTransform.h"
22 
23 #include <deque>
24 
25 namespace itk
26 {
27 
62 template
63 <typename TParametersValueType=double, unsigned int NDimensions=3, unsigned int NSubDimensions=NDimensions>
65  public Transform<TParametersValueType, NDimensions, NSubDimensions>
66 {
67 public:
73 
75  itkTypeMacro( MultiTransform, Transform );
76 
80 
81  /* Types common to both container and sub transforms */
82 
89 
92 
95 
98 
99  /* Types relative to the container transform. */
100 
103 
107 
111 
115 
119 
123 
127 
131 
132  /* Types relative to the sub transform type. */
133 
136 
138  typedef std::deque<TransformTypePointer> TransformQueueType;
139 
142 
144  itkStaticConstMacro( InputDimension, unsigned int, NDimensions );
145  itkStaticConstMacro( OutputDimension, unsigned int, NDimensions );
147 
148  itkStaticConstMacro( SubInputDimension, unsigned int, NSubDimensions );
149  itkStaticConstMacro( SubOutputDimension, unsigned int, NSubDimensions );
150 
156  virtual void AddTransform( TransformType *t )
157  {
158  this->PushBackTransform( t );
159  }
160 
162  virtual void AppendTransform( TransformType *t )
163  {
164  this->AddTransform( t );
165  }
166 
168  virtual void PrependTransform( TransformType *t )
169  {
170  this->PushFrontTransform( t );
171  }
172 
174  virtual void RemoveTransform()
175  {
176  this->PopBackTransform();
177  }
178 
180  virtual const
182  {
183  return this->m_TransformQueue.front().GetPointer();
184  }
185 
186  virtual const
188  {
189  return this->m_TransformQueue.back().GetPointer();
190  }
191 
192  virtual const
194  {
195  //NOTE: By returning a smart pointer type, the use of this function can
196  // be a significant bottleneck in multithreaded applications.
197  return this->m_TransformQueue[n];
198  }
199 
202  virtual
204  {
205  return this->m_TransformQueue[n].GetPointer();
206  }
207 
208  virtual const
210  {
211  return this->m_TransformQueue[n].GetPointer();
212  }
213 
215  virtual const TransformQueueType & GetTransformQueue() const
216  {
217  return this->m_TransformQueue;
218  }
219 
221  virtual bool IsTransformQueueEmpty() const
222  {
223  return this->m_TransformQueue.empty();
224  }
225 
228  {
229  return this->m_TransformQueue.size();
230  }
231 
233  virtual void ClearTransformQueue()
234  {
235  this->m_TransformQueue.clear();
236  this->Modified();
237  }
239 
241  virtual bool IsLinear() const ITK_OVERRIDE;
242 
245  virtual TransformCategoryType GetTransformCategory() const ITK_OVERRIDE;
246 
254  virtual const ParametersType & GetParameters() const ITK_OVERRIDE;
255 
256  /* SetParameters for all sub-transforms.
257  * See GetParameters() for parameter ordering. */
258  virtual void SetParameters(const ParametersType & p) ITK_OVERRIDE;
259 
260  /* GetFixedParameters for all sub-transforms.
261  * See GetParameters() for parameter ordering. */
262  virtual const FixedParametersType & GetFixedParameters() const ITK_OVERRIDE;
263 
264  /* SetFixedParameters for all sub-transforms.
265  * See GetParameters() for parameter ordering. */
266  virtual void SetFixedParameters(const FixedParametersType & fixedParameters) ITK_OVERRIDE;
267 
268  /* Get total number of parameters. Sum of all sub-transforms. */
269  virtual NumberOfParametersType GetNumberOfParameters() const ITK_OVERRIDE;
270 
271  /* Get total number of local parameters, the sum of all sub-transforms. */
272  virtual NumberOfParametersType GetNumberOfLocalParameters() const ITK_OVERRIDE;
273 
274  /* Get total number of fixed parameters, the sum of all sub-transforms. */
275  virtual NumberOfParametersType GetNumberOfFixedParameters() const ITK_OVERRIDE;
276 
279  virtual void UpdateTransformParameters( const DerivativeType & update, ScalarType factor = 1.0 ) ITK_OVERRIDE;
280 
286  bool GetInverse( Self *inverse ) const;
287 
289 //TODO - what do we need here?
290 // virtual void FlattenTransformQueue();
291 
292 protected:
293  MultiTransform();
294  virtual ~MultiTransform();
295  virtual void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE;
296 
298  {
299  this->m_TransformQueue.push_front( t );
300  this->Modified();
301  }
302 
304  {
305  this->m_TransformQueue.push_back( t );
306  this->Modified();
307  }
308 
309  virtual void PopFrontTransform()
310  {
311  this->m_TransformQueue.pop_front();
312  this->Modified();
313  }
314 
315  virtual void PopBackTransform()
316  {
317  this->m_TransformQueue.pop_back();
318  this->Modified();
319  }
320 
323 
327 
328 private:
329  MultiTransform( const Self & ); // purposely not implemented
330  void operator=( const Self & ); // purposely not implemented
331 
332 };
333 
334 } // end namespace itk
335 
336 #ifndef ITK_MANUAL_INSTANTIATION
337 #include "itkMultiTransform.hxx"
338 #endif
339 
340 #endif // itkMultiTransform_h
virtual void SetParameters(const ParametersType &p) override
SymmetricSecondRankTensor< TParametersValueType, NOutputDimensions > OutputSymmetricSecondRankTensorType
Definition: itkTransform.h:140
ModifiedTimeType m_LocalParametersUpdateTime
Superclass::OutputVectorType OutputVectorType
Light weight base class for most itk classes.
Superclass::JacobianType JacobianType
DiffusionTensor3D< TParametersValueType > OutputDiffusionTensor3DType
Definition: itkTransform.h:144
Superclass::InputPointType InputPointType
Point< TParametersValueType, NInputDimensions > InputPointType
Definition: itkTransform.h:157
virtual bool IsLinear() const override
virtual TransformType * GetNthTransformModifiablePointer(const SizeValueType n) const
IdentifierType NumberOfParametersType
virtual const FixedParametersType & GetFixedParameters() const override
TransformType::Pointer TransformTypePointer
virtual TransformCategoryType GetTransformCategory() const override
Superclass::ParametersValueType ParametersValueType
Superclass::OutputVnlVectorType OutputVnlVectorType
virtual bool IsTransformQueueEmpty() const
Superclass::FixedParametersType FixedParametersType
TParametersValueType ParametersValueType
unsigned long ModifiedTimeType
Definition: itkIntTypes.h:164
CovariantVector< TParametersValueType, NOutputDimensions > OutputCovariantVectorType
Definition: itkTransform.h:150
vnl_vector_fixed< TParametersValueType, NOutputDimensions > OutputVnlVectorType
Definition: itkTransform.h:154
VariableLengthVector< TParametersValueType > InputVectorPixelType
Definition: itkTransform.h:133
Point< TParametersValueType, NOutputDimensions > OutputPointType
Definition: itkTransform.h:158
virtual NumberOfParametersType GetNumberOfParameters() const override
virtual void PrependTransform(TransformType *t)
Superclass::OutputPointType OutputPointType
SmartPointer< Self > Pointer
Superclass::OutputSymmetricSecondRankTensorType OutputSymmetricSecondRankTensorType
VariableLengthVector< TParametersValueType > OutputVectorPixelType
Definition: itkTransform.h:134
Superclass::FixedParametersValueType FixedParametersValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:143
virtual void PushFrontTransform(TransformTypePointer t)
Superclass::OutputVectorPixelType OutputVectorPixelType
virtual void SetFixedParameters(const FixedParametersType &fixedParameters) override
Superclass::InputCovariantVectorType InputCovariantVectorType
Superclass::InputSymmetricSecondRankTensorType InputSymmetricSecondRankTensorType
SymmetricSecondRankTensor< TParametersValueType, NInputDimensions > InputSymmetricSecondRankTensorType
Definition: itkTransform.h:138
virtual void RemoveTransform()
virtual const TransformQueueType & GetTransformQueue() const
void operator=(const Self &)
virtual const TransformType * GetBackTransform() const
Superclass::InverseTransformBasePointer InverseTransformBasePointer
virtual const ParametersType & GetParameters() const override
static const unsigned int SubInputDimension
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
static const unsigned int InputDimension
Transform< TParametersValueType, NDimensions, NSubDimensions > Superclass
ParametersValueType ScalarType
virtual void ClearTransformQueue()
DiffusionTensor3D< TParametersValueType > InputDiffusionTensor3DType
Definition: itkTransform.h:143
TransformQueueType m_TransformQueue
Superclass::InputVectorType InputVectorType
virtual const TransformType * GetNthTransformConstPointer(const SizeValueType n) const
Superclass::InputVectorPixelType InputVectorPixelType
virtual void AppendTransform(TransformType *t)
Superclass::InputDiffusionTensor3DType InputDiffusionTensor3DType
virtual const TransformTypePointer GetNthTransform(SizeValueType n) const
virtual NumberOfParametersType GetNumberOfFixedParameters() const override
Superclass::InputVnlVectorType InputVnlVectorType
Superclass::DerivativeType DerivativeType
vnl_vector_fixed< TParametersValueType, NInputDimensions > InputVnlVectorType
Definition: itkTransform.h:153
virtual void Modified() const
virtual const TransformType * GetFrontTransform() const
NumberOfParametersType m_NumberOfLocalParameters
Superclass::ParametersType ParametersType
This abstract class contains a list of transforms and provides basic methods.
static const unsigned int SubOutputDimension
Superclass::TransformCategoryType TransformCategoryType
Vector< TParametersValueType, NInputDimensions > InputVectorType
Definition: itkTransform.h:128
virtual NumberOfParametersType GetNumberOfLocalParameters() const override
virtual void UpdateTransformParameters(const DerivativeType &update, ScalarType factor=1.0) override
Transform< TParametersValueType, NSubDimensions, NSubDimensions > TransformType
Superclass::OutputDiffusionTensor3DType OutputDiffusionTensor3DType
virtual SizeValueType GetNumberOfTransforms() const
Control indentation during Print() invocation.
Definition: itkIndent.h:49
SmartPointer< const Self > ConstPointer
static const unsigned int OutputDimension
Vector< TParametersValueType, NOutputDimensions > OutputVectorType
Definition: itkTransform.h:129
virtual void PopFrontTransform()
Superclass::OutputCovariantVectorType OutputCovariantVectorType
std::deque< TransformTypePointer > TransformQueueType
Superclass::NumberOfParametersType NumberOfParametersType
virtual void AddTransform(TransformType *t)
CovariantVector< TParametersValueType, NInputDimensions > InputCovariantVectorType
Definition: itkTransform.h:148
TransformType::InverseTransformBasePointer SubTransformInverseTransformBasePointer
bool GetInverse(Self *inverse) const
virtual void PrintSelf(std::ostream &os, Indent indent) const override
virtual void PushBackTransform(TransformTypePointer t)
virtual void PopBackTransform()