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 <class TScalarType = double, // Data type for scalars
39 unsigned int NDimensions = 3, // Number of dimensions
40 unsigned int VSplineOrder = 3>
41// Spline order
43 : public AdvancedTransform<TScalarType, NDimensions, NDimensions>
44{
45public:
47
51 using Pointer = SmartPointer<Self>;
52 using ConstPointer = SmartPointer<const Self>;
53
55 itkNewMacro(Self);
56
59
61 itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions);
62
64 itkStaticConstMacro(SplineOrder, unsigned int, VSplineOrder);
65
67 using typename Superclass::ParametersType;
68 using typename Superclass::NumberOfParametersType;
69 using typename Superclass::JacobianType;
70 using typename Superclass::ScalarType;
71 using typename Superclass::InputPointType;
72 using typename Superclass::OutputPointType;
73 using typename Superclass::InputVectorType;
74 using typename Superclass::OutputVectorType;
75 using typename Superclass::InputVnlVectorType;
76 using typename Superclass::OutputVnlVectorType;
77 using typename Superclass::InputCovariantVectorType;
78 using typename Superclass::OutputCovariantVectorType;
79
83 using typename Superclass::SpatialHessianType;
85 using typename Superclass::InternalMatrixType;
86
90
109 void
110 SetParameters(const ParametersType & parameters) override;
111
127 void
128 SetFixedParameters(const ParametersType & parameters) override;
129
146 void
147 SetParametersByValue(const ParametersType & parameters) override;
148
157 void
159
161 const ParametersType &
162 GetParameters() const override;
163
165 const ParametersType &
166 GetFixedParameters() const override;
167
169 using PixelType = typename ParametersType::ValueType;
171 using ImagePointer = typename ImageType::Pointer;
172
174 // virtual ImagePointer * GetCoefficientImage()
175 // { return this->m_CoefficientImage; }
176 // virtual const ImagePointer * GetCoefficientImage() const
177 // { return this->m_CoefficientImage; }
178
190 // virtual void SetCoefficientImage( ImagePointer images[] );
191
193 using RegionType = ImageRegion<Self::SpaceDimension>;
194
195 using IndexType = typename RegionType::IndexType;
196 using SizeType = typename RegionType::SizeType;
197 using SpacingType = typename ImageBase<NDimensions>::SpacingType;
198 using DirectionType = typename ImageType::DirectionType;
199 using OriginType = typename ImageType::PointType;
201
203 virtual void
204 SetGridRegion(const RegionType & region);
205
206 virtual RegionType
208
210 virtual void
211 SetGridSpacing(const SpacingType & spacing);
212
213 virtual SpacingType
215
217 virtual void
219
220 virtual DirectionType
222
224 virtual void
225 SetGridOrigin(const OriginType & origin);
226
227 virtual OriginType
229
232 using ImageLabelPointer = typename ImageLabelType::Pointer;
233
234 using ImageLabelInterpolator = itk::NearestNeighborInterpolateImageFunction<ImageLabelType, TScalarType>;
235 using ImageLabelInterpolatorPointer = typename ImageLabelInterpolator::Pointer;
236
238 using VectorType = Vector<TScalarType, Self::SpaceDimension>;
239 using BaseType = Vector<VectorType, Self::SpaceDimension>;
241 using ImageVectorPointer = typename ImageVectorType::Pointer;
243 using ImageBasePointer = typename ImageBaseType::Pointer;
244
246 void
248
249 itkGetConstMacro(Labels, ImageLabelType *);
250
251 itkGetConstMacro(NbLabels, unsigned char);
252
254 void
256
257 itkGetConstMacro(LocalBases, ImageBaseType *);
258
260 using ParameterIndexArrayType = Array<unsigned long>;
261
265 OutputVectorType
266 TransformVector(const InputVectorType &) const override
267 {
268 itkExceptionMacro("Method not applicable for deformable transform.");
269 return OutputVectorType();
270 }
271
272
276 OutputVnlVectorType
277 TransformVector(const InputVnlVectorType &) const override
278 {
279 itkExceptionMacro("Method not applicable for deformable transform. ");
280 return OutputVnlVectorType();
281 }
282
283
287 OutputCovariantVectorType
288 TransformCovariantVector(const InputCovariantVectorType &) const override
289 {
290 itkExceptionMacro("Method not applicable for deformable transform. ");
291 return OutputCovariantVectorType();
292 }
293
294
296 NumberOfParametersType
297 GetNumberOfParameters() const override;
298
300 virtual NumberOfParametersType
302
304 virtual const RegionType &
306 {
307 return m_Trans[0]->GetValidRegion();
308 }
309
310
316 bool
317 IsLinear() const override
318 {
319 return false;
320 }
321
322
323 virtual unsigned int
325 {
326 return NumberOfWeights;
327 }
328
329
330 NumberOfParametersType
332 {
333 return NumberOfWeights * SpaceDimension;
334 }
335
336
338 virtual bool
340 {
341 return true;
342 }
343
344
345 virtual bool
347 {
348 return true;
349 }
350
351
352 bool
354 {
355 return true;
356 }
357
358
359 virtual bool
361 {
362 return true;
363 }
364
365
367 using ContinuousIndexType = ContinuousIndex<ScalarType, SpaceDimension>;
368
370 OutputPointType
371 TransformPoint(const InputPointType & point) const override;
372
374 // virtual const JacobianType & GetJacobian( const InputPointType & point ) const;
375
377 void
378 GetJacobian(const InputPointType & inputPoint, JacobianType & j, NonZeroJacobianIndicesType &) const override;
379
381 void
382 GetSpatialJacobian(const InputPointType & inputPoint, SpatialJacobianType & sj) const override;
383
384 void
385 GetJacobianOfSpatialJacobian(const InputPointType & inputPoint,
387 NonZeroJacobianIndicesType & nonZeroJacobianIndices) const override;
388
389 void
390 GetJacobianOfSpatialJacobian(const InputPointType &,
393 NonZeroJacobianIndicesType &) const override;
394
396 void
397 GetSpatialHessian(const InputPointType & inputPoint, SpatialHessianType & sh) const override;
398
399 void
400 GetJacobianOfSpatialHessian(const InputPointType &,
402 NonZeroJacobianIndicesType &) const override
403 {
404 itkExceptionMacro("ERROR: GetJacobianOfSpatialHessian() not yet implemented in the "
405 "MultiBSplineDeformableTransformWithNormal class.");
406 }
407
408
409 void
410 GetJacobianOfSpatialHessian(const InputPointType &,
413 NonZeroJacobianIndicesType &) const override;
414
415protected:
417 void
418 PrintSelf(std::ostream & os, Indent indent) const override;
419
422
424 // void WrapAsImages();
425
427 /*
428 void TransformPointToContinuousGridIndex(
429 const InputPointType & point, ContinuousIndexType & index ) const;
430
431 virtual void ComputeNonZeroJacobianIndices(
432 NonZeroJacobianIndicesType & nonZeroJacobianIndices,
433 const RegionType & supportRegion ) const;
434 */
435
437 // virtual bool InsideValidRegion( const ContinuousIndexType& index ) const;
438
440 // BulkTransformPointer m_BulkTransform;
441
444 // ImagePointer m_CoefficientImage[ NDimensions ];
445
447 // RegionType m_GridRegion;
448 // SpacingType m_GridSpacing;
449 // DirectionType m_GridDirection;
450 // OriginType m_GridOrigin;
451 // GridOffsetType m_GridOffsetTable;
452
453 // DirectionType m_PointToIndexMatrix;
454 // SpatialJacobianType m_PointToIndexMatrix2;
455 // DirectionType m_PointToIndexMatrixTransposed;
456 // SpatialJacobianType m_PointToIndexMatrixTransposed2;
457 // DirectionType m_IndexToPoint;
458
459 // RegionType m_ValidRegion;
460
462 // unsigned long m_Offset;
463 // SizeType m_SupportSize;
464 // ContinuousIndexType m_ValidRegionBegin;
465 // ContinuousIndexType m_ValidRegionEnd;
466
468 // bool m_SplineOrderOdd;
469
471 const ParametersType * m_InputParametersPointer{};
472
474 /*
475 using JacobianPixelType = typename JacobianType::ValueType;
476 using JacobianImageType = Image< JacobianPixelType,
477 itkGetStaticConstMacro( SpaceDimension ) >;
478
479 typename JacobianImageType::Pointer m_JacobianImage[ NDimensions ]{};
480 */
481
485 // mutable IndexType m_LastJacobianIndex;
486
488 // ImagePointer m_WrappedImage[ NDimensions ];
489
491 ParametersType m_InternalParametersBuffer{};
492
494
495 unsigned char m_NbLabels{};
497 ImageLabelInterpolatorPointer m_LabelsInterpolator{};
498 ImageVectorPointer m_LabelsNormals{};
499 std::vector<typename TransformType::Pointer> m_Trans{};
500 std::vector<ParametersType> m_Para{};
501 mutable int m_LastJacobian{};
502 ImageBasePointer m_LocalBases{};
503
504private:
505 // Private using-declarations, to avoid `-Woverloaded-virtual` warnings from GCC (GCC 11.4).
506 using Superclass::TransformCovariantVector;
507 using Superclass::TransformVector;
508
510 static constexpr unsigned NumberOfWeights = TransformType::NumberOfWeights;
511
512 void
513 DispatchParameters(const ParametersType & parameters);
514
515 void
516 PointToLabel(const InputPointType & p, int & l) const;
517};
518
519} // end namespace itk
520
521#ifndef ITK_MANUAL_INSTANTIATION
522# include "itkMultiBSplineDeformableTransformWithNormal.hxx"
523#endif
524
525#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.
typename SpatialJacobianType::InternalMatrixType InternalMatrixType
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...
void SetFixedParameters(const ParametersType &parameters) override
virtual void SetGridDirection(const DirectionType &spacing)
void GetJacobianOfSpatialHessian(const InputPointType &, SpatialHessianType &, JacobianOfSpatialHessianType &, NonZeroJacobianIndicesType &) const override
void GetJacobian(const InputPointType &inputPoint, JacobianType &j, NonZeroJacobianIndicesType &) const override
void SetParameters(const ParametersType &parameters) override
void GetSpatialHessian(const InputPointType &inputPoint, SpatialHessianType &sh) 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)
void GetJacobianOfSpatialHessian(const InputPointType &, JacobianOfSpatialHessianType &, NonZeroJacobianIndicesType &) const override
void GetJacobianOfSpatialJacobian(const InputPointType &, SpatialJacobianType &, JacobianOfSpatialJacobianType &, NonZeroJacobianIndicesType &) const override
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const override
ITK_DISALLOW_COPY_AND_MOVE(MultiBSplineDeformableTransformWithNormal)
itkStaticConstMacro(SplineOrder, unsigned int, VSplineOrder)
itk::NearestNeighborInterpolateImageFunction< ImageLabelType, TScalarType > ImageLabelInterpolator
virtual SpacingType GetGridSpacing() const
void SetLabels(ImageLabelType *labels)
const ParametersType & GetFixedParameters() const override
OutputPointType TransformPoint(const InputPointType &point) const override
void SetParametersByValue(const ParametersType &parameters) override
const ParametersType & GetParameters() const override
OutputVnlVectorType TransformVector(const InputVnlVectorType &) const override
virtual void SetGridSpacing(const SpacingType &spacing)
void GetJacobianOfSpatialJacobian(const InputPointType &inputPoint, JacobianOfSpatialJacobianType &jsj, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
void GetSpatialJacobian(const InputPointType &inputPoint, SpatialJacobianType &sj) const override
~MultiBSplineDeformableTransformWithNormal() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
OutputVectorType TransformVector(const InputVectorType &) const override
NumberOfParametersType GetNumberOfParameters() const override
virtual NumberOfParametersType GetNumberOfParametersPerDimension() const
virtual DirectionType GetGridDirection() const
virtual void SetGridRegion(const RegionType &region)


Generated on 2024-07-17 for elastix by doxygen 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) elastix logo