go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkMultiBSplineDeformableTransformWithNormal.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 __itkMultiBSplineDeformableTransformWithNormal_h
15 #define __itkMultiBSplineDeformableTransformWithNormal_h
16 
18 #include "itkNearestNeighborInterpolateImageFunction.h"
19 
20 namespace itk
21 {
34 template<
35 class TScalarType = double, // Data type for scalars
36 unsigned int NDimensions = 3, // Number of dimensions
37 unsigned int VSplineOrder = 3 >
38 // Spline order
39 class MultiBSplineDeformableTransformWithNormal :
40  public AdvancedTransform< TScalarType, NDimensions, NDimensions >
41 {
42 public:
43 
46  typedef AdvancedTransform<
47  TScalarType, NDimensions, NDimensions > Superclass;
48  typedef SmartPointer< Self > Pointer;
49  typedef SmartPointer< const Self > ConstPointer;
50 
52  itkNewMacro( Self );
53 
56 
58  itkStaticConstMacro( SpaceDimension, unsigned int, NDimensions );
59 
61  itkStaticConstMacro( SplineOrder, unsigned int, VSplineOrder );
62 
78 
79  typedef typename Superclass
82  typedef typename Superclass
85  typedef typename Superclass
88 
91  itkGetStaticConstMacro( SpaceDimension ),
92  itkGetStaticConstMacro( SplineOrder ) > WeightsFunctionType;
94 
113  void SetParameters( const ParametersType & parameters );
114 
130  void SetFixedParameters( const ParametersType & parameters );
131 
148  void SetParametersByValue( const ParametersType & parameters );
149 
158  void SetIdentity( void );
159 
161  virtual const ParametersType & GetParameters( void ) const;
162 
164  virtual const ParametersType & GetFixedParameters( void ) const;
165 
167  typedef typename ParametersType::ValueType PixelType;
168  typedef Image< PixelType,
169  itkGetStaticConstMacro( SpaceDimension ) > ImageType;
170  typedef typename ImageType::Pointer ImagePointer;
171 
173  //virtual ImagePointer * GetCoefficientImage( void )
174  // { return this->m_CoefficientImage; }
175  //virtual const ImagePointer * GetCoefficientImage( void ) const
176  // { return this->m_CoefficientImage; }
177 
189  // virtual void SetCoefficientImage( ImagePointer images[] );
190 
192  typedef ImageRegion< itkGetStaticConstMacro( SpaceDimension ) > RegionType;
193 
194  typedef typename RegionType::IndexType IndexType;
195  typedef typename RegionType::SizeType SizeType;
196  typedef typename ImageType::SpacingType SpacingType;
197  typedef typename ImageType::DirectionType DirectionType;
198  typedef typename ImageType::PointType OriginType;
200 
202  virtual void SetGridRegion( const RegionType & region );
203 
204  virtual RegionType GetGridRegion( void ) const;
205 
207  virtual void SetGridSpacing( const SpacingType & spacing );
208 
209  virtual SpacingType GetGridSpacing( void ) const;
210 
212  virtual void SetGridDirection( const DirectionType & spacing );
213 
214  virtual DirectionType GetGridDirection( void ) const;
215 
217  virtual void SetGridOrigin( const OriginType & origin );
218 
219  virtual OriginType GetGridOrigin( void ) const;
220 
222  typedef Image< unsigned char,
223  itkGetStaticConstMacro( SpaceDimension ) > ImageLabelType;
224  typedef typename ImageLabelType::Pointer ImageLabelPointer;
225 
226  typedef itk::NearestNeighborInterpolateImageFunction<
228  typedef typename ImageLabelInterpolator::Pointer ImageLabelInterpolatorPointer;
229 
231  typedef Vector< TScalarType, itkGetStaticConstMacro( SpaceDimension ) > VectorType;
232  typedef Vector< VectorType, itkGetStaticConstMacro( SpaceDimension ) > BaseType;
233  typedef Image< VectorType, itkGetStaticConstMacro( SpaceDimension ) > ImageVectorType;
234  typedef typename ImageVectorType::Pointer ImageVectorPointer;
235  typedef Image< BaseType, itkGetStaticConstMacro( SpaceDimension ) > ImageBaseType;
236  typedef typename ImageBaseType::Pointer ImageBasePointer;
237 
239  void SetLabels( ImageLabelType * labels );
240 
241  itkGetMacro( Labels, ImageLabelType * );
242 
243  itkGetConstMacro( NbLabels, unsigned char );
244 
246  void UpdateLocalBases( void );
247 
248  itkGetMacro( LocalBases, ImageBaseType * );
249 
251  typedef Array< unsigned long > ParameterIndexArrayType;
252 
257  {
258  itkExceptionMacro( << "Method not applicable for deformable transform." );
259  return OutputVectorType();
260  }
261 
262 
267  {
268  itkExceptionMacro( << "Method not applicable for deformable transform. " );
269  return OutputVnlVectorType();
270  }
271 
272 
277  const InputCovariantVectorType & ) const
278  {
279  itkExceptionMacro( << "Method not applicable for deformable transform. " );
280  return OutputCovariantVectorType();
281  }
282 
283 
285  virtual NumberOfParametersType GetNumberOfParameters( void ) const;
286 
289 
291  virtual const RegionType & GetValidRegion( void )
292  {
293  return m_Trans[ 0 ]->GetValidRegion();
294  }
295 
296 
302  virtual bool IsLinear( void ) const { return false; }
303 
305  virtual unsigned long GetNumberOfWeights( void ) const
306  {
307  return m_Trans[ 0 ]->m_WeightsFunction->GetNumberOfWeights();
308  }
309 
310 
311  virtual unsigned int GetNumberOfAffectedWeights( void ) const
312  {
313  return m_Trans[ 0 ]->m_WeightsFunction->GetNumberOfWeights();
314  }
315 
316 
318  {
319  return m_Trans[ 0 ]->m_WeightsFunction->GetNumberOfWeights() * SpaceDimension;
320  }
321 
322 
324  virtual bool GetHasNonZeroSpatialJacobian( void ) const
325  {
326  return true;
327  }
328 
329 
330  virtual bool HasNonZeroJacobianOfSpatialJacobian( void ) const
331  {
332  return true;
333  }
334 
335 
336  virtual bool GetHasNonZeroSpatialHessian( void ) const
337  {
338  return true;
339  }
340 
341 
342  virtual bool HasNonZeroJacobianOfSpatialHessian( void ) const
343  {
344  return true;
345  }
346 
347 
349  typedef ContinuousIndex< ScalarType, SpaceDimension > ContinuousIndexType;
350 
352  OutputPointType TransformPoint( const InputPointType & point ) const;
353 
355  //virtual const JacobianType & GetJacobian( const InputPointType & point ) const;
356 
358  virtual void GetJacobian(
359  const InputPointType & ipp,
360  JacobianType & j,
361  NonZeroJacobianIndicesType & ) const;
362 
364  virtual void GetSpatialJacobian(
365  const InputPointType & ipp,
366  SpatialJacobianType & sj ) const;
367 
368  virtual void GetJacobianOfSpatialJacobian(
369  const InputPointType & ipp,
371  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
372 
373  virtual void GetJacobianOfSpatialJacobian(
374  const InputPointType &,
377  NonZeroJacobianIndicesType & ) const;
378 
380  virtual void GetSpatialHessian(
381  const InputPointType & ipp,
382  SpatialHessianType & sh ) const;
383 
385  const InputPointType & ipp,
387  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
388  {
389  itkExceptionMacro( << "ERROR: GetJacobianOfSpatialHessian() not yet implemented "
390  << "in the MultiBSplineDeformableTransformWithNormal class." );
391  }
392 
393 
394  virtual void GetJacobianOfSpatialHessian(
395  const InputPointType &,
398  NonZeroJacobianIndicesType & ) const;
399 
400 protected:
401 
403  virtual void PrintSelf( std::ostream & os, Indent indent ) const;
404 
407 
409  // void WrapAsImages( void );
410 
412  /*
413  void TransformPointToContinuousGridIndex(
414  const InputPointType & point, ContinuousIndexType & index ) const;
415 
416  virtual void ComputeNonZeroJacobianIndices(
417  NonZeroJacobianIndicesType & nonZeroJacobianIndices,
418  const RegionType & supportRegion ) const;
419  */
420 
422  //virtual bool InsideValidRegion( const ContinuousIndexType& index ) const;
423 
425  // BulkTransformPointer m_BulkTransform;
426 
429  // ImagePointer m_CoefficientImage[ NDimensions ];
430 
432  // RegionType m_GridRegion;
433  // SpacingType m_GridSpacing;
434  // DirectionType m_GridDirection;
435  // OriginType m_GridOrigin;
436  // GridOffsetType m_GridOffsetTable;
437 
438  // DirectionType m_PointToIndexMatrix;
439  // SpatialJacobianType m_PointToIndexMatrix2;
440  // DirectionType m_PointToIndexMatrixTransposed;
441  // SpatialJacobianType m_PointToIndexMatrixTransposed2;
442  // DirectionType m_IndexToPoint;
443 
444  // RegionType m_ValidRegion;
445 
447  // unsigned long m_Offset;
448  // SizeType m_SupportSize;
449  // ContinuousIndexType m_ValidRegionBegin;
450  // ContinuousIndexType m_ValidRegionEnd;
451 
453  // bool m_SplineOrderOdd;
454 
457 
459  /*
460  typedef typename JacobianType::ValueType JacobianPixelType;
461  typedef Image< JacobianPixelType,
462  itkGetStaticConstMacro( SpaceDimension ) > JacobianImageType;
463 
464  typename JacobianImageType::Pointer m_JacobianImage[ NDimensions ];
465  */
466 
470  // mutable IndexType m_LastJacobianIndex;
471 
473  // ImagePointer m_WrappedImage[ NDimensions ];
474 
477 
478  typedef AdvancedBSplineDeformableTransform< TScalarType,
479  itkGetStaticConstMacro( SpaceDimension ),
480  itkGetStaticConstMacro( SplineOrder ) > TransformType;
481 
482  unsigned char m_NbLabels;
486  std::vector< typename TransformType::Pointer > m_Trans;
487  std::vector< ParametersType > m_Para;
488  mutable int m_LastJacobian;
490 
491 private:
492 
493  MultiBSplineDeformableTransformWithNormal( const Self & ); // purposely not implemented
494  void operator=( const Self & ); // purposely not implemented
495 
496  void DispatchParameters( const ParametersType & parameters );
497 
498  void PointToLabel( const InputPointType & p, int & l ) const;
499 
500 };
501 
502 } // end namespace itk
503 
504 #ifndef ITK_MANUAL_INSTANTIATION
505 #include "itkMultiBSplineDeformableTransformWithNormal.hxx"
506 #endif
507 
508 #endif // end __itkMultiBSplineDeformableTransformWithNormal_h
virtual const ParametersType & GetParameters(void) const
Matrix< ScalarType, OutputSpaceDimension, InputSpaceDimension > SpatialJacobianType
virtual void PrintSelf(std::ostream &os, Indent indent) const
Deformable transform using a B-spline representation.
virtual NumberOfParametersType GetNumberOfNonZeroJacobianIndices(void) const
virtual void SetGridRegion(const RegionType &region)
void SetParameters(const ParametersType &parameters)
virtual SpacingType GetGridSpacing(void) const
OutputPointType TransformPoint(const InputPointType &point) const
virtual void SetGridSpacing(const SpacingType &spacing)
virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const
virtual DirectionType GetGridDirection(void) const
virtual NumberOfParametersType GetNumberOfParameters(void) const
void PointToLabel(const InputPointType &p, int &l) const
void SetParametersByValue(const ParametersType &parameters)
Image< VectorType, itkGetStaticConstMacro(SpaceDimension) > ImageVectorType
virtual OutputVectorType TransformVector(const InputVectorType &) const
Image< BaseType, itkGetStaticConstMacro(SpaceDimension) > ImageBaseType
virtual void GetJacobianOfSpatialJacobian(const InputPointType &ipp, JacobianOfSpatialJacobianType &jsj, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const
virtual void SetGridDirection(const DirectionType &spacing)
Returns the weights over the support region used for B-spline interpolation/reconstruction.
virtual OriginType GetGridOrigin(void) const
Image< unsigned char, itkGetStaticConstMacro(SpaceDimension) > ImageLabelType
virtual void GetJacobianOfSpatialHessian(const InputPointType &ipp, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const
Transform maps points, vectors and covariant vectors from an input space to an output space...
void SetLabels(ImageLabelType *labels)
virtual void GetSpatialJacobian(const InputPointType &ipp, SpatialJacobianType &sj) const
virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
ImageRegion< itkGetStaticConstMacro(SpaceDimension) > RegionType
void SetFixedParameters(const ParametersType &parameters)
itk::NearestNeighborInterpolateImageFunction< ImageLabelType, TScalarType > ImageLabelInterpolator
virtual RegionType GetGridRegion(void) const
This transform is a composition of B-spline transformations, allowing sliding motion between differen...
virtual void SetGridOrigin(const OriginType &origin)
itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions)
Vector< TScalarType, itkGetStaticConstMacro(SpaceDimension) > VectorType
void DispatchParameters(const ParametersType &parameters)
AdvancedTransform< TScalarType, NDimensions, NDimensions > Superclass
virtual void GetJacobian(const InputPointType &ipp, JacobianType &j, NonZeroJacobianIndicesType &) const
virtual void GetSpatialHessian(const InputPointType &ipp, SpatialHessianType &sh) const
virtual NumberOfParametersType GetNumberOfParametersPerDimension(void) const
FixedArray< Matrix< ScalarType, InputSpaceDimension, InputSpaceDimension >, OutputSpaceDimension > SpatialHessianType
AdvancedBSplineDeformableTransform< TScalarType, itkGetStaticConstMacro(SpaceDimension), itkGetStaticConstMacro(SplineOrder) > TransformType
Image< PixelType, itkGetStaticConstMacro(SpaceDimension) > ImageType
Vector< VectorType, itkGetStaticConstMacro(SpaceDimension) > BaseType
virtual const ParametersType & GetFixedParameters(void) const
BSplineInterpolationWeightFunction2< ScalarType, itkGetStaticConstMacro(SpaceDimension), itkGetStaticConstMacro(SplineOrder) > WeightsFunctionType


Generated on 27-04-2014 for elastix by doxygen 1.8.6 elastix logo