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 ImageType::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
323 virtual unsigned long
325 {
326 return m_Trans[0]->m_WeightsFunction->GetNumberOfWeights();
327 }
328
329
330 virtual unsigned int
332 {
333 return m_Trans[0]->m_WeightsFunction->GetNumberOfWeights();
334 }
335
336
337 NumberOfParametersType
339 {
340 return m_Trans[0]->m_WeightsFunction->GetNumberOfWeights() * SpaceDimension;
341 }
342
343
345 virtual bool
347 {
348 return true;
349 }
350
351
352 virtual bool
354 {
355 return true;
356 }
357
358
359 bool
361 {
362 return true;
363 }
364
365
366 virtual bool
368 {
369 return true;
370 }
371
372
374 using ContinuousIndexType = ContinuousIndex<ScalarType, SpaceDimension>;
375
377 OutputPointType
378 TransformPoint(const InputPointType & point) const override;
379
381 // virtual const JacobianType & GetJacobian( const InputPointType & point ) const;
382
384 void
385 GetJacobian(const InputPointType & inputPoint, JacobianType & j, NonZeroJacobianIndicesType &) const override;
386
388 void
389 GetSpatialJacobian(const InputPointType & inputPoint, SpatialJacobianType & sj) const override;
390
391 void
392 GetJacobianOfSpatialJacobian(const InputPointType & inputPoint,
394 NonZeroJacobianIndicesType & nonZeroJacobianIndices) const override;
395
396 void
397 GetJacobianOfSpatialJacobian(const InputPointType &,
400 NonZeroJacobianIndicesType &) const override;
401
403 void
404 GetSpatialHessian(const InputPointType & inputPoint, SpatialHessianType & sh) const override;
405
406 void
407 GetJacobianOfSpatialHessian(const InputPointType & inputPoint,
409 NonZeroJacobianIndicesType & nonZeroJacobianIndices) const override
410 {
411 itkExceptionMacro(<< "ERROR: GetJacobianOfSpatialHessian() not yet implemented in the "
412 "MultiBSplineDeformableTransformWithNormal class.");
413 }
414
415
416 void
417 GetJacobianOfSpatialHessian(const InputPointType &,
420 NonZeroJacobianIndicesType &) const override;
421
422protected:
424 void
425 PrintSelf(std::ostream & os, Indent indent) const override;
426
429
431 // void WrapAsImages();
432
434 /*
435 void TransformPointToContinuousGridIndex(
436 const InputPointType & point, ContinuousIndexType & index ) const;
437
438 virtual void ComputeNonZeroJacobianIndices(
439 NonZeroJacobianIndicesType & nonZeroJacobianIndices,
440 const RegionType & supportRegion ) const;
441 */
442
444 // virtual bool InsideValidRegion( const ContinuousIndexType& index ) const;
445
447 // BulkTransformPointer m_BulkTransform;
448
451 // ImagePointer m_CoefficientImage[ NDimensions ];
452
454 // RegionType m_GridRegion;
455 // SpacingType m_GridSpacing;
456 // DirectionType m_GridDirection;
457 // OriginType m_GridOrigin;
458 // GridOffsetType m_GridOffsetTable;
459
460 // DirectionType m_PointToIndexMatrix;
461 // SpatialJacobianType m_PointToIndexMatrix2;
462 // DirectionType m_PointToIndexMatrixTransposed;
463 // SpatialJacobianType m_PointToIndexMatrixTransposed2;
464 // DirectionType m_IndexToPoint;
465
466 // RegionType m_ValidRegion;
467
469 // unsigned long m_Offset;
470 // SizeType m_SupportSize;
471 // ContinuousIndexType m_ValidRegionBegin;
472 // ContinuousIndexType m_ValidRegionEnd;
473
475 // bool m_SplineOrderOdd;
476
478 const ParametersType * m_InputParametersPointer;
479
481 /*
482 using JacobianPixelType = typename JacobianType::ValueType;
483 using JacobianImageType = Image< JacobianPixelType,
484 itkGetStaticConstMacro( SpaceDimension ) >;
485
486 typename JacobianImageType::Pointer m_JacobianImage[ NDimensions ];
487 */
488
492 // mutable IndexType m_LastJacobianIndex;
493
495 // ImagePointer m_WrappedImage[ NDimensions ];
496
499
501
502 unsigned char m_NbLabels;
506 std::vector<typename TransformType::Pointer> m_Trans;
507 std::vector<ParametersType> m_Para;
508 mutable int m_LastJacobian;
510
511private:
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
Matrix< ScalarType, OutputSpaceDimension, InputSpaceDimension > SpatialJacobianType
FixedArray< Matrix< ScalarType, InputSpaceDimension, InputSpaceDimension >, OutputSpaceDimension > SpatialHessianType
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 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
void GetJacobianOfSpatialHessian(const InputPointType &inputPoint, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
NumberOfParametersType GetNumberOfParameters() const override
virtual NumberOfParametersType GetNumberOfParametersPerDimension() const
virtual DirectionType GetGridDirection() const
virtual void SetGridRegion(const RegionType &region)


Generated on 2023-01-13 for elastix by doxygen 1.9.6 elastix logo