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 
67  typedef typename
69 
71  typedef AdvancedTransform< TScalarType,
72  itkGetStaticConstMacro( ReducedInputSpaceDimension ),
73  itkGetStaticConstMacro( ReducedOutputSpaceDimension ) > SubTransformType;
75  typedef std::vector< SubTransformPointer > SubTransformContainerType;
77 
81 
83  virtual OutputPointType TransformPoint( const InputPointType & ipp ) const;
84 
90  virtual void GetJacobian(
91  const InputPointType & ipp,
92  JacobianType & jac,
93  NonZeroJacobianIndicesType & nzji ) const;
94 
96  virtual const JacobianType & GetJacobian( const InputPointType & ipp) const;
97 
100  virtual void SetParameters( const ParametersType & param );
101 
104  virtual const ParametersType & GetParameters ( void ) const;
105 
107  virtual unsigned int GetNumberOfParameters(void) const
108  {
109  if ( this->m_SubTransformContainer.size() == 0 )
110  {
111  return 0;
112  }
113  else
114  {
115  return this->m_SubTransformContainer.size() * m_SubTransformContainer[ 0 ]->GetNumberOfParameters();
116  }
117  }
118 
120  virtual void SetNumberOfSubTransforms( const unsigned int num )
121  {
122  if ( this->m_NumberOfSubTransforms != num )
123  {
124  this->m_NumberOfSubTransforms = num;
125  this->m_SubTransformContainer.clear();
126  this->m_SubTransformContainer.resize( num );
127  this->Modified();
128  }
129  }
130  itkGetMacro( NumberOfSubTransforms, unsigned int );
131 
133  itkSetMacro( StackSpacing, TScalarType );
134  itkGetConstMacro( StackSpacing, TScalarType );
135  itkSetMacro( StackOrigin, TScalarType );
136  itkGetConstMacro( StackOrigin, TScalarType );
137 
139  virtual void SetSubTransform( unsigned int i, SubTransformType * transform )
140  {
141  this->m_SubTransformContainer[ i ] = transform;
142  this->Modified();
143  }
144 
146  virtual void SetAllSubTransforms( SubTransformType * transform ) {
147  for ( unsigned int t = 0; t < this->m_NumberOfSubTransforms; ++t )
148  {
149  // Copy transform
150  SubTransformPointer transformcopy = dynamic_cast< SubTransformType * >( transform->CreateAnother().GetPointer() );
151  transformcopy->SetFixedParameters( transform->GetFixedParameters() );
152  transformcopy->SetParameters( transform->GetParameters() );
153  // Set sub transform
154  this->m_SubTransformContainer[ t ] = transformcopy;
155  }
156  }
157 
159  virtual SubTransformPointer GetSubTransform( unsigned int i )
160  {
161  return this->m_SubTransformContainer[ i ];
162  }
163 
165  virtual unsigned long GetNumberOfNonZeroJacobianIndices( void ) const;
166 
167 protected:
168  StackTransform();
169  virtual ~StackTransform() {};
170 
171 private:
172 
173  StackTransform(const Self&); // purposely not implemented
174  void operator=(const Self&); // purposely not implemented
175 
176  // Number of transforms and transform container
179 
180  // Stack spacing and origin of last dimension
182 
183 }; // end class StackTransform
184 
185 } // end namespace itk
186 
187 // \todo: copied the below from itk. does this just work like this?:
188 
189 // Define instantiation macro for this template.
190 #define ITK_TEMPLATE_StackTransform(_, EXPORT, x, y) namespace itk { \
191  _(3(class EXPORT StackTransform< ITK_TEMPLATE_3 x >)) \
192  namespace Templates { typedef StackTransform< ITK_TEMPLATE_3 x > StackTransform##y; } \
193  }
194 
195 #if ITK_TEMPLATE_EXPLICIT
196 # include "Templates/itkStackTransform+-.h"
197 #endif
198 
199 #if ITK_TEMPLATE_TXX
200 # include "itkStackTransform.txx"
201 #endif
202 
203 #endif


Generated on 21-03-2014 for elastix by doxygen 1.8.1.2 elastix logo