zxhproj v 2.2
zxhproj
|
This class is used as FFD class base Free form deformation offset of control grid is Worldical offset(unit:mm) ADD: m_ImageInfo for conversion between control grid index and world coordinate; NOTICE: imageinfo's quaternion parameters always same as test image, if different, will be re-set using test image's quaternion para when SetImage save ffd: zxhTransformBase::string, then FFD control point offsets, finally quaternion parameters read ffd: zxhTransformBase::string, then FFD control point offsets, finally quaternion parameters if no gridtoworld matrix available, set to identity*spacing Revision: 2010-12-22 by zxh, displacement in grid of FFD is on grid coordinate but physical displacement, NOT world displacement : 2011-02-11 by zxh, read FFD from float image. More...
#include <zxhTransformFFDBase.h>
Public Member Functions | |
virtual std::string | GetTransformType () |
virtual bool | SetDimension (int i) |
专门为把Transform当作导数类型用在梯度下降算法中 | |
void | MallocForControlPoints (int ni, float fi, int nj=1, float fj=0, int nk=1, float fk=0, int nl=1, float fl=0) |
malloc mem for control point | |
void | MallocForControlPoints (float fi, float fj=1, float fk=1, float fl=1) |
void | MallocForControlPoints (int ni, int nj=1, int nk=1, int nl=1) |
void | FreeControlPoints () |
release memory | |
bool | ConvertBetweenImage (zxhImageDataT< float > &ffdimg, bool fromFFDtoImage) |
fromFFDtoImage (true): convert ffd to ffdimg, (false) convert ffdimg to this ffd; return success | |
float * | GetCtrPntsWithCheck (int i, int j=0, int k=0, int l=0) const |
get control point's pointer(float*) with and without boundary check | |
const float * | GetCtrPntsDisplacement (int i, int j=0, int k=0, int l=0) |
get control point's pointer(float*), boundary check =[0,0,0,0] | |
bool | GetCtrPntsDisplacement (float pdis[], int i, int j=0, int k=0, int l=0) |
get control point's pointer(float*), boundary check =[0,0,0,0] (return false) | |
float * | GetCtrPntsWithoutCheck (int i, int j=0, int k=0, int l=0) |
void | SetOffsetOfCtrPnts (float pOffset[ImageDimensionMax], int i, int j=0, int k=0, int l=0) |
without boundary check | |
void | GetCtrGridSize (int &ix, int &iy, int &iz, int &it) |
void | GetCtrGridSpacing (float &fx, float &fy, float &fz, float &ft) |
const float * | GetCtrGridSpacing (void) |
const int * | GetCtrGridSize (void) |
control grid property ;;;;; temporarily commented out | |
void | GetCtrGridExtent (float e[4]) |
void | WorldToGrid (float fv[]) const |
void | GridToWorld (float fv[]) const |
void | GridToPhysical (float fv[]) const |
void | PhysicalToGrid (float fv[]) const |
virtual void | GetOrientationAsImageInfo (zxhImageInfo *p) |
clone the orientation info to p (only quaternion parameters useful) | |
virtual const zxhImageInfo * | GetOrientationImageInfo () |
virtual void | SetOrientationUsingImageInfo (const zxhImageInfo *p) |
clone the orientation info from p (only quaternion parameters useful) | |
virtual std::string | GetPrintString () |
base-> size[i] each line->spacing[i] each line->offsets_of_controlpoints[t][z][y] each line | |
virtual bool | SetTransformFromFile (const char *pFile) |
from file | |
virtual bool | SetTransformFromStream (std::ifstream &ifs) |
read transformation from stream, donot care the comments | |
virtual bool | SetTransformIdentity () |
set transformation as a identity transform | |
virtual bool | SetImage (zxhImageData *pTest, zxhImageData *pRef) |
virtual zxhTransformBase * | Clone (zxhTransformBase *&pRet) |
******************************************************** | |
virtual void | TransformPhysToPhys (const float fVectorFromPhys[ImageDimensionMax], float fVectorToPhys[ImageDimensionMax]) |
virtual void | TransformWorldToWorld (const float fVectorFromWorld[ImageDimensionMax], float fVectorToWorld[ImageDimensionMax]) |
2010-12-22 by zxh, revise: displacement in grid of FFD is on grid coordinate but physical displacement, NOT world displacement | |
virtual bool | GetJacobianMatrixOnGrid (float fGrid[ImageDimensionMax], float pJacobian[ImageDimensionMax *ImageDimensionMax]) |
virtual bool | ResampleControlGrid (int ix, int iy, int iz, int it, int level=1, float ERROR_E=0.001) |
GetJacobianMatrix/World use implementation of base class. | |
virtual bool | ResampleControlGrid (float sx, float sy, float sz, float st=1, int level=1, float ERROR_E=0.001) |
virtual bool | ResampleControlGrid (int *size, float *spacing, int level=1, float ERROR_E=0.001) |
virtual float | ApproximateFFD (zxhTransformBase *trans, int level=1, float ERROR_E=0.001) |
virtual float | ApproximateFFD (zxhTransformBase *trans, zxhImageInfo &imageinfo, int level=1, float ERROR_E=0.001) |
virtual bool | ResampleDownHalf () |
accurately resample down by half VALIDATED for 3D, NOT for 2D | |
virtual bool | SetTransformPara (float) |
************************ operators ********************* | |
virtual bool | GetAdd (zxhTransformBase *, zxhTransformBase *) |
virtual bool | Add (zxhTransformBase *) |
virtual bool | GetSubtract (zxhTransformBase *, zxhTransformBase *) |
virtual bool | Subtract (zxhTransformBase *) |
virtual bool | GetMultiply (zxhTransformBase *, float) |
virtual bool | Multiply (float) |
virtual bool | GetMultiplyByPara (zxhTransformBase *, zxhTransformBase *) |
virtual bool | MultiplyByPara (zxhTransformBase *) |
virtual float | GetMagnitudeAsVector (void) |
virtual float | GetMaxLocalMagnitudeAndNormalisation (bool bNormalisationByLocalMagnitude) |
for optimization step length normalization | |
virtual float | GetMaxAbsValueFromParameters (void) |
virtual float | Guarantee1To1 (void) |
virtual int | GetDegreeOfFreedom () |
get transforms DOF | |
virtual int | GetDOFWithValue (float f) |
get parameter value >= f , dof | |
virtual int | GetNoParameters () |
virtual float | GetParameters (int index) |
virtual bool | SetParameterValue (int index, float f) |
Protected Member Functions | |
float | BSplinei (int iOrd, float u) const |
cubic bpline basic funtion | |
float | DerivativeOfBSplinei (int iOrd, float u) const |
float | SecondDerivativeOfBSplinei (int iOrd, float u) |
Protected Attributes | |
zxhImageInfo | m_ImageInfo |
for conversion between control grid index and world coordinate | |
float * | m_pfCtrPntOffset |
int | m_nCtrPntVolume |
int | m_nCtrPntResolution |
zxhImageDataT< float > | m_imgPreComputeFFDWeight |
float | m_afPortionPreSpacingImageSpacing [ImageDimensionMax] |
gridCoTestImage*m_afPortionPreSpacingImageSpacing=gridCoOfm_imgPreComputeAccelerate | |
float | m_afPreComputeTransformSpacing [ImageDimensionMax] |
float | m_fZeroCtrPnt [4] |
Static Protected Attributes | |
static const unsigned int | static_buffersize_aline = 16384 |
This class is used as FFD class base Free form deformation offset of control grid is Worldical offset(unit:mm) ADD: m_ImageInfo for conversion between control grid index and world coordinate; NOTICE: imageinfo's quaternion parameters always same as test image, if different, will be re-set using test image's quaternion para when SetImage save ffd: zxhTransformBase::string, then FFD control point offsets, finally quaternion parameters read ffd: zxhTransformBase::string, then FFD control point offsets, finally quaternion parameters if no gridtoworld matrix available, set to identity*spacing Revision: 2010-12-22 by zxh, displacement in grid of FFD is on grid coordinate but physical displacement, NOT world displacement : 2011-02-11 by zxh, read FFD from float image.
bool zxhTransformFFDBase::Add | ( | zxhTransformBase * | p1 | ) | [virtual] |
Reimplemented from zxhTransformBase.
float zxhTransformFFDBase::ApproximateFFD | ( | zxhTransformBase * | trans, |
int | level = 1 , |
||
float | ERROR_E = 0.001 |
||
) | [virtual] |
IEEE TRANSACTIONS ON VISUALIZATION AND COMPUTER GRAPHICS, VOL. 3, NO. 3, JULY蠸EPTEMBER 1997 level>1 will down sample the spacing by factor 2, ERROR_E mean error threshold, return mean error on the grid points
IEEE TRANSACTIONS ON VISUALIZATION AND COMPUTER GRAPHICS, VOL. 3, NO. 3, JULY蠸EPTEMBER 1997 level>1 will down sample the spacing by factor 2, ERROR_E mean error threshold, return mean error on the grid points Set imageinfo before calling this function
float zxhTransformFFDBase::DerivativeOfBSplinei | ( | int | iOrd, |
float | u | ||
) | const [inline, protected] |
bool zxhTransformFFDBase::GetAdd | ( | zxhTransformBase * | p1, |
zxhTransformBase * | p2 | ||
) | [virtual] |
Reimplemented from zxhTransformBase.
float* zxhTransformFFDBase::GetCtrPntsWithoutCheck | ( | int | i, |
int | j = 0 , |
||
int | k = 0 , |
||
int | l = 0 |
||
) | [inline] |
bool zxhTransformFFDBase::GetJacobianMatrixOnGrid | ( | float | fGrid[ImageDimensionMax], |
float | pJacobian[ImageDimensionMax *ImageDimensionMax] | ||
) | [virtual] |
the jocobian is defined on the coordinate of grid, NOT world coordinate xJacobian[0][0..3] dX/dx.dy.dz.dt
float zxhTransformFFDBase::GetMagnitudeAsVector | ( | void | ) | [virtual] |
Reimplemented from zxhTransformBase.
bool zxhTransformFFDBase::GetMultiply | ( | zxhTransformBase * | p1, |
float | f | ||
) | [virtual] |
Reimplemented from zxhTransformBase.
bool zxhTransformFFDBase::GetMultiplyByPara | ( | zxhTransformBase * | p1, |
zxhTransformBase * | p2 | ||
) | [virtual] |
Reimplemented from zxhTransformBase.
virtual int zxhTransformFFDBase::GetNoParameters | ( | ) | [inline, virtual] |
Get partial differential of transformation [Y1 Y2 Y3]=T(x), with respect to the transformation parameter Ti with index return whether success, results (e.g. 3D, [d(Y1)/d(Ti) d(Y2)/d(Ti) d(Y3)/d(Ti)]) returned in g[4]
Implements zxhTransformBase.
std::string zxhTransformFFDBase::GetPrintString | ( | void | ) | [virtual] |
base-> size[i] each line->spacing[i] each line->offsets_of_controlpoints[t][z][y] each line
2010-nov, add quaternion parameters for orientation info
Reimplemented from zxhTransformBase.
Reimplemented in zxhTransformFFD.
bool zxhTransformFFDBase::GetSubtract | ( | zxhTransformBase * | p1, |
zxhTransformBase * | p2 | ||
) | [virtual] |
Reimplemented from zxhTransformBase.
virtual std::string zxhTransformFFDBase::GetTransformType | ( | ) | [inline, virtual] |
float zxhTransformFFDBase::Guarantee1To1 | ( | void | ) | [virtual] |
in some cases the largest deformation could not achieve enough deforms as the registration required when the spacing of control grid is initially set to be very small. To avoid this problem, one method is to use big grid spacing firstly, and then decreasing the control grid spacing step by step. The other one of course is to discard this truncation of displacement limitation.
Reimplemented from zxhTransformBase.
bool zxhTransformFFDBase::Multiply | ( | float | f | ) | [virtual] |
Reimplemented from zxhTransformBase.
bool zxhTransformFFDBase::MultiplyByPara | ( | zxhTransformBase * | p1 | ) | [virtual] |
Reimplemented from zxhTransformBase.
bool zxhTransformFFDBase::ResampleControlGrid | ( | int | ix, |
int | iy, | ||
int | iz, | ||
int | it, | ||
int | level = 1 , |
||
float | ERROR_E = 0.001 |
||
) | [virtual] |
GetJacobianMatrix/World use implementation of base class.
using linear interpolation to resample the FFD control grids, return estimated errors
float zxhTransformFFDBase::SecondDerivativeOfBSplinei | ( | int | iOrd, |
float | u | ||
) | [inline, protected] |
bool zxhTransformFFDBase::SetImage | ( | zxhImageData * | pTest, |
zxhImageData * | pRef | ||
) | [virtual] |
1) update the grid spacing using pTest volume resolution; 2) add imageinfo using pTest if not set
virtual bool zxhTransformFFDBase::SetParameterValue | ( | int | index, |
float | f | ||
) | [inline, virtual] |
set transformation parameter value, if the transformation model need pre-computation from parameters for efficiency such as affine, then re-implement this function to call the pre-computation method after set the value
Implements zxhTransformBase.
bool zxhTransformFFDBase::SetTransformPara | ( | float | f | ) | [virtual] |
************************ operators *********************
Reimplemented from zxhTransformBase.
bool zxhTransformFFDBase::Subtract | ( | zxhTransformBase * | p1 | ) | [virtual] |
Reimplemented from zxhTransformBase.
int zxhTransformFFDBase::m_nCtrPntResolution [protected] |
int zxhTransformFFDBase::m_nCtrPntVolume [protected] |
float* zxhTransformFFDBase::m_pfCtrPntOffset [protected] |
constant viables for guaranteeing the diffeomorphism of FFD value paper: Y.Choi & S.Lee, Graphical Models 62, 411-427 (2000) float m_afInjectivityK[ ImageDimensionMax+1 ] ; offset of the control point, ImageDimensionMax for each point displacement in grid of FFD is on grid coordinate but physical displacement, NOT world displacement
const unsigned int zxhTransformFFDBase::static_buffersize_aline = 16384 [static, protected] |