ITK  4.6.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 <class TScalar = double, unsigned int NDimensions = 3, unsigned int NSubDimensions = NDimensions>
65  public Transform<TScalar, NDimensions, NDimensions>
66 {
67 public:
73 
75  itkTypeMacro( MultiTransform, Transform );
76 
80 
81  /* Types common to both container and sub transforms */
82 
85 
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;
242 
246 
254  virtual const ParametersType & GetParameters(void) const;
255 
256  /* SetParameters for all sub-transforms.
257  * See GetParameters() for parameter ordering. */
258  virtual void SetParameters(const ParametersType & p);
259 
260  /* GetFixedParameters for all sub-transforms.
261  * See GetParameters() for parameter ordering. */
262  virtual const ParametersType & GetFixedParameters(void) const;
263 
264  /* SetFixedParameters for all sub-transforms.
265  * See GetParameters() for parameter ordering. */
266  virtual void SetFixedParameters(const ParametersType & fixedParameters);
267 
268  /* Get total number of parameters. Sum of all sub-transforms. */
269  virtual NumberOfParametersType GetNumberOfParameters(void) const;
270 
271  /* Get total number of local parameters, the sum of all sub-transforms. */
273 
274  /* Get total number of fixed parameters, the sum of all sub-transforms. */
276 
279  virtual void UpdateTransformParameters( const DerivativeType & update, ScalarType factor = 1.0 );
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  void PrintSelf( std::ostream& os, Indent indent ) const;
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
static const unsigned int SubInputDimension
Superclass::NumberOfParametersType NumberOfParametersType
Definition: itkTransform.h:183
TransformQueueType m_TransformQueue
Superclass::TransformCategoryType TransformCategoryType
DiffusionTensor3D< TScalar > OutputDiffusionTensor3DType
Definition: itkTransform.h:142
virtual NumberOfParametersType GetNumberOfFixedParameters(void) const
Vector< TScalar, NInputDimensions > InputVectorType
Definition: itkTransform.h:126
virtual const ParametersType & GetParameters(void) const
vnl_vector_fixed< TScalar, NInputDimensions > InputVnlVectorType
Definition: itkTransform.h:151
Superclass::ParametersValueType ParametersValueType
Light weight base class for most itk classes.
virtual void RemoveTransform()
Superclass::InputPointType InputPointType
Vector< TScalar, NOutputDimensions > OutputVectorType
Definition: itkTransform.h:127
InverseTransformBaseType::Pointer InverseTransformBasePointer
Definition: itkTransform.h:164
SymmetricSecondRankTensor< TScalar, NOutputDimensions > OutputSymmetricSecondRankTensorType
Definition: itkTransform.h:138
virtual void AddTransform(TransformType *t)
Superclass::OutputVectorType OutputVectorType
virtual bool IsLinear() const
Superclass::InputVnlVectorType InputVnlVectorType
unsigned long ModifiedTimeType
Definition: itkIntTypes.h:164
void operator=(const Self &)
Superclass::JacobianType JacobianType
virtual const TransformQueueType & GetTransformQueue() const
static const unsigned int SubOutputDimension
virtual NumberOfParametersType GetNumberOfParameters(void) const
Point< TScalar, NInputDimensions > InputPointType
Definition: itkTransform.h:155
virtual void PushBackTransform(TransformTypePointer t)
Superclass::InputVectorType InputVectorType
void PrintSelf(std::ostream &os, Indent indent) const
virtual void PopFrontTransform()
virtual void ClearTransformQueue()
virtual const TransformType * GetFrontTransform() const
unsigned long SizeValueType
Definition: itkIntTypes.h:143
virtual const ParametersType & GetFixedParameters(void) const
VariableLengthVector< TScalar > InputVectorPixelType
Definition: itkTransform.h:131
virtual void PopBackTransform()
Superclass::InputSymmetricSecondRankTensorType InputSymmetricSecondRankTensorType
SmartPointer< Self > Pointer
virtual void UpdateTransformParameters(const DerivativeType &update, ScalarType factor=1.0)
virtual void AppendTransform(TransformType *t)
VariableLengthVector< TScalar > OutputVectorPixelType
Definition: itkTransform.h:132
DiffusionTensor3D< TScalar > InputDiffusionTensor3DType
Definition: itkTransform.h:141
Superclass::OutputVectorPixelType OutputVectorPixelType
bool GetInverse(Self *inverse) const
virtual void SetFixedParameters(const ParametersType &fixedParameters)
CovariantVector< TScalar, NOutputDimensions > OutputCovariantVectorType
Definition: itkTransform.h:148
Superclass::InputDiffusionTensor3DType InputDiffusionTensor3DType
CovariantVector< TScalar, NInputDimensions > InputCovariantVectorType
Definition: itkTransform.h:146
virtual void PushFrontTransform(TransformTypePointer t)
IdentifierType NumberOfParametersType
NumberOfParametersType m_NumberOfLocalParameters
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
Superclass::ParametersValueType ParametersValueType
Definition: itkTransform.h:119
Superclass::InverseTransformBasePointer InverseTransformBasePointer
SymmetricSecondRankTensor< TScalar, NInputDimensions > InputSymmetricSecondRankTensorType
Definition: itkTransform.h:136
virtual TransformType * GetNthTransformModifiablePointer(const SizeValueType n) const
virtual NumberOfParametersType GetNumberOfLocalParameters(void) const
Superclass::ScalarType ScalarType
Superclass::OutputCovariantVectorType OutputCovariantVectorType
std::deque< TransformTypePointer > TransformQueueType
virtual bool IsTransformQueueEmpty() const
virtual void Modified() const
virtual const TransformType * GetBackTransform() const
virtual void PrependTransform(TransformType *t)
This abstract class contains a list of transforms and provides basic methods.
Superclass::OutputDiffusionTensor3DType OutputDiffusionTensor3DType
Superclass::OutputVnlVectorType OutputVnlVectorType
Superclass::InputVectorPixelType InputVectorPixelType
Point< TScalar, NOutputDimensions > OutputPointType
Definition: itkTransform.h:156
Superclass::NumberOfParametersType NumberOfParametersType
Superclass::OutputPointType OutputPointType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual TransformCategoryType GetTransformCategory() const
Transform< TScalar, NDimensions, NDimensions > Superclass
virtual const TransformTypePointer GetNthTransform(SizeValueType n) const
Superclass::TransformCategoryType TransformCategoryType
Definition: itkTransform.h:431
virtual ~MultiTransform()
virtual void SetParameters(const ParametersType &p)
vnl_vector_fixed< TScalar, NOutputDimensions > OutputVnlVectorType
Definition: itkTransform.h:152
virtual const TransformType * GetNthTransformConstPointer(const SizeValueType n) const
SmartPointer< const Self > ConstPointer
Transform< TScalar, NSubDimensions, NSubDimensions > TransformType
Superclass::DerivativeType DerivativeType
ModifiedTimeType m_LocalParametersUpdateTime
Superclass::InputCovariantVectorType InputCovariantVectorType
static const unsigned int OutputDimension
virtual SizeValueType GetNumberOfTransforms() const
static const unsigned int InputDimension
Superclass::OutputSymmetricSecondRankTensorType OutputSymmetricSecondRankTensorType
TransformType::Pointer TransformTypePointer
Superclass::ParametersType ParametersType
TransformType::InverseTransformBasePointer SubTransformInverseTransformBasePointer