18#ifndef itkMINCTransformAdapter_h
19#define itkMINCTransformAdapter_h
25#include "vnl/vnl_matrix_fixed.h"
26#include "vnl/vnl_vector_fixed.h"
27#include "vnl/vnl_vector_fixed_ref.h"
28#include "vnl/vnl_vector.h"
47template <
typename TParametersValueType =
double,
unsigned int VInputDimension = 3,
unsigned int VOutputDimension = 3>
49 :
public Transform<TParametersValueType, VInputDimension, VOutputDimension>
122 general_transform_point((
m_Invert ? &
m_Xfm_inv : &
m_Xfm), point[0], point[1], point[2], &pnt[0], &pnt[1], &pnt[2]);
133 constexpr double delta{ 1e-4 };
135 general_transform_point((
m_Invert ? &
m_Xfm_inv : &
m_Xfm), orig[0] - delta, orig[1], orig[2], &u1, &v1, &w1);
136 general_transform_point((
m_Invert ? &
m_Xfm_inv : &
m_Xfm), orig[0] + delta, orig[1], orig[2], &u2, &v2, &w2);
137 m(0, 0) = (u2 - u1) / (2 * delta);
138 m(0, 1) = (v2 - v1) / (2 * delta);
139 m(0, 2) = (w2 - w1) / (2 * delta);
141 general_transform_point((
m_Invert ? &
m_Xfm_inv : &
m_Xfm), orig[0], orig[1] - delta, orig[2], &u1, &v1, &w1);
142 general_transform_point((
m_Invert ? &
m_Xfm_inv : &
m_Xfm), orig[0], orig[1] + delta, orig[2], &u2, &v2, &w2);
143 m(1, 0) = (u2 - u1) / (2 * delta);
144 m(1, 1) = (v2 - v1) / (2 * delta);
145 m(1, 2) = (w2 - w1) / (2 * delta);
147 general_transform_point((
m_Invert ? &
m_Xfm_inv : &
m_Xfm), orig[0], orig[1], orig[2] - delta, &u1, &v1, &w1);
148 general_transform_point((
m_Invert ? &
m_Xfm_inv : &
m_Xfm), orig[0], orig[1], orig[2] + delta, &u2, &v2, &w2);
149 m(2, 0) = (u2 - u1) / (2 * delta);
150 m(2, 1) = (v2 - v1) / (2 * delta);
151 m(2, 2) = (w2 - w1) / (2 * delta);
158 itkExceptionStringMacro(
"Not Implemented");
165 itkExceptionStringMacro(
"Not Implemented");
183 OutputVectorPixelType
190 OutputVectorPixelType
193 itkExceptionStringMacro(
"Not Implemented");
197 OutputCovariantVectorType
200 itkExceptionStringMacro(
"Not Implemented");
204 OutputCovariantVectorType
211 OutputVectorPixelType
218 OutputVectorPixelType
221 itkExceptionStringMacro(
"Not Implemented");
235 itkExceptionStringMacro(
"Not Implemented");
241 itkExceptionStringMacro(
"Not Implemented");
244 NumberOfParametersType
248 itkExceptionStringMacro(
"Not Defined");
256 itkExceptionStringMacro(
"Not Implemented");
259 const ParametersType &
262 itkExceptionStringMacro(
"Not Implemented");
269 if (input_transform_file(xfm, &
m_Xfm) != VIO_OK)
271 itkExceptionMacro(
"Error reading XFM:" << xfm);
281 itkExceptionStringMacro(
"XFM not initialized");
294 if constexpr (VInputDimension != 3 || VOutputDimension != 3)
296 itkExceptionStringMacro(
"MINC transform is currently implemented only for 3D to 3D.");
307 delete_general_transform(&
m_Xfm);
319 mutable VIO_General_transform
m_Xfm{};
A templated class holding a n-Dimensional covariant vector.
A templated class holding a geometric point in n-Dimensional space.
Implements transparent reference counting.
A templated class holding a n-Dimensional vector.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....