go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkAdvancedBSplineDeformableTransformBase.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 __itkAdvancedBSplineDeformableTransformBase_h
19 #define __itkAdvancedBSplineDeformableTransformBase_h
20 
21 #include "itkAdvancedTransform.h"
22 #include "itkImage.h"
23 #include "itkImageRegion.h"
24 
25 namespace itk
26 {
27 
38 template<
39 class TScalarType = double, // Data type for scalars
40 unsigned int NDimensions = 3 >
41 // Number of dimensions
43  public AdvancedTransform< TScalarType, NDimensions, NDimensions >
44 {
45 public:
46 
49  typedef AdvancedTransform<
50  TScalarType, NDimensions, NDimensions > Superclass;
52  typedef SmartPointer< const Self > ConstPointer;
53 
56 
58  itkStaticConstMacro( SpaceDimension, unsigned int, NDimensions );
59 
77  typedef typename Superclass::TransformCategoryType TransformCategoryType;
78 
79  typedef typename Superclass
82  typedef typename Superclass
85  typedef typename Superclass
90 
109  void SetParameters( const ParametersType & parameters );
110 
126  void SetFixedParameters( const ParametersType & parameters );
127 
144  void SetParametersByValue( const ParametersType & parameters );
145 
154  void SetIdentity( void );
155 
157  virtual const ParametersType & GetParameters( void ) const;
158 
160  virtual const ParametersType & GetFixedParameters( void ) const;
161 
163  typedef typename ParametersType::ValueType PixelType;
164  typedef Image< PixelType,
165  itkGetStaticConstMacro( SpaceDimension ) > ImageType;
166  typedef typename ImageType::Pointer ImagePointer;
167 
169  virtual const ImagePointer * GetCoefficientImages( void ) const
170  { return this->m_CoefficientImages; }
171 
183  virtual void SetCoefficientImages( ImagePointer images[] );
184 
186  typedef ImageRegion< itkGetStaticConstMacro( SpaceDimension ) > RegionType;
187 
188  typedef typename RegionType::IndexType IndexType;
189  typedef typename RegionType::SizeType SizeType;
190  typedef typename ImageType::SpacingType SpacingType;
191  typedef typename ImageType::DirectionType DirectionType;
192  typedef typename ImageType::PointType OriginType;
193  typedef IndexType GridOffsetType;
194 
196  virtual void SetGridRegion( const RegionType & region ) = 0;
197 
198  //itkGetMacro( GridRegion, RegionType );
199  itkGetConstMacro( GridRegion, RegionType );
200 
202  virtual void SetGridSpacing( const SpacingType & spacing );
203 
204  //itkGetMacro( GridSpacing, SpacingType );
205  itkGetConstMacro( GridSpacing, SpacingType );
206 
208  virtual void SetGridDirection( const DirectionType & direction );
209 
210  //itkGetMacro( GridDirection, DirectionType );
211  itkGetConstMacro( GridDirection, DirectionType );
212 
214  virtual void SetGridOrigin( const OriginType & origin );
215 
216  //itkGetMacro( GridOrigin, OriginType );
217  itkGetConstMacro( GridOrigin, OriginType );
218 
220  typedef Array< unsigned long > ParameterIndexArrayType;
221 
225  virtual OutputVectorType TransformVector( const InputVectorType & ) const
226  {
227  itkExceptionMacro( << "Method not applicable for deformable transform." );
228  return OutputVectorType();
229  }
230 
231 
235  virtual OutputVnlVectorType TransformVector( const InputVnlVectorType & ) const
236  {
237  itkExceptionMacro( << "Method not applicable for deformable transform. " );
238  return OutputVnlVectorType();
239  }
240 
241 
246  const InputCovariantVectorType & ) const
247  {
248  itkExceptionMacro( << "Method not applicable for deformable transform. " );
249  return OutputCovariantVectorType();
250  }
251 
252 
254  virtual NumberOfParametersType GetNumberOfParameters( void ) const;
255 
257  virtual NumberOfParametersType GetNumberOfParametersPerDimension( void ) const;
258 
260  itkGetConstReferenceMacro( ValidRegion, RegionType );
261 
267  virtual bool IsLinear( void ) const { return false; }
268 
272  virtual TransformCategoryType GetTransformCategory( void ) const
273  {
274  return Self::BSpline;
275  }
276 
277 
278  virtual unsigned int GetNumberOfAffectedWeights( void ) const = 0;
279 
280  virtual NumberOfParametersType GetNumberOfNonZeroJacobianIndices( void ) const = 0;
281 
285  typedef ContinuousIndex< ScalarType, SpaceDimension > ContinuousIndexType;
286 
287 protected:
288 
290  virtual void PrintSelf( std::ostream & os, Indent indent ) const;
291 
294 
296  void WrapAsImages( void );
297 
300  const InputPointType & point, ContinuousIndexType & index ) const;
301 
302  void UpdatePointIndexConversions( void );
303 
304  virtual void ComputeNonZeroJacobianIndices(
305  NonZeroJacobianIndicesType & nonZeroJacobianIndices,
306  const RegionType & supportRegion ) const = 0;
307 
309  virtual bool InsideValidRegion( const ContinuousIndexType & index ) const;
310 
314  ImagePointer m_CoefficientImages[ NDimensions ];
315 
317  RegionType m_GridRegion;
318  SpacingType m_GridSpacing;
319  DirectionType m_GridDirection;
320  OriginType m_GridOrigin;
321  GridOffsetType m_GridOffsetTable;
322 
323  DirectionType m_PointToIndexMatrix;
324  SpatialJacobianType m_PointToIndexMatrix2;
326  SpatialJacobianType m_PointToIndexMatrixTransposed2;
327  FixedArray< ScalarType, NDimensions > m_PointToIndexMatrixDiagonal;
328  FixedArray< ScalarType, NDimensions * NDimensions > m_PointToIndexMatrixDiagonalProducts;
329  DirectionType m_IndexToPoint;
331 
332  RegionType m_ValidRegion;
333 
335  unsigned long m_Offset;
336  SizeType m_SupportSize;
337  ContinuousIndexType m_ValidRegionBegin;
338  ContinuousIndexType m_ValidRegionEnd;
339 
342 
344  const ParametersType * m_InputParametersPointer;
345 
347  typedef typename JacobianType::ValueType JacobianPixelType;
348  typedef Image< JacobianPixelType,
349  itkGetStaticConstMacro( SpaceDimension ) > JacobianImageType;
350 
351  typename JacobianImageType::Pointer m_JacobianImage[ NDimensions ];
352 
356  mutable IndexType m_LastJacobianIndex;
357 
359  ImagePointer m_WrappedImage[ NDimensions ];
360 
363 
364  void UpdateGridOffsetTable( void );
365 
366 private:
367 
368  AdvancedBSplineDeformableTransformBase( const Self & ); // purposely not implemented
369  void operator=( const Self & ); // purposely not implemented
370 
371 };
372 
373 } // namespace itk
374 
375 #ifndef ITK_MANUAL_INSTANTIATION
376 #include "itkAdvancedBSplineDeformableTransformBase.hxx"
377 #endif
378 
379 #endif /* __itkAdvancedBSplineDeformableTransformBase_h */
Matrix< ScalarType, OutputSpaceDimension, InputSpaceDimension > SpatialJacobianType
Superclass::MovingImageGradientValueType MovingImageGradientValueType
void SetParameters(const ParametersType &parameters)
virtual const ParametersType & GetParameters(void) const
virtual NumberOfParametersType GetNumberOfParameters(void) const
virtual void SetGridOrigin(const OriginType &origin)
FixedArray< ScalarType, NDimensions *NDimensions > m_PointToIndexMatrixDiagonalProducts
virtual bool InsideValidRegion(const ContinuousIndexType &index) const
ImageRegion< itkGetStaticConstMacro(SpaceDimension) > RegionType
Superclass::JacobianOfSpatialJacobianType JacobianOfSpatialJacobianType
virtual void SetGridRegion(const RegionType &region)=0
Superclass::JacobianOfSpatialHessianType JacobianOfSpatialHessianType
void SetFixedParameters(const ParametersType &parameters)
virtual void SetGridSpacing(const SpacingType &spacing)
virtual TransformCategoryType GetTransformCategory(void) const
virtual unsigned int GetNumberOfAffectedWeights(void) const =0
Image< JacobianPixelType, itkGetStaticConstMacro(SpaceDimension) > JacobianImageType
Transform maps points, vectors and covariant vectors from an input space to an output space...
virtual void SetCoefficientImages(ImagePointer images[])
virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const
virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
Image< PixelType, itkGetStaticConstMacro(SpaceDimension) > ImageType
AdvancedTransform< TScalarType, NDimensions, NDimensions > Superclass
virtual OutputVectorType TransformVector(const InputVectorType &) const
void TransformPointToContinuousGridIndex(const InputPointType &point, ContinuousIndexType &index) const
itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions)
virtual const ParametersType & GetFixedParameters(void) const
virtual void SetGridDirection(const DirectionType &direction)
ContinuousIndex< ScalarType, SpaceDimension > ContinuousIndexType
virtual NumberOfParametersType GetNumberOfNonZeroJacobianIndices(void) const =0
void SetParametersByValue(const ParametersType &parameters)
virtual void PrintSelf(std::ostream &os, Indent indent) const
virtual void ComputeNonZeroJacobianIndices(NonZeroJacobianIndicesType &nonZeroJacobianIndices, const RegionType &supportRegion) const =0
Base class for deformable transform using a B-spline representation.
FixedArray< Matrix< ScalarType, InputSpaceDimension, InputSpaceDimension >, OutputSpaceDimension > SpatialHessianType
virtual NumberOfParametersType GetNumberOfParametersPerDimension(void) const


Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo