Loading...
Searching...
No Matches
itkAdvancedTransform.h
Go to the documentation of this file.
/*=========================================================================
*
* Copyright UMC Utrecht and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkTransform.h,v $
Date: $Date: 2008-06-29 12:58:58 $
Version: $Revision: 1.64 $
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef itkAdvancedTransform_h
#define itkAdvancedTransform_h
#include "itkTransform.h"
#include "itkMatrix.h"
#include "itkFixedArray.h"
#include <cassert>
namespace itk
{
template <class TScalarType, unsigned int NInputDimensions = 3, unsigned int NOutputDimensions = 3>
class ITK_TEMPLATE_EXPORT AdvancedTransform : public Transform<TScalarType, NInputDimensions, NOutputDimensions>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(AdvancedTransform);
using Self = AdvancedTransform;
using Superclass = Transform<TScalarType, NInputDimensions, NOutputDimensions>;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;
// itkNewMacro( Self );
itkTypeMacro(AdvancedTransform, Transform);
itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions);
itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions);
using typename Superclass::ScalarType;
using typename Superclass::ParametersType;
using typename Superclass::FixedParametersType;
using typename Superclass::ParametersValueType;
using typename Superclass::NumberOfParametersType;
using typename Superclass::DerivativeType;
using typename Superclass::JacobianType;
using typename Superclass::InputVectorType;
using typename Superclass::OutputVectorType;
using typename Superclass::InputCovariantVectorType;
using typename Superclass::OutputCovariantVectorType;
using typename Superclass::InputVnlVectorType;
using typename Superclass::OutputVnlVectorType;
using typename Superclass::InputPointType;
using typename Superclass::OutputPointType;
using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
using typename Superclass::InverseTransformBasePointer;
using TransformType = Transform<TScalarType, NInputDimensions, NOutputDimensions>;
using TransformTypePointer = typename TransformType::Pointer;
using TransformTypeConstPointer = typename TransformType::ConstPointer;
using NonZeroJacobianIndicesType = std::vector<unsigned long>;
using SpatialJacobianType = Matrix<ScalarType, OutputSpaceDimension, InputSpaceDimension>;
using JacobianOfSpatialJacobianType = std::vector<SpatialJacobianType>;
// \todo: think about the SpatialHessian type, should be a 3D native type
using SpatialHessianType =
FixedArray<Matrix<ScalarType, InputSpaceDimension, InputSpaceDimension>, OutputSpaceDimension>;
using JacobianOfSpatialHessianType = std::vector<SpatialHessianType>;
using InternalMatrixType = typename SpatialJacobianType::InternalMatrixType;
using MovingImageGradientType = OutputCovariantVectorType;
using MovingImageGradientValueType = typename MovingImageGradientType::ValueType;
virtual NumberOfParametersType
GetNumberOfNonZeroJacobianIndices() const;
itkGetConstMacro(HasNonZeroSpatialHessian, bool);
itkGetConstMacro(HasNonZeroJacobianOfSpatialHessian, bool);
virtual void
GetJacobian(const InputPointType & inputPoint,
JacobianType & j,
NonZeroJacobianIndicesType & nonZeroJacobianIndices) const = 0;
virtual void
EvaluateJacobianWithImageGradientProduct(const InputPointType & inputPoint,
const MovingImageGradientType & movingImageGradient,
DerivativeType & imageJacobian,
NonZeroJacobianIndicesType & nonZeroJacobianIndices) const;
virtual void
GetSpatialJacobian(const InputPointType & inputPoint, SpatialJacobianType & sj) const = 0;
void
ComputeJacobianWithRespectToParameters(const InputPointType & itkNotUsed(p),
JacobianType & itkNotUsed(j)) const override
{
itkExceptionMacro("This ITK4 function is currently not used in elastix.");
}
virtual void
GetSpatialHessian(const InputPointType & inputPoint, SpatialHessianType & sh) const = 0;
virtual void
GetJacobianOfSpatialJacobian(const InputPointType & inputPoint,
JacobianOfSpatialJacobianType & jsj,
NonZeroJacobianIndicesType & nonZeroJacobianIndices) const = 0;
virtual void
GetJacobianOfSpatialJacobian(const InputPointType & inputPoint,
SpatialJacobianType & sj,
JacobianOfSpatialJacobianType & jsj,
NonZeroJacobianIndicesType & nonZeroJacobianIndices) const = 0;
virtual void
GetJacobianOfSpatialHessian(const InputPointType & inputPoint,
JacobianOfSpatialHessianType & jsh,
NonZeroJacobianIndicesType & nonZeroJacobianIndices) const = 0;
virtual void
GetJacobianOfSpatialHessian(const InputPointType & inputPoint,
SpatialHessianType & sh,
JacobianOfSpatialHessianType & jsh,
NonZeroJacobianIndicesType & nonZeroJacobianIndices) const = 0;
protected:
AdvancedTransform() = default;
// Inherit the other (non-default) constructor from itk::Transform.
using Superclass::Superclass;
~AdvancedTransform() override = default;
bool m_HasNonZeroSpatialHessian{ true };
bool m_HasNonZeroJacobianOfSpatialHessian{ true };
};
namespace ImplementationDetails
{
template <class TScalarType, unsigned int VInputVectorSize>
void
EvaluateInnerProduct(const vnl_matrix<TScalarType> & inputMatrix,
const CovariantVector<TScalarType, VInputVectorSize> & inputVector,
vnl_vector<TScalarType> & outputVector)
{
assert(inputMatrix.rows() == inputVector.size());
assert(inputMatrix.columns() == outputVector.size());
auto inputMatrixIterator = inputMatrix.begin();
outputVector.fill(0.0);
for (const double inputVectorElement : inputVector)
{
for (auto & outputVectorElement : outputVector)
{
outputVectorElement += (*inputMatrixIterator) * inputVectorElement;
++inputMatrixIterator;
}
}
}
} // namespace ImplementationDetails
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
# include "itkAdvancedTransform.hxx"
#endif
#endif
itk::AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension >::InternalMatrixType
typename SpatialJacobianType::InternalMatrixType InternalMatrixType
Definition itkAdvancedTransform.h:140
itk::AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension >::Pointer
SmartPointer< Self > Pointer
Definition itkAdvancedTransform.h:91
itk::AdvancedTransform::ITK_DISALLOW_COPY_AND_MOVE
ITK_DISALLOW_COPY_AND_MOVE(AdvancedTransform)
itk::AdvancedTransform::EvaluateJacobianWithImageGradientProduct
virtual void EvaluateJacobianWithImageGradientProduct(const InputPointType &inputPoint, const MovingImageGradientType &movingImageGradient, DerivativeType &imageJacobian, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const
itk::AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension >::InverseTransformBaseType
typename Superclass::InverseTransformBaseType InverseTransformBaseType
Definition itkAdvancedTransform.h:121
itk::AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension >::SpatialHessianType
FixedArray< Matrix< ScalarType, InputSpaceDimension, InputSpaceDimension >, OutputSpaceDimension > SpatialHessianType
Definition itkAdvancedTransform.h:137
itk::AdvancedTransform::GetSpatialHessian
virtual void GetSpatialHessian(const InputPointType &inputPoint, SpatialHessianType &sh) const =0
itk::AdvancedTransform::GetJacobian
virtual void GetJacobian(const InputPointType &inputPoint, JacobianType &j, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const =0
itk::AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension >::SpatialJacobianType
Matrix< ScalarType, OutputSpaceDimension, InputSpaceDimension > SpatialJacobianType
Definition itkAdvancedTransform.h:134
itk::AdvancedTransform::itkStaticConstMacro
itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions)
itk::AdvancedTransform::GetJacobianOfSpatialHessian
virtual void GetJacobianOfSpatialHessian(const InputPointType &inputPoint, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const =0
itk::AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension >::Superclass
Transform< ScalarType, NInputDimensions, NOutputDimensions > Superclass
Definition itkAdvancedTransform.h:90
itk::AdvancedTransform::ComputeJacobianWithRespectToParameters
void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType &) const override
Definition itkAdvancedTransform.h:229
itk::AdvancedTransform::GetNumberOfNonZeroJacobianIndices
virtual NumberOfParametersType GetNumberOfNonZeroJacobianIndices() const
itk::AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension >::m_HasNonZeroSpatialHessian
bool m_HasNonZeroSpatialHessian
Definition itkAdvancedTransform.h:303
itk::AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension >::ConstPointer
SmartPointer< const Self > ConstPointer
Definition itkAdvancedTransform.h:92
itk::AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension >::JacobianOfSpatialHessianType
std::vector< SpatialHessianType > JacobianOfSpatialHessianType
Definition itkAdvancedTransform.h:139
itk::AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension >::m_HasNonZeroJacobianOfSpatialHessian
bool m_HasNonZeroJacobianOfSpatialHessian
Definition itkAdvancedTransform.h:304
itk::AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension >::TransformTypePointer
typename TransformType::Pointer TransformTypePointer
Definition itkAdvancedTransform.h:126
itk::AdvancedTransform::GetJacobianOfSpatialJacobian
virtual void GetJacobianOfSpatialJacobian(const InputPointType &inputPoint, SpatialJacobianType &sj, JacobianOfSpatialJacobianType &jsj, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const =0
itk::AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension >::JacobianOfSpatialJacobianType
std::vector< SpatialJacobianType > JacobianOfSpatialJacobianType
Definition itkAdvancedTransform.h:135
itk::AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension >::TransformTypeConstPointer
typename TransformType::ConstPointer TransformTypeConstPointer
Definition itkAdvancedTransform.h:127
itk::AdvancedTransform::GetSpatialJacobian
virtual void GetSpatialJacobian(const InputPointType &inputPoint, SpatialJacobianType &sj) const =0
itk::AdvancedTransform::AdvancedTransform
AdvancedTransform()=default
itk::AdvancedTransform::~AdvancedTransform
~AdvancedTransform() override=default
itk::AdvancedTransform::itkStaticConstMacro
itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions)
itk::AdvancedTransform::GetJacobianOfSpatialHessian
virtual void GetJacobianOfSpatialHessian(const InputPointType &inputPoint, SpatialHessianType &sh, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const =0
itk::AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension >::MovingImageGradientValueType
typename MovingImageGradientType::ValueType MovingImageGradientValueType
Definition itkAdvancedTransform.h:148
itk::AdvancedTransform::GetJacobianOfSpatialJacobian
virtual void GetJacobianOfSpatialJacobian(const InputPointType &inputPoint, JacobianOfSpatialJacobianType &jsj, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const =0
itk::AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension >::NonZeroJacobianIndicesType
std::vector< unsigned long > NonZeroJacobianIndicesType
Definition itkAdvancedTransform.h:133
itk::AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension >::Self
AdvancedTransform Self
Definition itkAdvancedTransform.h:89
itk::AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension >::TransformType
Transform< ScalarType, NInputDimensions, NOutputDimensions > TransformType
Definition itkAdvancedTransform.h:125
itk::AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension >::MovingImageGradientType
OutputCovariantVectorType MovingImageGradientType
Definition itkAdvancedTransform.h:147
itk::ImplementationDetails
Definition itkAdvancedTransform.h:308
itk::ImplementationDetails::EvaluateInnerProduct
void EvaluateInnerProduct(const vnl_matrix< TScalarType > &inputMatrix, const CovariantVector< TScalarType, VInputVectorSize > &inputVector, vnl_vector< TScalarType > &outputVector)
Definition itkAdvancedTransform.h:312
itk
Definition itkAdvancedImageToImageMetric.h:43

Generated on 1768596610 for elastix by 1.15.0 |