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_det.h" 28 #include "vnl/vnl_vector_fixed_ref.h" 29 #include "vnl/vnl_vector.h" 34 #include "itk_minc2.h" 47 template<
typename TParametersValueType=
double,
unsigned int NInputDimensions=3,
unsigned int NOutputDimensions=3>
106 virtual OutputPointType
TransformPoint(
const InputPointType &point )
const ITK_OVERRIDE
120 general_transform_point((
m_Invert ? &
m_Xfm_inv : &
m_Xfm), point[0], point[1], point[2], &pnt[0], &pnt[1], &pnt[2]);
130 const double delta=1
e-4;
132 general_transform_point((
m_Invert ? &
m_Xfm_inv : &
m_Xfm) , orig[0]-delta, orig[1], orig[2],&u1, &v1, &w1);
133 general_transform_point((
m_Invert ? &
m_Xfm_inv : &m_Xfm) , orig[0]+delta, orig[1], orig[2],&u2, &v2, &w2);
134 m(0,0)=(u2-u1)/(2*delta);
135 m(0,1)=(v2-v1)/(2*delta);
136 m(0,2)=(w2-w1)/(2*delta);
138 general_transform_point((
m_Invert ? &
m_Xfm_inv : &m_Xfm) , orig[0], orig[1]-delta, orig[2],&u1, &v1, &w1);
139 general_transform_point((
m_Invert ? &
m_Xfm_inv : &m_Xfm) , orig[0], orig[1]+delta, orig[2],&u2, &v2, &w2);
140 m(1,0)=(u2-u1)/(2*delta);
141 m(1,1)=(v2-v1)/(2*delta);
142 m(1,2)=(w2-w1)/(2*delta);
144 general_transform_point((
m_Invert ? &
m_Xfm_inv : &m_Xfm), orig[0], orig[1], orig[2]-delta,&u1, &v1, &w1);
145 general_transform_point((
m_Invert ? &
m_Xfm_inv : &m_Xfm), orig[0], orig[1], orig[2]+delta,&u2, &v2, &w2);
146 m(2,0)=(u2-u1)/(2*delta);
147 m(2,1)=(v2-v1)/(2*delta);
148 m(2,2)=(w2-w1)/(2*delta);
152 OutputVectorType
TransformVector(
const InputVectorType& vector,
const InputPointType & ) const ITK_OVERRIDE
154 itkExceptionMacro( <<
"Not Implemented" );
160 OutputVnlVectorType
TransformVector(
const InputVnlVectorType& vector,
const InputPointType & ) const ITK_OVERRIDE
162 itkExceptionMacro( <<
"Not Implemented" );
174 OutputVnlVectorType
TransformVector(
const InputVnlVectorType& vector)
const ITK_OVERRIDE
180 OutputVectorPixelType
TransformVector(
const InputVectorPixelType& vector)
const ITK_OVERRIDE
187 const InputVectorPixelType& vector,
188 const InputPointType & ) const ITK_OVERRIDE
190 itkExceptionMacro( <<
"Not Implemented" );
197 const InputCovariantVectorType &vector
198 ,
const InputPointType & ) const ITK_OVERRIDE
200 itkExceptionMacro( <<
"Not Implemented" );
207 const InputCovariantVectorType &vector)
const ITK_OVERRIDE
214 const InputVectorPixelType &vector)
const ITK_OVERRIDE
221 const InputVectorPixelType &vector,
const InputPointType & ) const ITK_OVERRIDE
223 itkExceptionMacro( <<
"Not Implemented" );
237 itkExceptionMacro( <<
"Not Implemented" );
241 const InputPointType &,
242 JacobianType &) const ITK_OVERRIDE
244 itkExceptionMacro( <<
"Not Implemented" );
250 itkExceptionMacro( <<
"Not Defined" );
258 itkExceptionMacro( <<
"Not Implemented" );
263 itkExceptionMacro( <<
"Not Implemented" );
270 if(input_transform_file((
char*)xfm, &
m_Xfm) != VIO_OK)
271 itkExceptionMacro( <<
"Error reading XFM:" << xfm );
278 itkExceptionMacro( <<
"XFM not initialized" );
289 Transform<TParametersValueType, NInputDimensions, NOutputDimensions>(0),
294 if(NInputDimensions!=3 || NOutputDimensions!=3)
295 itkExceptionMacro(<<
"Sorry, only 3D to 3d minc xfm transform is currently implemented");
307 delete_general_transform(&
m_Xfm);
319 mutable VIO_General_transform
m_Xfm;
328 void operator= ( const Self & ) ITK_DELETE_FUNCTION;
332 #endif //itkMINCTransformAdapter_h
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes...
static ITK_CONSTEXPR double e
The base of the natural logarithm or Euler's number
Represents an array whose length can be defined at run-time.
A templated class holding a geometric point in n-Dimensional space.
A templated class holding a n-Dimensional covariant vector.