zxhproj v 2.2
zxhproj
|
No global_affine anymore zxhTransformLocalAffines.h: interface for the zxhTransformLocalAffines class. T = first Region_Affines,then Global_Affine = G ( R(x) ) R= sum wi(Gi)+w_facets, these {wi} are computed from the distance_transform images, hence it is better to have the facets fixed on the test image boundary, because local_affine is identity outside the test image facet or fixed facet w_facets is regarded as 6*ZXH_LocalAffineFacetWeighting identity local affine Length_finite_difference = Length_advance < resample/2 Compute similarity measures, e.g. histogram table, i regions based on Ri, and background regions based on interpolated R(x) For each region i Update the histogram table with finite difference step to compute the gradient against affine parameters; Update Ri R(x) is overlap corrected distance weighting interpolation between Ri; If need overlap correction, then update the regions and recomputed the distance transformation for them Local Affine interpolation: (1) based on affine (2) based on closest points' displacment GRADIENT all 1 based on influence_object. More...
#include <zxhTransformLocalAffines.h>
Public Member Functions | |
zxhTransformLocalAffines () | |
constructor | |
virtual | ~zxhTransformLocalAffines () |
deconstructor | |
virtual bool | SetTransformFromStream (std::ifstream &ifs) |
from stream | |
virtual std::string | GetPrintString () |
set transformation as a identity transform, affine doesn't change centre | |
virtual std::string | GetTransformType () |
virtual zxhTransformBase * | Clone (zxhTransformBase *&pRet) |
virtual bool | PreComputeDistance2WeightAndSetModel () |
virtual void | TransformWorldToWorld (const float fVectorFromWorld[ImageDimensionMax], float fVectorToWorld[ImageDimensionMax]) |
virtual void | LocalTransformPointToWorld (float fVectorFrom[ImageDimensionMax], float fVectorToWorld[ImageDimensionMax]) |
virtual void | LocalTransformWorldToWorld (const float fVectorFromWorld[ImageDimensionMax], float fVectorToWorld[ImageDimensionMax]) |
virtual void | LocalTransformWorldToWorldByDisplace (const float fVectorFromWorld[ImageDimensionMax], float fVectorToWorld[ImageDimensionMax]) |
virtual void | LocalTransformWorldToWorldByAffine (const float fVectorFromWorld[ImageDimensionMax], float fVectorToWorld[ImageDimensionMax]) |
virtual bool | GetJacobianMatrixWorld (float fWorld[ImageDimensionMax], float pJacobian[ImageDimensionMax *ImageDimensionMax]) |
virtual bool | GetLocalAffineJacobianMatrixByWorld (float fWorld[ImageDimensionMax], float pJacobian[ImageDimensionMax *ImageDimensionMax]) |
only give the jacobian of the local affines interpolation, exclude global | |
virtual bool | GetLocalAffineJacobianMatrixByWorldForByDisplace (float fWorld[ImageDimensionMax], float pJacobian[ImageDimensionMax *ImageDimensionMax]) |
finite difference | |
virtual float | GetMinLocalAffineJacobian (float wFrom[], float wTo[], float wIntval[], zxhImageData *pMaskTest=0, zxhImageData *pMaskRef=0) |
virtual float | GetMinLocalAffineJacobianOnTestImage (zxhImageData *pImageTest, float tFrom[], float tTo[], float tIntval[], zxhImageData *pMaskTest=0, zxhImageData *pMaskRef=0) |
virtual void | SetLocalRegions (zxhImageData *p) |
virtual zxhImageData * | GetLocalRegions () |
virtual bool | SetFileNameOfLocalRegions (std::string *s) |
virtual const std::string * | GetFileNameOfLocalRegions () |
virtual bool | HasSetFileNameOfLocalRegions () |
virtual bool | SetLocalRegionsFromPreSetFileNames () |
virtual void | SetWorldRoi (float *wfrom, float *wto, int dimension) |
it is important for interpolating transformation, if unset, then is infinate wfrom and wto just two corners, may be wfrom>wto in right-hand coordinate | |
virtual bool | GetWorldRoi (float wfrom[], float wto[]) |
return whether world roi set | |
virtual bool | WithinInterpolateRegionWorld (const float World[]) |
can be interpolate using inverse distance | |
virtual void | SetInterpolateByDisplacement (bool b) |
virtual bool | GetInterpolateByDisplacement () |
virtual void | SetIRBReg (bool b) |
virtual bool | GetIRBReg () |
virtual bool | ComputeGradientBasedIRBReg (zxhMetricMILocalAffines *pMetric, zxhTransformLocalAffines *pInfluence=0) |
Region based registration. | |
virtual bool | ComputeGradientBasedAccReg (zxhMetricMILocalAffines *pMetric, zxhTransformLocalAffines *pInfluence=0) |
Accessory region using image and local_region as the target and source images. | |
virtual bool | ComputeMetricGradient (zxhMetricBase *pMetric, zxhTransformBase *pInfluence=0) |
Protected Member Functions | |
float | ComputeWeightFromDistance (float dis) |
float | ComputeDerivativeByDistance (float dis) |
float | ComputeWeightFromDistanceBoundary (float dis) |
void | LocalTransformWorldToWorldOutlier (const float fVectorFromWorld[ImageDimensionMax], float fVectorToWorld[ImageDimensionMax]) |
float | ComputeRoiBoundaryWeightByWorld (const float fWorld[]) |
6 facets | |
void | ComputeDerivativeWeightOfRoiBoundary (float NablaRoiW[], float co[], float fWorld[]) |
void | PreComputeDistanceImageForLocalRegions () |
void | SetModelWeight () |
after setting, all resample to same dimension as first image | |
Protected Attributes | |
zxhImageData * | m_aLocalRegions |
can have diff spacing, size compared to test image, BUTall local region image should be the same | |
std::string | m_astrFileNameOfLocalRegions [ZXH_LocalAffineMaxNumber] |
bool | m_bSetFileNameOfLocalRegions |
zxhImageData | m_aimgLoadLocalImagesFromPreSetFileNames [ZXH_LocalAffineMaxNumber] |
zxhImageDataT< float > | m_aLocalDistance2Weight [ZXH_LocalAffineMaxNumber] |
distance transformation for each regions | |
zxhImageDataT< float > | m_roiDistance2Weight |
zxhImageModelingLinearT< float, float > | m_aModelDistance2Weight [ZXH_LocalAffineMaxNumber+1] |
point to the distance images | |
float | m_afWorldRoi [2][ImageDimensionMax] |
bool | m_bSetWorldRoi |
bool | m_bInterpolateByDisplacement |
bool | m_bIRBReg |
No global_affine anymore zxhTransformLocalAffines.h: interface for the zxhTransformLocalAffines class. T = first Region_Affines,then Global_Affine = G ( R(x) ) R= sum wi(Gi)+w_facets, these {wi} are computed from the distance_transform images, hence it is better to have the facets fixed on the test image boundary, because local_affine is identity outside the test image facet or fixed facet w_facets is regarded as 6*ZXH_LocalAffineFacetWeighting identity local affine Length_finite_difference = Length_advance < resample/2 Compute similarity measures, e.g. histogram table, i regions based on Ri, and background regions based on interpolated R(x) For each region i Update the histogram table with finite difference step to compute the gradient against affine parameters; Update Ri R(x) is overlap corrected distance weighting interpolation between Ri; If need overlap correction, then update the regions and recomputed the distance transformation for them Local Affine interpolation: (1) based on affine (2) based on closest points' displacment GRADIENT all 1 based on influence_object.
zxhTransformLocalAffines::zxhTransformLocalAffines | ( | ) |
constructor
roi region
zxhTransformBase * zxhTransformLocalAffines::Clone | ( | zxhTransformBase *& | pRet | ) | [virtual] |
Reimplemented from zxhTransformMultipleAffines.
Reimplemented in zxhTransformLocalAffines2.
bool zxhTransformLocalAffines::ComputeMetricGradient | ( | zxhMetricBase * | pMetric, |
zxhTransformBase * | pInfluence = 0 |
||
) | [virtual] |
computer gradient, influence control status for optimisation if infl==0, then use m_fDifferentialStep
Reimplemented from zxhTransformMultipleAffines.
bool zxhTransformLocalAffines::GetJacobianMatrixWorld | ( | float | fWorld[ImageDimensionMax], |
float | pJacobian[ImageDimensionMax *ImageDimensionMax] | ||
) | [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]
Jac(global) * Jac(locallyaffine), Y=Glb(Loc(X))
Reimplemented from zxhTransformAffine.
bool zxhTransformLocalAffines::GetLocalAffineJacobianMatrixByWorld | ( | float | fWorld[ImageDimensionMax], |
float | pJacobian[ImageDimensionMax *ImageDimensionMax] | ||
) | [virtual] |
only give the jacobian of the local affines interpolation, exclude global
Jacobian[0][0..3] dX/dx.dy.dz.dt, zxhtodo, still error
not in regions or boundary, 3D only Joc= (wi/SumWj*NablaTi)+ ([Tix Tiy Tiz]^T * (NablaWi[]/SumWj-wi*SumNablaWj[]/SumWj^2) ) NablaWi[]=-Exponent*di^(-e-1)*Ddi/Dx SumNablaWj[]=-e*( dj^(-e-1)*Ddj/Dx)
Joc= (wi/SumWj*NablaTi)+ ([Tix Tiy Tiz]^T * (NablaWi[]/SumWj-wi*SumNablaWj[]/SumWj^2) )
virtual std::string zxhTransformLocalAffines::GetTransformType | ( | ) | [inline, virtual] |
Reimplemented from zxhTransformMultipleAffines.
void zxhTransformLocalAffines::LocalTransformPointToWorld | ( | float | fVectorFrom[ImageDimensionMax], |
float | fVectorToWorld[ImageDimensionMax] | ||
) | [virtual] |
1)ForwardMaskDilatedOverlap 2)ReComputeRegionDistanceTransform
void zxhTransformLocalAffines::LocalTransformWorldToWorld | ( | const float | fVectorFromWorld[ImageDimensionMax], |
float | fVectorToWorld[ImageDimensionMax] | ||
) | [virtual] |
1) outside interpolation field, use nearest displacement todo 2) Get the distance2weight for each local region and transform using local affine 3) addup the distance2weight from facet and identity transform 4) compute the toWorld
bool zxhTransformLocalAffines::PreComputeDistance2WeightAndSetModel | ( | ) | [virtual] |
Finish setting NoLA, LocalRegion, ROIWorld compute distance images, all resample to same dimension as first image
1 set NoLA, LocalRegion, LocalDistance, ROIWorld
2 --- not use nowComputeRoiDistance2Weight 3 --- not use nowCompute the distance images into weights 4 --- not use nowDonotNormalise the Weights, set m_aModelDistance2Weight[NoLA] to RoiWeight, distance 10 error 0.62%
bool zxhTransformLocalAffines::SetTransformFromStream | ( | std::ifstream & | ifs | ) | [virtual] |
from stream
set pretransformation by aligning the image size centre "centre" (2) or gray level centre "gcentre" (3) test and ref images should be set
Reimplemented from zxhTransformMultipleAffines.
Reimplemented in zxhTransformLocalAffines2.
virtual void zxhTransformLocalAffines::SetWorldRoi | ( | float * | wfrom, |
float * | wto, | ||
int | dimension | ||
) | [inline, virtual] |
it is important for interpolating transformation, if unset, then is infinate wfrom and wto just two corners, may be wfrom>wto in right-hand coordinate
return no. of pixels masked out by dilation 1. recompute the distance transform 2. m_aCheckOverlapLocalRegions 3. recompute StructRegistration.m_aComputeLocalGradientRegions (zxh::ReComputeLocalGradientRegions NOT in here)
virtual void zxhTransformLocalAffines::TransformWorldToWorld | ( | const float | fVectorFromWorld[ImageDimensionMax], |
float | fVectorToWorld[ImageDimensionMax] | ||
) | [inline, virtual] |
T = first Region_Affines,then Global_Affine = G ( Tj(R(x)) ) need to ForwardMaskDilatedOverlap with true first before use tranform
Reimplemented from zxhTransformAffine.
float zxhTransformLocalAffines::m_afWorldRoi[2][ImageDimensionMax] [protected] |
roi region, fixed boundaries for interpolation, default:-ZXH_InfiniteLargeFloat~ZXH_InfiniteLargeFloat