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  * Copyright UMC Utrecht and contributors
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 __itkStackTransform_h
19 #define __itkStackTransform_h
20 
21 #include "itkAdvancedTransform.h"
22 #include "itkIndex.h"
23 
24 namespace itk
25 {
26 
37 template< class TScalarType,
38 unsigned int NInputDimensions = 3,
39 unsigned int NOutputDimensions = 3 >
41  public AdvancedTransform< TScalarType, NInputDimensions, NOutputDimensions >
42 {
43 public:
44 
47  typedef AdvancedTransform< TScalarType,
48  NInputDimensions,
49  NOutputDimensions > Superclass;
51  typedef SmartPointer< const Self > ConstPointer;
52 
54  itkNewMacro( Self );
55 
57  itkTypeMacro( StackTransform, AdvancedTransform );
58 
60  itkStaticConstMacro( InputSpaceDimension, unsigned int, NInputDimensions );
61  itkStaticConstMacro( OutputSpaceDimension, unsigned int, NOutputDimensions );
62  itkStaticConstMacro( ReducedInputSpaceDimension, unsigned int, NInputDimensions - 1 );
63  itkStaticConstMacro( ReducedOutputSpaceDimension, unsigned int, NOutputDimensions - 1 );
64 
68  typedef typename Superclass::NumberOfParametersType
78  typedef typename
90  typedef typename Superclass::OutputVectorPixelType OutputVectorPixelType;
91  typedef typename Superclass::InputVectorPixelType InputVectorPixelType;
92 
94  typedef AdvancedTransform< TScalarType,
95  itkGetStaticConstMacro( ReducedInputSpaceDimension ),
96  itkGetStaticConstMacro( ReducedOutputSpaceDimension ) > SubTransformType;
98  typedef std::vector< SubTransformPointer > SubTransformContainerType;
100 
104 
106  typedef typename ParametersType::ArrayType ParametersArrayType;
107 
109  virtual OutputPointType TransformPoint( const InputPointType & ipp ) const;
110 
112  virtual OutputVectorType TransformVector( const InputVectorType & ) const
113  {
114  itkExceptionMacro(
115  << "TransformVector(const InputVectorType &) is not implemented "
116  << "for StackTransform" );
117  }
118 
119 
120  virtual OutputVnlVectorType TransformVector( const InputVnlVectorType & ) const
121  {
122  itkExceptionMacro(
123  << "TransformVector(const InputVnlVectorType &) is not implemented "
124  << "for StackTransform" );
125  }
126 
127 
129  {
130  itkExceptionMacro(
131  << "TransformCovariantVector(const InputCovariantVectorType &) is not implemented "
132  << "for StackTransform" );
133  }
134 
135 
141  virtual void GetJacobian(
142  const InputPointType & ipp,
143  JacobianType & jac,
144  NonZeroJacobianIndicesType & nzji ) const;
145 
148  virtual void SetParameters( const ParametersType & param );
149 
152  virtual const ParametersType & GetParameters( void ) const;
153 
155  virtual void SetFixedParameters( const ParametersType & )
156  {
157  // \todo: to be implemented by Coert
158  }
159 
160 
162  virtual const ParametersType & GetFixedParameters( void ) const
163  {
164  // \todo: to be implemented by Coert: check this:
165  return this->m_FixedParameters;
166  }
167 
168 
171  {
172  if( this->m_SubTransformContainer.size() == 0 )
173  {
174  return 0;
175  }
176  else
177  {
178  return this->m_SubTransformContainer.size() * m_SubTransformContainer[ 0 ]->GetNumberOfParameters();
179  }
180  }
181 
182 
184  virtual void SetNumberOfSubTransforms( const unsigned int num )
185  {
186  if( this->m_NumberOfSubTransforms != num )
187  {
188  this->m_NumberOfSubTransforms = num;
189  this->m_SubTransformContainer.clear();
190  this->m_SubTransformContainer.resize( num );
191  this->Modified();
192  }
193  }
194 
195 
196  itkGetMacro( NumberOfSubTransforms, unsigned int );
197 
199  itkSetMacro( StackSpacing, TScalarType );
200  itkGetConstMacro( StackSpacing, TScalarType );
201  itkSetMacro( StackOrigin, TScalarType );
202  itkGetConstMacro( StackOrigin, TScalarType );
203 
205  virtual void SetSubTransform( unsigned int i, SubTransformType * transform )
206  {
207  this->m_SubTransformContainer[ i ] = transform;
208  this->Modified();
209  }
210 
211 
213  virtual void SetAllSubTransforms( SubTransformType * transform )
214  {
215  for( unsigned int t = 0; t < this->m_NumberOfSubTransforms; ++t )
216  {
217  // Copy transform
218  SubTransformPointer transformcopy = dynamic_cast< SubTransformType * >( transform->CreateAnother().GetPointer() );
219  transformcopy->SetFixedParameters( transform->GetFixedParameters() );
220  transformcopy->SetParameters( transform->GetParameters() );
221  // Set sub transform
222  this->m_SubTransformContainer[ t ] = transformcopy;
223  }
224  }
225 
226 
228  virtual SubTransformPointer GetSubTransform( unsigned int i )
229  {
230  return this->m_SubTransformContainer[ i ];
231  }
232 
233 
236 
238  virtual void GetSpatialJacobian(
239  const InputPointType & ipp, SpatialJacobianType & sj ) const
240  {
241  itkExceptionMacro( << "Not implemented for StackTransform" );
242  }
243 
244 
245  virtual void GetSpatialHessian(
246  const InputPointType & ipp, SpatialHessianType & sh ) const
247  {
248  itkExceptionMacro( << "Not implemented for StackTransform" );
249  }
250 
251 
253  const InputPointType & ipp, JacobianOfSpatialJacobianType & jsj,
254  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
255  {
256  itkExceptionMacro( << "Not implemented for StackTransform" );
257  }
258 
259 
261  const InputPointType & ipp, SpatialJacobianType & sj,
263  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
264  {
265  itkExceptionMacro( << "Not implemented for StackTransform" );
266  }
267 
268 
270  const InputPointType & ipp, JacobianOfSpatialHessianType & jsh,
271  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
272  {
273  itkExceptionMacro( << "Not implemented for StackTransform" );
274  }
275 
276 
278  const InputPointType & ipp, SpatialHessianType & sh,
280  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
281  {
282  itkExceptionMacro( << "Not implemented for StackTransform" );
283  }
284 
285 
286 protected:
287 
288  StackTransform();
289  virtual ~StackTransform() {}
290 
291 private:
292 
293  StackTransform( const Self & ); // purposely not implemented
294  void operator=( const Self & ); // purposely not implemented
295 
296  // Number of transforms and transform container
298  SubTransformContainerType m_SubTransformContainer;
299 
300  // Stack spacing and origin of last dimension
302 
303 };
304 
305 } // end namespace itk
306 
307 #ifndef ITK_MANUAL_INSTANTIATION
308 #include "itkStackTransform.hxx"
309 #endif
310 
311 #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)
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 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo