Loading...
Searching...
No Matches
itkAdvancedIdentityTransform.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: itkIdentityTransform.h,v $
Date: $Date: 2009-06-28 14:41:47 $
Version: $Revision: 1.19 $
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 itkAdvancedIdentityTransform_h
#define itkAdvancedIdentityTransform_h
#include "itkObject.h"
#include "itkPoint.h"
#include "itkVector.h"
#include "itkCovariantVector.h"
#include <vnl/vnl_vector_fixed.h>
#include "itkArray.h"
#include "itkArray2D.h"
#include "itkAdvancedTransform.h"
#include "itkObjectFactory.h"
#include <numeric> // For iota.
namespace itk
{
template <class TScalarType, unsigned int NDimensions = 3>
class ITK_TEMPLATE_EXPORT AdvancedIdentityTransform : public AdvancedTransform<TScalarType, NDimensions, NDimensions>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(AdvancedIdentityTransform);
using Self = AdvancedIdentityTransform;
using Superclass = AdvancedTransform<TScalarType, NDimensions, NDimensions>;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;
itkNewMacro(Self);
itkTypeMacro(AdvancedIdentityTransform, AdvancedTransform);
itkStaticConstMacro(InputSpaceDimension, unsigned int, NDimensions);
itkStaticConstMacro(OutputSpaceDimension, unsigned int, NDimensions);
itkStaticConstMacro(ParametersDimension, unsigned int, 1);
using ScalarType = TScalarType;
using typename Superclass::ParametersType;
using typename Superclass::NumberOfParametersType;
using typename Superclass::TransformCategoryEnum;
using typename Superclass::JacobianType;
using InputVectorType = Vector<TScalarType, Self::InputSpaceDimension>;
using OutputVectorType = Vector<TScalarType, Self::OutputSpaceDimension>;
using InputCovariantVectorType = CovariantVector<TScalarType, Self::InputSpaceDimension>;
using OutputCovariantVectorType = CovariantVector<TScalarType, Self::OutputSpaceDimension>;
using InputVnlVectorType = vnl_vector_fixed<TScalarType, Self::InputSpaceDimension>;
using OutputVnlVectorType = vnl_vector_fixed<TScalarType, Self::OutputSpaceDimension>;
using InputPointType = Point<TScalarType, Self::InputSpaceDimension>;
using OutputPointType = Point<TScalarType, Self::OutputSpaceDimension>;
using InverseTransformBaseType = typename Superclass::InverseTransformBaseType;
using InverseTransformBasePointer = typename InverseTransformBaseType::Pointer;
using typename Superclass::NonZeroJacobianIndicesType;
using typename Superclass::SpatialJacobianType;
using typename Superclass::JacobianOfSpatialJacobianType;
using typename Superclass::SpatialHessianType;
using typename Superclass::JacobianOfSpatialHessianType;
using typename Superclass::InternalMatrixType;
OutputPointType
TransformPoint(const InputPointType & point) const override
{
return point;
}
OutputVectorType
TransformVector(const InputVectorType & vector) const override
{
return vector;
}
OutputVnlVectorType
TransformVector(const InputVnlVectorType & vector) const override
{
return vector;
}
OutputCovariantVectorType
TransformCovariantVector(const InputCovariantVectorType & vector) const override
{
return vector;
}
void
SetIdentity()
{}
InverseTransformBasePointer
GetInverseTransform() const override
{
return this->New().GetPointer();
}
bool
IsLinear() const override
{
return true;
}
TransformCategoryEnum
GetTransformCategory() const override
{
return TransformCategoryEnum::Linear;
}
const ParametersType &
GetFixedParameters() const override
{
return this->m_FixedParameters;
}
void
SetFixedParameters(const ParametersType &) override
{}
const ParametersType &
GetParameters() const override
{
return this->m_Parameters;
}
void
SetParameters(const ParametersType &) override
{}
void
GetJacobian(const InputPointType &,
JacobianType & j,
NonZeroJacobianIndicesType & nonZeroJacobianIndices) const override
{
j = this->m_LocalJacobian;
nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
}
void
GetSpatialJacobian(const InputPointType &, SpatialJacobianType & sj) const override
{
sj = this->m_SpatialJacobian;
}
void
GetSpatialHessian(const InputPointType &, SpatialHessianType & sh) const override
{
sh = this->m_SpatialHessian;
}
void
GetJacobianOfSpatialJacobian(const InputPointType &,
JacobianOfSpatialJacobianType & jsj,
NonZeroJacobianIndicesType & nonZeroJacobianIndices) const override
{
jsj = this->m_JacobianOfSpatialJacobian;
nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
}
void
GetJacobianOfSpatialJacobian(const InputPointType &,
SpatialJacobianType & sj,
JacobianOfSpatialJacobianType & jsj,
NonZeroJacobianIndicesType & nonZeroJacobianIndices) const override
{
sj = this->m_SpatialJacobian;
jsj = this->m_JacobianOfSpatialJacobian;
nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
}
void
GetJacobianOfSpatialHessian(const InputPointType &,
JacobianOfSpatialHessianType & jsh,
NonZeroJacobianIndicesType & nonZeroJacobianIndices) const override
{
jsh = this->m_JacobianOfSpatialHessian;
nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
}
void
GetJacobianOfSpatialHessian(const InputPointType &,
SpatialHessianType & sh,
JacobianOfSpatialHessianType & jsh,
NonZeroJacobianIndicesType & nonZeroJacobianIndices) const override
{
sh = this->m_SpatialHessian;
jsh = this->m_JacobianOfSpatialHessian;
nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
}
protected:
AdvancedIdentityTransform()
: AdvancedTransform<TScalarType, NDimensions, NDimensions>(NDimensions)
{
// The Jacobian is constant, therefore it can be initialized in the constructor.
this->m_LocalJacobian = JacobianType(NDimensions, 1, 0.0);
this->m_SpatialJacobian.SetIdentity();
this->m_NonZeroJacobianIndices.resize(ParametersDimension);
std::iota(m_NonZeroJacobianIndices.begin(), m_NonZeroJacobianIndices.end(), 0u);
this->m_HasNonZeroSpatialHessian = false;
this->m_HasNonZeroJacobianOfSpatialHessian = false;
this->m_JacobianOfSpatialJacobian.resize(ParametersDimension);
this->m_JacobianOfSpatialHessian.resize(ParametersDimension);
}
~AdvancedIdentityTransform() override = default;
private:
// Private using-declarations, to avoid `-Woverloaded-virtual` warnings from GCC (GCC 11.4).
using Superclass::TransformVector;
using Superclass::TransformCovariantVector;
JacobianType m_LocalJacobian{};
SpatialJacobianType m_SpatialJacobian{};
SpatialHessianType m_SpatialHessian{};
NonZeroJacobianIndicesType m_NonZeroJacobianIndices{};
JacobianOfSpatialJacobianType m_JacobianOfSpatialJacobian{};
JacobianOfSpatialHessianType m_JacobianOfSpatialHessian{};
};
} // end namespace itk
#endif
TScalarType
itk::AdvancedIdentityTransform::Superclass
AdvancedTransform< TScalarType, NDimensions, NDimensions > Superclass
Definition itkAdvancedIdentityTransform.h:79
itk::AdvancedIdentityTransform::TransformCovariantVector
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &vector) const override
Definition itkAdvancedIdentityTransform.h:157
itk::AdvancedIdentityTransform::SpatialJacobianType
Matrix< ScalarType, OutputSpaceDimension, InputSpaceDimension > SpatialJacobianType
Definition itkAdvancedTransform.h:134
itk::AdvancedIdentityTransform::InverseTransformBasePointer
typename InverseTransformBaseType::Pointer InverseTransformBasePointer
Definition itkAdvancedIdentityTransform.h:124
itk::AdvancedIdentityTransform::OutputVectorType
Vector< TScalarType, Self::OutputSpaceDimension > OutputVectorType
Definition itkAdvancedIdentityTransform.h:107
itk::AdvancedIdentityTransform::InverseTransformBaseType
typename Superclass::InverseTransformBaseType InverseTransformBaseType
Definition itkAdvancedIdentityTransform.h:123
itk::AdvancedIdentityTransform::AdvancedIdentityTransform
AdvancedIdentityTransform()
Definition itkAdvancedIdentityTransform.h:303
itk::AdvancedIdentityTransform::Self
AdvancedIdentityTransform Self
Definition itkAdvancedIdentityTransform.h:78
itk::AdvancedIdentityTransform::JacobianOfSpatialHessianType
std::vector< SpatialHessianType > JacobianOfSpatialHessianType
Definition itkAdvancedTransform.h:139
itk::AdvancedIdentityTransform::InputVectorType
Vector< TScalarType, Self::InputSpaceDimension > InputVectorType
Definition itkAdvancedIdentityTransform.h:106
itk::AdvancedIdentityTransform::InputPointType
Point< TScalarType, Self::InputSpaceDimension > InputPointType
Definition itkAdvancedIdentityTransform.h:118
itk::AdvancedIdentityTransform::GetSpatialJacobian
void GetSpatialJacobian(const InputPointType &, SpatialJacobianType &sj) const override
Definition itkAdvancedIdentityTransform.h:238
itk::AdvancedIdentityTransform::ConstPointer
SmartPointer< const Self > ConstPointer
Definition itkAdvancedIdentityTransform.h:81
itk::AdvancedIdentityTransform::GetInverseTransform
InverseTransformBasePointer GetInverseTransform() const override
Definition itkAdvancedIdentityTransform.h:172
itk::AdvancedIdentityTransform::GetFixedParameters
const ParametersType & GetFixedParameters() const override
Definition itkAdvancedIdentityTransform.h:201
itk::AdvancedIdentityTransform::TransformVector
OutputVectorType TransformVector(const InputVectorType &vector) const override
Definition itkAdvancedIdentityTransform.h:143
itk::AdvancedIdentityTransform::itkStaticConstMacro
itkStaticConstMacro(OutputSpaceDimension, unsigned int, NDimensions)
itk::AdvancedIdentityTransform::m_SpatialJacobian
SpatialJacobianType m_SpatialJacobian
Definition itkAdvancedIdentityTransform.h:334
itk::AdvancedIdentityTransform::GetJacobian
void GetJacobian(const InputPointType &, JacobianType &j, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
Definition itkAdvancedIdentityTransform.h:227
itk::AdvancedIdentityTransform::itkStaticConstMacro
itkStaticConstMacro(InputSpaceDimension, unsigned int, NDimensions)
itk::AdvancedIdentityTransform::JacobianOfSpatialJacobianType
std::vector< SpatialJacobianType > JacobianOfSpatialJacobianType
Definition itkAdvancedTransform.h:135
itk::AdvancedIdentityTransform::m_SpatialHessian
SpatialHessianType m_SpatialHessian
Definition itkAdvancedIdentityTransform.h:335
itk::AdvancedIdentityTransform::OutputPointType
Point< TScalarType, Self::OutputSpaceDimension > OutputPointType
Definition itkAdvancedIdentityTransform.h:119
itk::AdvancedIdentityTransform::~AdvancedIdentityTransform
~AdvancedIdentityTransform() override=default
itk::AdvancedIdentityTransform::ScalarType
TScalarType ScalarType
Definition itkAdvancedIdentityTransform.h:95
itk::AdvancedIdentityTransform::m_JacobianOfSpatialJacobian
JacobianOfSpatialJacobianType m_JacobianOfSpatialJacobian
Definition itkAdvancedIdentityTransform.h:337
itk::AdvancedIdentityTransform::GetJacobianOfSpatialJacobian
void GetJacobianOfSpatialJacobian(const InputPointType &, SpatialJacobianType &sj, JacobianOfSpatialJacobianType &jsj, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
Definition itkAdvancedIdentityTransform.h:265
itk::AdvancedIdentityTransform::OutputCovariantVectorType
CovariantVector< TScalarType, Self::OutputSpaceDimension > OutputCovariantVectorType
Definition itkAdvancedIdentityTransform.h:111
itk::AdvancedIdentityTransform::GetParameters
const ParametersType & GetParameters() const override
Definition itkAdvancedIdentityTransform.h:214
itk::AdvancedIdentityTransform::SetParameters
void SetParameters(const ParametersType &) override
Definition itkAdvancedIdentityTransform.h:222
itk::AdvancedIdentityTransform::SpatialHessianType
FixedArray< Matrix< ScalarType, InputSpaceDimension, InputSpaceDimension >, OutputSpaceDimension > SpatialHessianType
Definition itkAdvancedTransform.h:137
itk::AdvancedIdentityTransform::TransformPoint
OutputPointType TransformPoint(const InputPointType &point) const override
Definition itkAdvancedIdentityTransform.h:136
itk::AdvancedIdentityTransform::NonZeroJacobianIndicesType
std::vector< unsigned long > NonZeroJacobianIndicesType
Definition itkAdvancedTransform.h:133
itk::AdvancedIdentityTransform::InputVnlVectorType
vnl_vector_fixed< TScalarType, Self::InputSpaceDimension > InputVnlVectorType
Definition itkAdvancedIdentityTransform.h:114
itk::AdvancedIdentityTransform::ITK_DISALLOW_COPY_AND_MOVE
ITK_DISALLOW_COPY_AND_MOVE(AdvancedIdentityTransform)
itk::AdvancedIdentityTransform::GetJacobianOfSpatialJacobian
void GetJacobianOfSpatialJacobian(const InputPointType &, JacobianOfSpatialJacobianType &jsj, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
Definition itkAdvancedIdentityTransform.h:254
itk::AdvancedIdentityTransform::m_LocalJacobian
JacobianType m_LocalJacobian
Definition itkAdvancedIdentityTransform.h:333
itk::AdvancedIdentityTransform::SetIdentity
void SetIdentity()
Definition itkAdvancedIdentityTransform.h:167
itk::AdvancedIdentityTransform::GetSpatialHessian
void GetSpatialHessian(const InputPointType &, SpatialHessianType &sh) const override
Definition itkAdvancedIdentityTransform.h:246
itk::AdvancedIdentityTransform::m_JacobianOfSpatialHessian
JacobianOfSpatialHessianType m_JacobianOfSpatialHessian
Definition itkAdvancedIdentityTransform.h:338
itk::AdvancedIdentityTransform::IsLinear
bool IsLinear() const override
Definition itkAdvancedIdentityTransform.h:184
itk::AdvancedIdentityTransform::New
static Pointer New()
itk::AdvancedIdentityTransform::GetTransformCategory
TransformCategoryEnum GetTransformCategory() const override
Definition itkAdvancedIdentityTransform.h:193
itk::AdvancedIdentityTransform::Pointer
SmartPointer< Self > Pointer
Definition itkAdvancedIdentityTransform.h:80
itk::AdvancedIdentityTransform::GetJacobianOfSpatialHessian
void GetJacobianOfSpatialHessian(const InputPointType &, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
Definition itkAdvancedIdentityTransform.h:278
itk::AdvancedIdentityTransform::SetFixedParameters
void SetFixedParameters(const ParametersType &) override
Definition itkAdvancedIdentityTransform.h:209
itk::AdvancedIdentityTransform::InputCovariantVectorType
CovariantVector< TScalarType, Self::InputSpaceDimension > InputCovariantVectorType
Definition itkAdvancedIdentityTransform.h:110
itk::AdvancedIdentityTransform::itkStaticConstMacro
itkStaticConstMacro(ParametersDimension, unsigned int, 1)
itk::AdvancedIdentityTransform::GetJacobianOfSpatialHessian
void GetJacobianOfSpatialHessian(const InputPointType &, SpatialHessianType &sh, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
Definition itkAdvancedIdentityTransform.h:291
itk::AdvancedIdentityTransform::m_NonZeroJacobianIndices
NonZeroJacobianIndicesType m_NonZeroJacobianIndices
Definition itkAdvancedIdentityTransform.h:336
itk::AdvancedIdentityTransform::TransformVector
OutputVnlVectorType TransformVector(const InputVnlVectorType &vector) const override
Definition itkAdvancedIdentityTransform.h:150
itk::AdvancedIdentityTransform::OutputVnlVectorType
vnl_vector_fixed< TScalarType, Self::OutputSpaceDimension > OutputVnlVectorType
Definition itkAdvancedIdentityTransform.h:115
itk::AdvancedTransform< TScalarType, NDimensions, NDimensions >::InternalMatrixType
typename SpatialJacobianType::InternalMatrixType InternalMatrixType
Definition itkAdvancedTransform.h:140
itk::AdvancedTransform< TScalarType, NDimensions, NDimensions >::InverseTransformBaseType
typename Superclass::InverseTransformBaseType InverseTransformBaseType
Definition itkAdvancedTransform.h:121
itk::AdvancedTransform< TScalarType, NDimensions, NDimensions >::SpatialHessianType
FixedArray< Matrix< ScalarType, InputSpaceDimension, InputSpaceDimension >, OutputSpaceDimension > SpatialHessianType
Definition itkAdvancedTransform.h:137
itk::AdvancedTransform< TScalarType, NDimensions, NDimensions >::SpatialJacobianType
Matrix< ScalarType, OutputSpaceDimension, InputSpaceDimension > SpatialJacobianType
Definition itkAdvancedTransform.h:134
itk::AdvancedTransform< TScalarType, 3, 3 >::m_HasNonZeroSpatialHessian
bool m_HasNonZeroSpatialHessian
Definition itkAdvancedTransform.h:303
itk::AdvancedTransform< TScalarType, NDimensions, NDimensions >::JacobianOfSpatialHessianType
std::vector< SpatialHessianType > JacobianOfSpatialHessianType
Definition itkAdvancedTransform.h:139
itk::AdvancedTransform< TScalarType, 3, 3 >::m_HasNonZeroJacobianOfSpatialHessian
bool m_HasNonZeroJacobianOfSpatialHessian
Definition itkAdvancedTransform.h:304
itk::AdvancedTransform< TScalarType, NDimensions, NDimensions >::JacobianOfSpatialJacobianType
std::vector< SpatialJacobianType > JacobianOfSpatialJacobianType
Definition itkAdvancedTransform.h:135
itk::AdvancedTransform< TScalarType, 3, 3 >::AdvancedTransform
AdvancedTransform()=default
itk::AdvancedTransform< TScalarType, NDimensions, NDimensions >::NonZeroJacobianIndicesType
std::vector< unsigned long > NonZeroJacobianIndicesType
Definition itkAdvancedTransform.h:133
itkAdvancedTransform.h
itk
Definition itkAdvancedImageToImageMetric.h:43

Generated on 1768596610 for elastix by 1.15.0 |