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 
78  typedef typename Superclass::TransformCategoryType TransformCategoryType;
79 
80  typedef typename Superclass
83  typedef typename Superclass
86  typedef typename Superclass
91 
110  void SetParameters( const ParametersType & parameters );
111 
127  void SetFixedParameters( const FixedParametersType & parameters );
128 
145  void SetParametersByValue( const ParametersType & parameters );
146 
155  void SetIdentity( void );
156 
158  virtual const ParametersType & GetParameters( void ) const;
159 
161  virtual const FixedParametersType & GetFixedParameters( void ) const;
162 
164  typedef typename ParametersType::ValueType PixelType;
165  typedef Image< PixelType,
166  itkGetStaticConstMacro( SpaceDimension ) > ImageType;
167  typedef typename ImageType::Pointer ImagePointer;
168 
170  virtual const ImagePointer * GetCoefficientImages( void ) const
171  { return this->m_CoefficientImages; }
172 
184  virtual void SetCoefficientImages( ImagePointer images[] );
185 
187  typedef ImageRegion< itkGetStaticConstMacro( SpaceDimension ) > RegionType;
188 
189  typedef typename RegionType::IndexType IndexType;
190  typedef typename RegionType::SizeType SizeType;
191  typedef typename ImageType::SpacingType SpacingType;
192  typedef typename ImageType::DirectionType DirectionType;
193  typedef typename ImageType::PointType OriginType;
194  typedef IndexType GridOffsetType;
195 
197  virtual void SetGridRegion( const RegionType & region ) = 0;
198 
199  //itkGetMacro( GridRegion, RegionType );
200  itkGetConstMacro( GridRegion, RegionType );
201 
203  virtual void SetGridSpacing( const SpacingType & spacing );
204 
205  //itkGetMacro( GridSpacing, SpacingType );
206  itkGetConstMacro( GridSpacing, SpacingType );
207 
209  virtual void SetGridDirection( const DirectionType & direction );
210 
211  //itkGetMacro( GridDirection, DirectionType );
212  itkGetConstMacro( GridDirection, DirectionType );
213 
215  virtual void SetGridOrigin( const OriginType & origin );
216 
217  //itkGetMacro( GridOrigin, OriginType );
218  itkGetConstMacro( GridOrigin, OriginType );
219 
221  typedef Array< unsigned long > ParameterIndexArrayType;
222 
226  virtual OutputVectorType TransformVector( const InputVectorType & ) const
227  {
228  itkExceptionMacro( << "Method not applicable for deformable transform." );
229  return OutputVectorType();
230  }
231 
232 
236  virtual OutputVnlVectorType TransformVector( const InputVnlVectorType & ) const
237  {
238  itkExceptionMacro( << "Method not applicable for deformable transform. " );
239  return OutputVnlVectorType();
240  }
241 
242 
247  const InputCovariantVectorType & ) const
248  {
249  itkExceptionMacro( << "Method not applicable for deformable transform. " );
250  return OutputCovariantVectorType();
251  }
252 
253 
255  virtual NumberOfParametersType GetNumberOfParameters( void ) const;
256 
258  virtual NumberOfParametersType GetNumberOfParametersPerDimension( void ) const;
259 
261  itkGetConstReferenceMacro( ValidRegion, RegionType );
262 
268  virtual bool IsLinear( void ) const { return false; }
269 
273  virtual TransformCategoryType GetTransformCategory( void ) const
274  {
275  return Self::BSpline;
276  }
277 
278 
279  virtual unsigned int GetNumberOfAffectedWeights( void ) const = 0;
280 
281  virtual NumberOfParametersType GetNumberOfNonZeroJacobianIndices( void ) const = 0;
282 
286  typedef ContinuousIndex< ScalarType, SpaceDimension > ContinuousIndexType;
287 
288 protected:
289 
291  virtual void PrintSelf( std::ostream & os, Indent indent ) const;
292 
295 
297  void WrapAsImages( void );
298 
301  const InputPointType & point, ContinuousIndexType & index ) const;
302 
303  void UpdatePointIndexConversions( void );
304 
305  virtual void ComputeNonZeroJacobianIndices(
306  NonZeroJacobianIndicesType & nonZeroJacobianIndices,
307  const RegionType & supportRegion ) const = 0;
308 
310  virtual bool InsideValidRegion( const ContinuousIndexType & index ) const;
311 
315  ImagePointer m_CoefficientImages[ NDimensions ];
316 
318  RegionType m_GridRegion;
319  SpacingType m_GridSpacing;
320  DirectionType m_GridDirection;
321  OriginType m_GridOrigin;
322  GridOffsetType m_GridOffsetTable;
323 
324  DirectionType m_PointToIndexMatrix;
325  SpatialJacobianType m_PointToIndexMatrix2;
327  SpatialJacobianType m_PointToIndexMatrixTransposed2;
328  FixedArray< ScalarType, NDimensions > m_PointToIndexMatrixDiagonal;
329  FixedArray< ScalarType, NDimensions * NDimensions > m_PointToIndexMatrixDiagonalProducts;
330  DirectionType m_IndexToPoint;
332 
333  RegionType m_ValidRegion;
334 
336  unsigned long m_Offset;
337  SizeType m_SupportSize;
338  ContinuousIndexType m_ValidRegionBegin;
339  ContinuousIndexType m_ValidRegionEnd;
340 
343 
345  const ParametersType * m_InputParametersPointer;
346 
348  typedef typename JacobianType::ValueType JacobianPixelType;
349  typedef Image< JacobianPixelType,
350  itkGetStaticConstMacro( SpaceDimension ) > JacobianImageType;
351 
352  typename JacobianImageType::Pointer m_JacobianImage[ NDimensions ];
353 
357  mutable IndexType m_LastJacobianIndex;
358 
360  ImagePointer m_WrappedImage[ NDimensions ];
361 
364 
365  void UpdateGridOffsetTable( void );
366 
367 private:
368 
369  AdvancedBSplineDeformableTransformBase( const Self & ); // purposely not implemented
370  void operator=( const Self & ); // purposely not implemented
371 
372 };
373 
374 } // namespace itk
375 
376 #ifndef ITK_MANUAL_INSTANTIATION
377 #include "itkAdvancedBSplineDeformableTransformBase.hxx"
378 #endif
379 
380 #endif /* __itkAdvancedBSplineDeformableTransformBase_h */
virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const
Matrix< ScalarType, OutputSpaceDimension, InputSpaceDimension > SpatialJacobianType
Superclass::MovingImageGradientValueType MovingImageGradientValueType
void SetParameters(const ParametersType &parameters)
virtual const FixedParametersType & GetFixedParameters(void) const
virtual void SetGridOrigin(const OriginType &origin)
FixedArray< ScalarType, NDimensions *NDimensions > m_PointToIndexMatrixDiagonalProducts
ImageRegion< itkGetStaticConstMacro(SpaceDimension) > RegionType
Superclass ::JacobianOfSpatialJacobianType JacobianOfSpatialJacobianType
virtual void SetGridRegion(const RegionType &region)=0
Superclass ::JacobianOfSpatialHessianType JacobianOfSpatialHessianType
void TransformPointToContinuousGridIndex(const InputPointType &point, ContinuousIndexType &index) const
virtual bool InsideValidRegion(const ContinuousIndexType &index) const
virtual void SetGridSpacing(const SpacingType &spacing)
virtual unsigned int GetNumberOfAffectedWeights(void) const =0
virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
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 NumberOfParametersType GetNumberOfParameters(void) const
Superclass ::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
Image< PixelType, itkGetStaticConstMacro(SpaceDimension) > ImageType
AdvancedTransform< TScalarType, NDimensions, NDimensions > Superclass
itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions)
virtual void SetGridDirection(const DirectionType &direction)
ContinuousIndex< ScalarType, SpaceDimension > ContinuousIndexType
virtual NumberOfParametersType GetNumberOfNonZeroJacobianIndices(void) const =0
void SetParametersByValue(const ParametersType &parameters)
virtual OutputVectorType TransformVector(const InputVectorType &) const
virtual void ComputeNonZeroJacobianIndices(NonZeroJacobianIndicesType &nonZeroJacobianIndices, const RegionType &supportRegion) const =0
virtual void PrintSelf(std::ostream &os, Indent indent) const
Base class for deformable transform using a B-spline representation.
FixedArray< Matrix< ScalarType, InputSpaceDimension, InputSpaceDimension >, OutputSpaceDimension > SpatialHessianType
virtual const ParametersType & GetParameters(void) const
virtual NumberOfParametersType GetNumberOfParametersPerDimension(void) const
void SetFixedParameters(const FixedParametersType &parameters)


Generated on OURCE_DATE_EPOCH for elastix by doxygen 1.8.13 elastix logo