go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkStackTransform.h
Go to the documentation of this file.
1 /*======================================================================
2 
3 This file is part of the elastix software.
4 
5 Copyright (c) University Medical Center Utrecht. All rights reserved.
6 See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
7 details.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notices for more information.
12 
13 ======================================================================*/
14 
15 #ifndef __itkStackTransform_h
16 #define __itkStackTransform_h
17 
18 #include "itkAdvancedTransform.h"
19 #include "itkIndex.h"
20 
21 namespace itk
22 {
23 
34 template <class TScalarType,
35  unsigned int NInputDimensions = 3,
36  unsigned int NOutputDimensions = 3>
38  : public AdvancedTransform< TScalarType, NInputDimensions, NOutputDimensions >
39 {
40 public:
43  typedef AdvancedTransform< TScalarType,
44  NInputDimensions,
45  NOutputDimensions > Superclass;
46  typedef SmartPointer< Self > Pointer;
47  typedef SmartPointer< const Self > ConstPointer;
48 
50  itkNewMacro( Self );
51 
53  itkTypeMacro( StackTransform, AdvancedTransform );
54 
56  itkStaticConstMacro( InputSpaceDimension, unsigned int, NInputDimensions );
57  itkStaticConstMacro( OutputSpaceDimension, unsigned int, NOutputDimensions );
58  itkStaticConstMacro( ReducedInputSpaceDimension, unsigned int, NInputDimensions - 1 );
59  itkStaticConstMacro( ReducedOutputSpaceDimension, unsigned int, NOutputDimensions - 1 );
60 
64  typedef typename Superclass::NumberOfParametersType
83  typedef typename
85 
87  typedef AdvancedTransform< TScalarType,
88  itkGetStaticConstMacro( ReducedInputSpaceDimension ),
89  itkGetStaticConstMacro( ReducedOutputSpaceDimension ) > SubTransformType;
91  typedef std::vector< SubTransformPointer > SubTransformContainerType;
93 
97 
99  typedef typename ParametersType::ArrayType ParametersArrayType;
100 
102  virtual OutputPointType TransformPoint( const InputPointType & ipp ) const;
103 
106  {
107  itkExceptionMacro(
108  << "TransformVector(const InputVectorType &) is not implemented "
109  << "for StackTransform" );
110  }
112  {
113  itkExceptionMacro(
114  << "TransformVector(const InputVnlVectorType &) is not implemented "
115  << "for StackTransform" );
116  }
118  {
119  itkExceptionMacro(
120  << "TransformCovariantVector(const InputCovariantVectorType &) is not implemented "
121  << "for StackTransform" );
122  }
123 
129  virtual void GetJacobian(
130  const InputPointType & ipp,
131  JacobianType & jac,
132  NonZeroJacobianIndicesType & nzji ) const;
133 
136  virtual void SetParameters( const ParametersType & param );
137 
140  virtual const ParametersType & GetParameters ( void ) const;
141 
143  virtual void SetFixedParameters( const ParametersType & )
144  {
145  // \todo: to be implemented by Coert
146  }
147 
149  virtual const ParametersType & GetFixedParameters( void ) const
150  {
151  // \todo: to be implemented by Coert: check this:
152  return this->m_FixedParameters;
153  }
154 
157  {
158  if ( this->m_SubTransformContainer.size() == 0 )
159  {
160  return 0;
161  }
162  else
163  {
164  return this->m_SubTransformContainer.size() * m_SubTransformContainer[ 0 ]->GetNumberOfParameters();
165  }
166  }
167 
169  virtual void SetNumberOfSubTransforms( const unsigned int num )
170  {
171  if ( this->m_NumberOfSubTransforms != num )
172  {
173  this->m_NumberOfSubTransforms = num;
174  this->m_SubTransformContainer.clear();
175  this->m_SubTransformContainer.resize( num );
176  this->Modified();
177  }
178  }
179  itkGetMacro( NumberOfSubTransforms, unsigned int );
180 
182  itkSetMacro( StackSpacing, TScalarType );
183  itkGetConstMacro( StackSpacing, TScalarType );
184  itkSetMacro( StackOrigin, TScalarType );
185  itkGetConstMacro( StackOrigin, TScalarType );
186 
188  virtual void SetSubTransform( unsigned int i, SubTransformType * transform )
189  {
190  this->m_SubTransformContainer[ i ] = transform;
191  this->Modified();
192  }
193 
195  virtual void SetAllSubTransforms( SubTransformType * transform ) {
196  for ( unsigned int t = 0; t < this->m_NumberOfSubTransforms; ++t )
197  {
198  // Copy transform
199  SubTransformPointer transformcopy = dynamic_cast< SubTransformType * >( transform->CreateAnother().GetPointer() );
200  transformcopy->SetFixedParameters( transform->GetFixedParameters() );
201  transformcopy->SetParameters( transform->GetParameters() );
202  // Set sub transform
203  this->m_SubTransformContainer[ t ] = transformcopy;
204  }
205  }
206 
208  virtual SubTransformPointer GetSubTransform( unsigned int i )
209  {
210  return this->m_SubTransformContainer[ i ];
211  }
212 
214  virtual unsigned long GetNumberOfNonZeroJacobianIndices( void ) const;
215 
217  virtual void GetSpatialJacobian(
218  const InputPointType & ipp, SpatialJacobianType & sj ) const
219  {
220  itkExceptionMacro( << "Not implemented for StackTransform" );
221  }
222  virtual void GetSpatialHessian(
223  const InputPointType & ipp, SpatialHessianType & sh ) const
224  {
225  itkExceptionMacro( << "Not implemented for StackTransform" );
226  }
229  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
230  {
231  itkExceptionMacro( << "Not implemented for StackTransform" );
232  }
234  const InputPointType & ipp, SpatialJacobianType & sj,
236  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
237  {
238  itkExceptionMacro( << "Not implemented for StackTransform" );
239  }
241  const InputPointType & ipp, JacobianOfSpatialHessianType & jsh,
242  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
243  {
244  itkExceptionMacro( << "Not implemented for StackTransform" );
245  }
247  const InputPointType & ipp, SpatialHessianType & sh,
249  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
250  {
251  itkExceptionMacro( << "Not implemented for StackTransform" );
252  }
253 
254 protected:
255  StackTransform();
256  virtual ~StackTransform() {};
257 
258 private:
259 
260  StackTransform(const Self&); // purposely not implemented
261  void operator=(const Self&); // purposely not implemented
262 
263  // Number of transforms and transform container
266 
267  // Stack spacing and origin of last dimension
269 
270 }; // end class StackTransform
271 
272 } // end namespace itk
273 
274 // \todo: copied the below from itk. does this just work like this?:
275 
276 // Define instantiation macro for this template.
277 #define ITK_TEMPLATE_StackTransform(_, EXPORT, x, y) namespace itk { \
278  _(3(class EXPORT StackTransform< ITK_TEMPLATE_3 x >)) \
279  namespace Templates { typedef StackTransform< ITK_TEMPLATE_3 x > StackTransform##y; } \
280  }
281 
282 #if ITK_TEMPLATE_EXPLICIT
283 # include "Templates/itkStackTransform+-.h"
284 #endif
285 
286 #if ITK_TEMPLATE_TXX
287 # include "itkStackTransform.txx"
288 #endif
289 
290 #endif
virtual NumberOfParametersType GetNumberOfParameters(void) const
Matrix< ScalarType, OutputSpaceDimension, InputSpaceDimension > SpatialJacobianType
virtual void SetAllSubTransforms(SubTransformType *transform)
Superclass::JacobianOfSpatialJacobianType JacobianOfSpatialJacobianType
Superclass::InputVnlVectorType InputVnlVectorType
Superclass::OutputPointType OutputPointType
ParametersType::ArrayType ParametersArrayType
virtual OutputVectorType TransformVector(const InputVectorType &) const
Superclass::JacobianType JacobianType
std::vector< unsigned long > NonZeroJacobianIndicesType
virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
SmartPointer< Self > Pointer
virtual SubTransformPointer GetSubTransform(unsigned int i)
Superclass::InputVectorType InputVectorType
std::vector< SubTransformPointer > SubTransformContainerType
Superclass::ScalarType ScalarType
Superclass::SpatialHessianType SpatialHessianType
unsigned int m_NumberOfSubTransforms
SubTransformType::InputPointType SubTransformInputPointType
SmartPointer< const Self > ConstPointer
Superclass::OutputCovariantVectorType OutputCovariantVectorType
virtual void GetSpatialHessian(const InputPointType &ipp, SpatialHessianType &sh) const
virtual unsigned long GetNumberOfNonZeroJacobianIndices(void) const
Implements stack of transforms: one for every last dimension index.
SubTransformType::OutputPointType SubTransformOutputPointType
virtual const ParametersType & GetFixedParameters(void) const
virtual void GetJacobian(const InputPointType &ipp, JacobianType &jac, NonZeroJacobianIndicesType &nzji) const
void operator=(const Self &)
Superclass::OutputVnlVectorType OutputVnlVectorType
virtual void SetNumberOfSubTransforms(const unsigned int num)
SmartPointer< Self > Pointer
Superclass::OutputVnlVectorType OutputVnlVectorType
virtual void GetJacobianOfSpatialHessian(const InputPointType &ipp, SpatialHessianType &sh, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const
virtual void GetJacobianOfSpatialJacobian(const InputPointType &ipp, JacobianOfSpatialJacobianType &jsj, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const
Superclass::ParametersType ParametersType
Superclass::ParametersType ParametersType
Transform maps points, vectors and covariant vectors from an input space to an output space...
virtual void GetSpatialJacobian(const InputPointType &ipp, SpatialJacobianType &sj) const
virtual OutputPointType TransformPoint(const InputPointType &ipp) const
virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const
Superclass::InputVnlVectorType InputVnlVectorType
Superclass::JacobianOfSpatialHessianType JacobianOfSpatialHessianType
virtual const ParametersType & GetParameters(void) const
Superclass::OutputCovariantVectorType OutputCovariantVectorType
Superclass::OutputVectorType OutputVectorType
Superclass::NumberOfParametersType NumberOfParametersType
Superclass::JacobianType JacobianType
SubTransformType::JacobianType SubTransformJacobianType
Superclass::InputPointType InputPointType
Superclass::OutputVectorType OutputVectorType
Superclass::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
Superclass::InputCovariantVectorType InputCovariantVectorType
Superclass::InputPointType InputPointType
virtual void SetParameters(const ParametersType &param)
virtual void GetJacobianOfSpatialJacobian(const InputPointType &ipp, SpatialJacobianType &sj, JacobianOfSpatialJacobianType &jsj, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const
Superclass::InputVectorType InputVectorType
AdvancedTransform< TScalarType, itkGetStaticConstMacro(ReducedInputSpaceDimension), itkGetStaticConstMacro(ReducedOutputSpaceDimension) > SubTransformType
virtual void GetJacobianOfSpatialHessian(const InputPointType &ipp, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const
virtual void SetSubTransform(unsigned int i, SubTransformType *transform)
Superclass::NumberOfParametersType NumberOfParametersType
Superclass::OutputPointType OutputPointType
SubTransformType::Pointer SubTransformPointer
std::vector< SpatialJacobianType > JacobianOfSpatialJacobianType
std::vector< SpatialHessianType > JacobianOfSpatialHessianType
virtual void SetFixedParameters(const ParametersType &)
AdvancedTransform< TScalarType, NInputDimensions, NOutputDimensions > Superclass
Superclass::InputCovariantVectorType InputCovariantVectorType
FixedArray< Matrix< ScalarType, InputSpaceDimension, InputSpaceDimension >, OutputSpaceDimension > SpatialHessianType
Superclass::SpatialJacobianType SpatialJacobianType
itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions)
Superclass::ScalarType ScalarType
SubTransformContainerType m_SubTransformContainer


Generated on 04-01-2014 for elastix by doxygen 1.8.5 elastix logo