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 * 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 __itkMultiBSplineDeformableTransformWithNormal_h
19#define __itkMultiBSplineDeformableTransformWithNormal_h
20
22#include "itkNearestNeighborInterpolateImageFunction.h"
23
24namespace itk
25{
38template<
39class TScalarType = double, // Data type for scalars
40unsigned int NDimensions = 3, // Number of dimensions
41unsigned int VSplineOrder = 3 >
42// Spline order
44 public AdvancedTransform< TScalarType, NDimensions, NDimensions >
45{
46public:
47
50 typedef AdvancedTransform<
51 TScalarType, NDimensions, NDimensions > Superclass;
53 typedef SmartPointer< const Self > ConstPointer;
54
56 itkNewMacro( Self );
57
60
62 itkStaticConstMacro( SpaceDimension, unsigned int, NDimensions );
63
65 itkStaticConstMacro( SplineOrder, unsigned int, VSplineOrder );
66
82
83 typedef typename Superclass
86 typedef typename Superclass
89 typedef typename Superclass
92
95 itkGetStaticConstMacro( SpaceDimension ),
96 itkGetStaticConstMacro( SplineOrder ) > WeightsFunctionType;
98
117 void SetParameters( const ParametersType & parameters ) override;
118
134 void SetFixedParameters( const ParametersType & parameters ) override;
135
152 void SetParametersByValue( const ParametersType & parameters ) override;
153
162 void SetIdentity( void );
163
165 const ParametersType & GetParameters( void ) const override;
166
168 const ParametersType & GetFixedParameters( void ) const override;
169
171 typedef typename ParametersType::ValueType PixelType;
172 typedef Image< PixelType,
173 itkGetStaticConstMacro( SpaceDimension ) > ImageType;
174 typedef typename ImageType::Pointer ImagePointer;
175
177 //virtual ImagePointer * GetCoefficientImage( void )
178 // { return this->m_CoefficientImage; }
179 //virtual const ImagePointer * GetCoefficientImage( void ) const
180 // { return this->m_CoefficientImage; }
181
193 // virtual void SetCoefficientImage( ImagePointer images[] );
194
196 typedef ImageRegion< itkGetStaticConstMacro( SpaceDimension ) > RegionType;
197
198 typedef typename RegionType::IndexType IndexType;
199 typedef typename RegionType::SizeType SizeType;
200 typedef typename ImageType::SpacingType SpacingType;
201 typedef typename ImageType::DirectionType DirectionType;
202 typedef typename ImageType::PointType OriginType;
204
206 virtual void SetGridRegion( const RegionType & region );
207
208 virtual RegionType GetGridRegion( void ) const;
209
211 virtual void SetGridSpacing( const SpacingType & spacing );
212
213 virtual SpacingType GetGridSpacing( void ) const;
214
216 virtual void SetGridDirection( const DirectionType & spacing );
217
218 virtual DirectionType GetGridDirection( void ) const;
219
221 virtual void SetGridOrigin( const OriginType & origin );
222
223 virtual OriginType GetGridOrigin( void ) const;
224
226 typedef Image< unsigned char,
227 itkGetStaticConstMacro( SpaceDimension ) > ImageLabelType;
228 typedef typename ImageLabelType::Pointer ImageLabelPointer;
229
230 typedef itk::NearestNeighborInterpolateImageFunction<
232 typedef typename ImageLabelInterpolator::Pointer ImageLabelInterpolatorPointer;
233
235 typedef Vector< TScalarType, itkGetStaticConstMacro( SpaceDimension ) > VectorType;
236 typedef Vector< VectorType, itkGetStaticConstMacro( SpaceDimension ) > BaseType;
237 typedef Image< VectorType, itkGetStaticConstMacro( SpaceDimension ) > ImageVectorType;
238 typedef typename ImageVectorType::Pointer ImageVectorPointer;
239 typedef Image< BaseType, itkGetStaticConstMacro( SpaceDimension ) > ImageBaseType;
240 typedef typename ImageBaseType::Pointer ImageBasePointer;
241
243 void SetLabels( ImageLabelType * labels );
244
245 itkGetMacro( Labels, ImageLabelType * );
246
247 itkGetConstMacro( NbLabels, unsigned char );
248
250 void UpdateLocalBases( void );
251
252 itkGetMacro( LocalBases, ImageBaseType * );
253
255 typedef Array< unsigned long > ParameterIndexArrayType;
256
261 {
262 itkExceptionMacro( << "Method not applicable for deformable transform." );
263 return OutputVectorType();
264 }
265
266
271 {
272 itkExceptionMacro( << "Method not applicable for deformable transform. " );
273 return OutputVnlVectorType();
274 }
275
276
281 const InputCovariantVectorType & ) const override
282 {
283 itkExceptionMacro( << "Method not applicable for deformable transform. " );
285 }
286
287
290
293
295 virtual const RegionType & GetValidRegion( void )
296 {
297 return m_Trans[ 0 ]->GetValidRegion();
298 }
299
300
306 bool IsLinear( void ) const override { return false; }
307
309 virtual unsigned long GetNumberOfWeights( void ) const
310 {
311 return m_Trans[ 0 ]->m_WeightsFunction->GetNumberOfWeights();
312 }
313
314
315 virtual unsigned int GetNumberOfAffectedWeights( void ) const
316 {
317 return m_Trans[ 0 ]->m_WeightsFunction->GetNumberOfWeights();
318 }
319
320
322 {
323 return m_Trans[ 0 ]->m_WeightsFunction->GetNumberOfWeights() * SpaceDimension;
324 }
325
326
328 virtual bool GetHasNonZeroSpatialJacobian( void ) const
329 {
330 return true;
331 }
332
333
334 virtual bool HasNonZeroJacobianOfSpatialJacobian( void ) const
335 {
336 return true;
337 }
338
339
340 bool GetHasNonZeroSpatialHessian( void ) const override
341 {
342 return true;
343 }
344
345
346 virtual bool HasNonZeroJacobianOfSpatialHessian( void ) const
347 {
348 return true;
349 }
350
351
354
356 OutputPointType TransformPoint( const InputPointType & point ) const override;
357
359 //virtual const JacobianType & GetJacobian( const InputPointType & point ) const;
360
363 const InputPointType & ipp,
364 JacobianType & j,
365 NonZeroJacobianIndicesType & ) const override;
366
369 const InputPointType & ipp,
370 SpatialJacobianType & sj ) const override;
371
373 const InputPointType & ipp,
375 NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const override;
376
378 const InputPointType &,
381 NonZeroJacobianIndicesType & ) const override;
382
385 const InputPointType & ipp,
386 SpatialHessianType & sh ) const override;
387
389 const InputPointType & ipp,
391 NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const override
392 {
393 itkExceptionMacro( << "ERROR: GetJacobianOfSpatialHessian() not yet implemented "
394 << "in the MultiBSplineDeformableTransformWithNormal class." );
395 }
396
397
399 const InputPointType &,
402 NonZeroJacobianIndicesType & ) const override;
403
404protected:
405
407 void PrintSelf( std::ostream & os, Indent indent ) const override;
408
411
413 // void WrapAsImages( void );
414
416 /*
417 void TransformPointToContinuousGridIndex(
418 const InputPointType & point, ContinuousIndexType & index ) const;
419
420 virtual void ComputeNonZeroJacobianIndices(
421 NonZeroJacobianIndicesType & nonZeroJacobianIndices,
422 const RegionType & supportRegion ) const;
423 */
424
426 //virtual bool InsideValidRegion( const ContinuousIndexType& index ) const;
427
429 // BulkTransformPointer m_BulkTransform;
430
433 // ImagePointer m_CoefficientImage[ NDimensions ];
434
436 // RegionType m_GridRegion;
437 // SpacingType m_GridSpacing;
438 // DirectionType m_GridDirection;
439 // OriginType m_GridOrigin;
440 // GridOffsetType m_GridOffsetTable;
441
442 // DirectionType m_PointToIndexMatrix;
443 // SpatialJacobianType m_PointToIndexMatrix2;
444 // DirectionType m_PointToIndexMatrixTransposed;
445 // SpatialJacobianType m_PointToIndexMatrixTransposed2;
446 // DirectionType m_IndexToPoint;
447
448 // RegionType m_ValidRegion;
449
451 // unsigned long m_Offset;
452 // SizeType m_SupportSize;
453 // ContinuousIndexType m_ValidRegionBegin;
454 // ContinuousIndexType m_ValidRegionEnd;
455
457 // bool m_SplineOrderOdd;
458
461
463 /*
464 typedef typename JacobianType::ValueType JacobianPixelType;
465 typedef Image< JacobianPixelType,
466 itkGetStaticConstMacro( SpaceDimension ) > JacobianImageType;
467
468 typename JacobianImageType::Pointer m_JacobianImage[ NDimensions ];
469 */
470
474 // mutable IndexType m_LastJacobianIndex;
475
477 // ImagePointer m_WrappedImage[ NDimensions ];
478
481
483 itkGetStaticConstMacro( SpaceDimension ),
484 itkGetStaticConstMacro( SplineOrder ) > TransformType;
485
486 unsigned char m_NbLabels;
490 std::vector< typename TransformType::Pointer > m_Trans;
491 std::vector< ParametersType > m_Para;
492 mutable int m_LastJacobian;
494
495private:
496
497 MultiBSplineDeformableTransformWithNormal( const Self & ); // purposely not implemented
498 void operator=( const Self & ); // purposely not implemented
499
500 void DispatchParameters( const ParametersType & parameters );
501
502 void PointToLabel( const InputPointType & p, int & l ) const;
503
504};
505
506} // end namespace itk
507
508#ifndef ITK_MANUAL_INSTANTIATION
509#include "itkMultiBSplineDeformableTransformWithNormal.hxx"
510#endif
511
512#endif // end __itkMultiBSplineDeformableTransformWithNormal_h
Deformable transform using a B-spline representation.
Transform maps points, vectors and covariant vectors from an input space to an output space.
FixedArray< Matrix< ScalarType, InputSpaceDimension, InputSpaceDimension >, OutputSpaceDimension > SpatialHessianType
Matrix< ScalarType, OutputSpaceDimension, InputSpaceDimension > SpatialJacobianType
Returns the weights over the support region used for B-spline interpolation/reconstruction.
This transform is a composition of B-spline transformations, allowing sliding motion between differen...
Vector< VectorType, itkGetStaticConstMacro(SpaceDimension) > BaseType
void SetFixedParameters(const ParametersType &parameters) override
virtual void SetGridDirection(const DirectionType &spacing)
NumberOfParametersType GetNumberOfParameters(void) const override
void GetJacobianOfSpatialHessian(const InputPointType &, SpatialHessianType &, JacobianOfSpatialHessianType &, NonZeroJacobianIndicesType &) const override
void GetSpatialJacobian(const InputPointType &ipp, SpatialJacobianType &sj) const override
virtual DirectionType GetGridDirection(void) const
Image< PixelType, itkGetStaticConstMacro(SpaceDimension) > ImageType
void SetParameters(const ParametersType &parameters) override
void GetJacobian(const InputPointType &ipp, JacobianType &j, NonZeroJacobianIndicesType &) const override
void PointToLabel(const InputPointType &p, int &l) const
virtual void SetGridOrigin(const OriginType &origin)
void DispatchParameters(const ParametersType &parameters)
itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions)
AdvancedTransform< TScalarType, NDimensions, NDimensions > Superclass
Image< BaseType, itkGetStaticConstMacro(SpaceDimension) > ImageBaseType
void GetJacobianOfSpatialJacobian(const InputPointType &, SpatialJacobianType &, JacobianOfSpatialJacobianType &, NonZeroJacobianIndicesType &) const override
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const override
itkStaticConstMacro(SplineOrder, unsigned int, VSplineOrder)
virtual NumberOfParametersType GetNumberOfParametersPerDimension(void) const
void GetSpatialHessian(const InputPointType &ipp, SpatialHessianType &sh) const override
const ParametersType & GetParameters(void) const override
Vector< TScalarType, itkGetStaticConstMacro(SpaceDimension) > VectorType
virtual SpacingType GetGridSpacing(void) const
void GetJacobianOfSpatialHessian(const InputPointType &ipp, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
void SetLabels(ImageLabelType *labels)
void GetJacobianOfSpatialJacobian(const InputPointType &ipp, JacobianOfSpatialJacobianType &jsj, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
Image< unsigned char, itkGetStaticConstMacro(SpaceDimension) > ImageLabelType
OutputPointType TransformPoint(const InputPointType &point) const override
AdvancedBSplineDeformableTransform< TScalarType, itkGetStaticConstMacro(SpaceDimension), itkGetStaticConstMacro(SplineOrder) > TransformType
void SetParametersByValue(const ParametersType &parameters) override
BSplineInterpolationWeightFunction2< ScalarType, itkGetStaticConstMacro(SpaceDimension), itkGetStaticConstMacro(SplineOrder) > WeightsFunctionType
OutputVnlVectorType TransformVector(const InputVnlVectorType &) const override
virtual RegionType GetGridRegion(void) const
virtual void SetGridSpacing(const SpacingType &spacing)
virtual OriginType GetGridOrigin(void) const
Image< VectorType, itkGetStaticConstMacro(SpaceDimension) > ImageVectorType
void PrintSelf(std::ostream &os, Indent indent) const override
OutputVectorType TransformVector(const InputVectorType &) const override
const ParametersType & GetFixedParameters(void) const override
itk::NearestNeighborInterpolateImageFunction< ImageLabelType, TScalarType > ImageLabelInterpolator
ImageRegion< itkGetStaticConstMacro(SpaceDimension) > RegionType
NumberOfParametersType GetNumberOfNonZeroJacobianIndices(void) const override
virtual void SetGridRegion(const RegionType &region)


Generated on 1667476801 for elastix by doxygen 1.9.4 elastix logo