public void computeDeformationContribution( final double[] thispt, final double[] result ) { final double[] tmpDisplacement = new double[ ndims ]; for ( int i = 0; i < ndims; ++i ) { result[ i ] = 0; tmpDisplacement[ i ] = 0; } int di = 0; for ( int lnd = 0; lnd < nLandmarks; lnd++ ) { srcPtDisplacement( lnd, thispt, tmpDisplacement ); final double nrm = r2Logr( Math.sqrt( normSqrd( tmpDisplacement ) ) ); for ( int d = 0; d < ndims; d++ ) result[ d ] += nrm * dMatrix.get( d, di ); di++; } }
for ( int lnd = 0; lnd < nLandmarks; lnd++ ) srcPtDisplacement( lnd, p, tmpDisplacement );
/** * Builds the K matrix from landmark points and G matrix. * @param kMatrix the k matrix */ protected void computeK(DenseMatrix64F kMatrix) { final double[] res = new double[ ndims ]; int i = 0; final DenseMatrix64F Gbase = computeReflexiveG(); final DenseMatrix64F G = Gbase.copy(); while ( i < nLandmarks ) { CommonOps.insert( Gbase, kMatrix, i * ndims, i * ndims ); int j = i + 1; while ( j < nLandmarks ) { srcPtDisplacement( i, j, res ); computeG( res, G ); CommonOps.insert( G, kMatrix, i * ndims, j * ndims ); CommonOps.insert( G, kMatrix, j * ndims, i * ndims ); j++; } i++; } }