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 #ifndef __itkStackTransform_h
15 #define __itkStackTransform_h
16 
17 #include "itkAdvancedTransform.h"
18 #include "itkIndex.h"
19 
20 namespace itk
21 {
22 
33 template< class TScalarType,
34 unsigned int NInputDimensions = 3,
35 unsigned int NOutputDimensions = 3 >
37  public AdvancedTransform< TScalarType, NInputDimensions, NOutputDimensions >
38 {
39 public:
40 
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
74  typedef typename
86  typedef typename Superclass::OutputVectorPixelType OutputVectorPixelType;
87  typedef typename Superclass::InputVectorPixelType InputVectorPixelType;
88 
90  typedef AdvancedTransform< TScalarType,
91  itkGetStaticConstMacro( ReducedInputSpaceDimension ),
92  itkGetStaticConstMacro( ReducedOutputSpaceDimension ) > SubTransformType;
94  typedef std::vector< SubTransformPointer > SubTransformContainerType;
96 
100 
102  typedef typename ParametersType::ArrayType ParametersArrayType;
103 
105  virtual OutputPointType TransformPoint( const InputPointType & ipp ) const;
106 
109  {
110  itkExceptionMacro(
111  << "TransformVector(const InputVectorType &) is not implemented "
112  << "for StackTransform" );
113  }
114 
115 
117  {
118  itkExceptionMacro(
119  << "TransformVector(const InputVnlVectorType &) is not implemented "
120  << "for StackTransform" );
121  }
122 
123 
125  {
126  itkExceptionMacro(
127  << "TransformCovariantVector(const InputCovariantVectorType &) is not implemented "
128  << "for StackTransform" );
129  }
130 
131 
137  virtual void GetJacobian(
138  const InputPointType & ipp,
139  JacobianType & jac,
140  NonZeroJacobianIndicesType & nzji ) const;
141 
144  virtual void SetParameters( const ParametersType & param );
145 
148  virtual const ParametersType & GetParameters( void ) const;
149 
151  virtual void SetFixedParameters( const ParametersType & )
152  {
153  // \todo: to be implemented by Coert
154  }
155 
156 
158  virtual const ParametersType & GetFixedParameters( void ) const
159  {
160  // \todo: to be implemented by Coert: check this:
161  return this->m_FixedParameters;
162  }
163 
164 
167  {
168  if( this->m_SubTransformContainer.size() == 0 )
169  {
170  return 0;
171  }
172  else
173  {
174  return this->m_SubTransformContainer.size() * m_SubTransformContainer[ 0 ]->GetNumberOfParameters();
175  }
176  }
177 
178 
180  virtual void SetNumberOfSubTransforms( const unsigned int num )
181  {
182  if( this->m_NumberOfSubTransforms != num )
183  {
184  this->m_NumberOfSubTransforms = num;
185  this->m_SubTransformContainer.clear();
186  this->m_SubTransformContainer.resize( num );
187  this->Modified();
188  }
189  }
190 
191 
192  itkGetMacro( NumberOfSubTransforms, unsigned int );
193 
195  itkSetMacro( StackSpacing, TScalarType );
196  itkGetConstMacro( StackSpacing, TScalarType );
197  itkSetMacro( StackOrigin, TScalarType );
198  itkGetConstMacro( StackOrigin, TScalarType );
199 
201  virtual void SetSubTransform( unsigned int i, SubTransformType * transform )
202  {
203  this->m_SubTransformContainer[ i ] = transform;
204  this->Modified();
205  }
206 
207 
209  virtual void SetAllSubTransforms( SubTransformType * transform )
210  {
211  for( unsigned int t = 0; t < this->m_NumberOfSubTransforms; ++t )
212  {
213  // Copy transform
214  SubTransformPointer transformcopy = dynamic_cast< SubTransformType * >( transform->CreateAnother().GetPointer() );
215  transformcopy->SetFixedParameters( transform->GetFixedParameters() );
216  transformcopy->SetParameters( transform->GetParameters() );
217  // Set sub transform
218  this->m_SubTransformContainer[ t ] = transformcopy;
219  }
220  }
221 
222 
224  virtual SubTransformPointer GetSubTransform( unsigned int i )
225  {
226  return this->m_SubTransformContainer[ i ];
227  }
228 
229 
232 
234  virtual void GetSpatialJacobian(
235  const InputPointType & ipp, SpatialJacobianType & sj ) const
236  {
237  itkExceptionMacro( << "Not implemented for StackTransform" );
238  }
239 
240 
241  virtual void GetSpatialHessian(
242  const InputPointType & ipp, SpatialHessianType & sh ) const
243  {
244  itkExceptionMacro( << "Not implemented for StackTransform" );
245  }
246 
247 
250  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
251  {
252  itkExceptionMacro( << "Not implemented for StackTransform" );
253  }
254 
255 
257  const InputPointType & ipp, SpatialJacobianType & sj,
259  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
260  {
261  itkExceptionMacro( << "Not implemented for StackTransform" );
262  }
263 
264 
266  const InputPointType & ipp, JacobianOfSpatialHessianType & jsh,
267  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
268  {
269  itkExceptionMacro( << "Not implemented for StackTransform" );
270  }
271 
272 
274  const InputPointType & ipp, SpatialHessianType & sh,
276  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
277  {
278  itkExceptionMacro( << "Not implemented for StackTransform" );
279  }
280 
281 
282 protected:
283 
284  StackTransform();
285  virtual ~StackTransform() {}
286 
287 private:
288 
289  StackTransform( const Self & ); // purposely not implemented
290  void operator=( const Self & ); // purposely not implemented
291 
292  // Number of transforms and transform container
295 
296  // Stack spacing and origin of last dimension
298 
299 };
300 
301 } // end namespace itk
302 
303 #ifndef ITK_MANUAL_INSTANTIATION
304 #include "itkStackTransform.hxx"
305 #endif
306 
307 #endif
virtual NumberOfParametersType GetNumberOfParameters(void) const
Superclass::InputVectorPixelType InputVectorPixelType
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 NumberOfParametersType GetNumberOfNonZeroJacobianIndices(void) const
virtual void GetSpatialHessian(const InputPointType &ipp, SpatialHessianType &sh) 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::OutputVectorPixelType OutputVectorPixelType
Superclass::JacobianOfSpatialHessianType JacobianOfSpatialHessianType
virtual const ParametersType & GetParameters(void) const
Superclass::OutputCovariantVectorType OutputCovariantVectorType
Superclass::ParametersValueType ParametersValueType
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
Superclass::ParametersValueType ParametersValueType
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 11-03-2014 for elastix by doxygen 1.8.6 elastix logo