go home Home | Main Page | Topics | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Loading...
Searching...
No Matches
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{
37
38template <typename 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
105 void
106 SetParameters(const ParametersType & parameters) override;
107
123 void
124 SetFixedParameters(const ParametersType & parameters) override;
125
142 void
143 SetParametersByValue(const ParametersType & parameters) override;
144
153 void
155
157 const ParametersType &
158 GetParameters() const override;
159
161 const ParametersType &
162 GetFixedParameters() const override;
163
165 using PixelType = typename ParametersType::ValueType;
166 using ImageType = Image<PixelType, Self::SpaceDimension>;
167 using ImagePointer = typename ImageType::Pointer;
168
170 // virtual ImagePointer * GetCoefficientImage()
171 // { return this->m_CoefficientImage; }
172 // virtual const ImagePointer * GetCoefficientImage() const
173 // { return this->m_CoefficientImage; }
174
186 // virtual void SetCoefficientImage( ImagePointer images[] );
187
189 using RegionType = ImageRegion<Self::SpaceDimension>;
190
191 using IndexType = typename RegionType::IndexType;
192 using SizeType = typename RegionType::SizeType;
193 using SpacingType = typename ImageBase<NDimensions>::SpacingType;
194 using DirectionType = typename ImageType::DirectionType;
195 using OriginType = typename ImageType::PointType;
197
199 virtual void
200 SetGridRegion(const RegionType & region);
201
202 virtual RegionType
204
206 virtual void
207 SetGridSpacing(const SpacingType & spacing);
208
209 virtual SpacingType
211
213 virtual void
215
216 virtual DirectionType
218
220 virtual void
221 SetGridOrigin(const OriginType & origin);
222
223 virtual OriginType
225
227 using ImageLabelType = Image<unsigned char, Self::SpaceDimension>;
228 using ImageLabelPointer = typename ImageLabelType::Pointer;
229
230 using ImageLabelInterpolator = itk::NearestNeighborInterpolateImageFunction<ImageLabelType, TScalarType>;
231 using ImageLabelInterpolatorPointer = typename ImageLabelInterpolator::Pointer;
232
234 using VectorType = Vector<TScalarType, Self::SpaceDimension>;
235 using BaseType = Vector<VectorType, Self::SpaceDimension>;
236 using ImageVectorType = Image<VectorType, Self::SpaceDimension>;
237 using ImageVectorPointer = typename ImageVectorType::Pointer;
238 using ImageBaseType = Image<BaseType, Self::SpaceDimension>;
239 using ImageBasePointer = typename ImageBaseType::Pointer;
240
242 void
244
245 itkGetConstMacro(Labels, ImageLabelType *);
246
247 itkGetConstMacro(NbLabels, unsigned char);
248
250 void
252
253 itkGetConstMacro(LocalBases, ImageBaseType *);
254
256 using ParameterIndexArrayType = Array<unsigned long>;
257
261 OutputVectorType
262 TransformVector(const InputVectorType &) const override
263 {
264 itkExceptionMacro("Method not applicable for deformable transform.");
265 return OutputVectorType();
266 }
267
268
272 OutputVnlVectorType
273 TransformVector(const InputVnlVectorType &) const override
274 {
275 itkExceptionMacro("Method not applicable for deformable transform. ");
276 return OutputVnlVectorType();
277 }
278
279
283 OutputCovariantVectorType
284 TransformCovariantVector(const InputCovariantVectorType &) const override
285 {
286 itkExceptionMacro("Method not applicable for deformable transform. ");
287 return OutputCovariantVectorType();
288 }
289
290
292 NumberOfParametersType
293 GetNumberOfParameters() const override;
294
296 virtual NumberOfParametersType
298
304 bool
305 IsLinear() const override
306 {
307 return false;
308 }
309
310
311 virtual unsigned int
313 {
314 return NumberOfWeights;
315 }
316
317
318 NumberOfParametersType
320 {
321 return NumberOfWeights * SpaceDimension;
322 }
323
324
326 virtual bool
328 {
329 return true;
330 }
331
332
333 virtual bool
335 {
336 return true;
337 }
338
339
340 bool
342 {
343 return true;
344 }
345
346
347 virtual bool
349 {
350 return true;
351 }
352
353
355 using ContinuousIndexType = ContinuousIndex<ScalarType, SpaceDimension>;
356
358 OutputPointType
359 TransformPoint(const InputPointType & point) const override;
360
362 // virtual const JacobianType & GetJacobian( const InputPointType & point ) const;
363
365 void
366 GetJacobian(const InputPointType & inputPoint, JacobianType & j, NonZeroJacobianIndicesType &) const override;
367
369 void
370 GetSpatialJacobian(const InputPointType & inputPoint, SpatialJacobianType & sj) const override;
371
372 void
373 GetJacobianOfSpatialJacobian(const InputPointType & inputPoint,
375 NonZeroJacobianIndicesType & nonZeroJacobianIndices) const override;
376
377 void
378 GetJacobianOfSpatialJacobian(const InputPointType &,
381 NonZeroJacobianIndicesType &) const override;
382
384 void
385 GetSpatialHessian(const InputPointType & inputPoint, SpatialHessianType & sh) const override;
386
387 void
388 GetJacobianOfSpatialHessian(const InputPointType &,
390 NonZeroJacobianIndicesType &) const override
391 {
392 itkExceptionMacro("ERROR: GetJacobianOfSpatialHessian() not yet implemented in the "
393 "MultiBSplineDeformableTransformWithNormal class.");
394 }
395
396
397 void
398 GetJacobianOfSpatialHessian(const InputPointType &,
401 NonZeroJacobianIndicesType &) const override;
402
403protected:
405 void
406 PrintSelf(std::ostream & os, Indent indent) const override;
407
410
411private:
413 // void WrapAsImages();
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
460 const ParametersType * m_InputParametersPointer{};
461
465 // mutable IndexType m_LastJacobianIndex;
466
468 // ImagePointer m_WrappedImage[ NDimensions ];
469
472
474
475 unsigned char m_NbLabels{};
479 std::vector<typename TransformType::Pointer> m_Trans{};
480 std::vector<ParametersType> m_Para{};
481 mutable int m_LastJacobian{};
483
484 // Private using-declarations, to avoid `-Woverloaded-virtual` warnings from GCC (GCC 11.4).
485 using Superclass::TransformCovariantVector;
486 using Superclass::TransformVector;
487
490
491 void
492 DispatchParameters(const ParametersType & parameters);
493
494 void
495 PointToLabel(const InputPointType & p, int & l) const;
496};
497
498} // end namespace itk
499
500#ifndef ITK_MANUAL_INSTANTIATION
501# include "itkMultiBSplineDeformableTransformWithNormal.hxx"
502#endif
503
504#endif // end itkMultiBSplineDeformableTransformWithNormal_h
Deformable transform using a B-spline representation.
typename SpatialJacobianType::InternalMatrixType InternalMatrixType
FixedArray< Matrix< ScalarType, InputSpaceDimension, InputSpaceDimension >, OutputSpaceDimension > SpatialHessianType
Matrix< ScalarType, OutputSpaceDimension, InputSpaceDimension > SpatialJacobianType
std::vector< uint64_t > NonZeroJacobianIndicesType
std::vector< SpatialHessianType > JacobianOfSpatialHessianType
std::vector< SpatialJacobianType > JacobianOfSpatialJacobianType
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)
itkOverrideGetNameOfClassMacro(MultiBSplineDeformableTransformWithNormal)
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
AdvancedBSplineDeformableTransform< typename elx::TransformBase< TElastix >::CoordinateType, Self::SpaceDimension, VSplineOrder > TransformType
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const override
ITK_DISALLOW_COPY_AND_MOVE(MultiBSplineDeformableTransformWithNormal)
itkStaticConstMacro(SplineOrder, unsigned int, VSplineOrder)
itk::NearestNeighborInterpolateImageFunction< ImageLabelType, typename elx::TransformBase< TElastix >::CoordinateType > ImageLabelInterpolator
virtual SpacingType GetGridSpacing() const
void SetLabels(ImageLabelType *labels)
FixedArray< Matrix< ScalarType, InputSpaceDimension, InputSpaceDimension >, OutputSpaceDimension > SpatialHessianType
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 1774142652 for elastix by doxygen 1.15.0 elastix logo