/** * Applies this filter to estimate orientation angles. * @param x input array for 2-D image. * @param theta orientation angle; -pi <= theta <= pi */ public void applyForTheta(float[][] x, float[][] theta) { apply(x, theta, null,null, null,null, null,null, null); }
/** * Applies this filter to estimate compressed 3-D structure tensors. * @param x input array for 3-D image. * @return structure tensors. */ public EigenTensors3 applyForTensors(float[][][] x) { return applyForTensors(x,true); }
/** * Sets half-width of Gaussian derivative filter used to compute gradients. * Typically, this half-width should not exceed one-fourth that of the * the corresponding Gaussian window used to compute local averages of * gradient products. * The default half-width for Gaussian derivatives is 1.0. * @param sigma half-width of derivatives; same for all dimensions. */ public void setGradientSmoothing(double sigma) { setGradientSmoothing(sigma,sigma,sigma); }
public void test2() { double sigma = 8.0; int n1 = 1+4*(int)(3*sigma); int n2 = n1+2; LocalOrientFilter lof = new LocalOrientFilter(sigma); float pi = FLT_PI; float[] dips = {-0.49f*pi,-0.20f*pi,-0.01f,0.01f,0.20f*pi,0.49f*pi}; for (float dip:dips) { float k = 0.3f; float c = k*cos(dip); float s = k*sin(dip); float[][] x = sin(rampfloat(0.0f,c,s,n1,n2)); float[][] theta = new float[n2][n1]; float[][] u1 = new float[n2][n1]; float[][] u2 = new float[n2][n1]; float[][] v1 = new float[n2][n1]; float[][] v2 = new float[n2][n1]; float[][] eu = new float[n2][n1]; float[][] ev = new float[n2][n1]; float[][] el = new float[n2][n1]; lof.apply(x,theta,u1,u2,v1,v2,eu,ev,el); assertEqual(dip,theta,0.01); assertEqual(cos(dip),u1,0.01); assertEqual(sin(dip),u2,0.01); assertEqual(-sin(dip),v1,0.01); assertEqual(cos(dip),v2,0.01); assertEqual(1.0f,el,0.01); } }
float[][][] g13 = (nt>4)?t[4]:new float[n3][n2][n1]; float[][][] g23 = (nt>5)?t[5]:new float[n3][n2][n1]; computeGradientProducts(g1,g2,g3,g11,g12,g13,g22,g23,g33); solveEigenproblems(g11,g12,g13,g22,g23,g33, theta,phi,u1,u2,u3,v1,v2,v3,w1,w2,w3,eu,ev,ew,ep,el);
int n2 = n1+2; int n3 = n2+2; LocalOrientFilter lof = new LocalOrientFilter(sigma); float pi = FLT_PI; float[] azis = {-0.50f*pi,0.25f*pi,0.99f*pi}; float[][][] ep = new float[n3][n2][n1]; float[][][] el = new float[n3][n2][n1]; lof.apply(x,theta,phi,u1,u2,u3,v1,v2,v3,w1,w2,w3,eu,ev,ew,ep,el); assertEqual(dip,theta,0.02); assertEqual(azi,phi,0.02);
/** * Applies this filter to estimate orientation angles. * @param x input array for 3-D image. * @param theta orientation dip angle; 0 <= theta <= pi/2. * @param phi orientation azimuthal angle; -pi <= phi <= pi. */ public void applyForThetaPhi(float[][][] x, float[][][] theta, float[][][] phi) { apply(x, theta,phi, null,null,null, null,null,null, null,null,null, null,null,null, null,null); }
int n2 = n1+2; int n3 = n2+2; LocalOrientFilter lof = new LocalOrientFilter(sigma); float pi = FLT_PI; float[] azis = {-0.50f*pi,0.25f*pi,0.99f*pi}; float[][][] ep = new float[n3][n2][n1]; float[][][] el = new float[n3][n2][n1]; lof.apply(x,theta,phi,u1,u2,u3,v1,v2,v3,w1,w2,w3,eu,ev,ew,ep,el);
/** * Sets half-widths of Gaussian derivative filters used to compute gradients. * Typically, these half-widths should not exceed one-fourth those of the * the corresponding Gaussian windows used to compute local averages of * gradient-squared tensors. * The default half-widths for Gaussian derivatives is 1.0. * @param sigma1 half-width of derivative in 1st dimension. * @param sigma2 half-width of derivatives in 2nd and higher dimensions. */ public void setGradientSmoothing(double sigma1, double sigma2) { setGradientSmoothing(sigma1,sigma2,sigma2); }
/** * Applies this filter to estimate normal vectors (1st eigenvectors). * @param x input array for 2-D image. * @param u1 1st component of normal vector. * @param u2 2nd component of normal vector. */ public void applyForNormal(float[][] x, float[][] u1, float[][] u2) { apply(x, null, u1,u2, null,null, null,null, null); }
/** * Constructs a filter with a possibly anisotropic Gaussian window. * @param sigma1 half-width of window in 1st dimension. * @param sigma2 half-width of window in 2nd dimension. * @param sigma3 half-width of window in 3rd and higher dimensions. */ public LocalOrientFilter(double sigma1, double sigma2, double sigma3) { _rgfSmoother1 = (sigma1>=1.0)?new RecursiveGaussianFilter(sigma1):null; if (sigma2==sigma1) { _rgfSmoother2 = _rgfSmoother1; } else { _rgfSmoother2 = (sigma2>=1.0)?new RecursiveGaussianFilter(sigma2):null; } if (sigma3==sigma2) { _rgfSmoother3 = _rgfSmoother2; } else { _rgfSmoother3 = (sigma3>=1.0)?new RecursiveGaussianFilter(sigma3):null; } setGradientSmoothing(1.0); }
/** * Applies this filter to estimate normal vectors and linearities. * @param x input array for 2-D image. * @param u1 1st component of normal vector. * @param u2 2nd component of normal vector. * @param el linearity in range [0,1]. */ public void applyForNormalLinear(float[][] x, float[][] u1, float[][] u2, float[][] el) { apply(x, null, u1,u2, null,null, null,null, el); }
/** * Applies this filter to estimate normal vectors (1st eigenvectors). * @param x input array for 3-D image. * @param u1 1st component of normal vector. * @param u2 2nd component of normal vector. * @param u3 3rd component of normal vector. */ public void applyForNormal(float[][][] x, float[][][] u1, float[][][] u2, float[][][] u3) { apply(x, null,null, u1,u2,u3, null,null,null, null,null,null, null,null,null, null,null); }
/** * Applies this filter to estimate inline vectors (3rd eigenvectors). * @param x input array for 3-D image. * @param w1 1st component of inline vector. * @param w2 2nd component of inline vector. * @param w3 3rd component of inline vector. */ public void applyForInline(float[][][] x, float[][][] w1, float[][][] w2, float[][][] w3) { apply(x, null,null, null,null,null, null,null,null, w1,w2,w3, null,null,null, null,null); }
/** * Applies this filter to estimate normal vectors and planarities. * Normal vectors are 1st eigenvectors corresponding to largest eigenvalues. * @param x input array for 3-D image. * @param u1 1st component of normal vector. * @param u2 2nd component of normal vector. * @param u3 3rd component of normal vector. * @param ep planarity in range [0,1]. */ public void applyForNormalPlanar(float[][][] x, float[][][] u1, float[][][] u2, float[][][] u3, float[][][] ep) { apply(x, null,null, u1,u2,u3, null,null,null, null,null,null, null,null,null, ep,null); }
/** * Applies this filter to estimate inline vectors and linearities. * Inline vectors are 3rd eigenvectors corresponding to smallest eigenvalues. * @param x input array for 3-D image. * @param w1 1st component of inline vector. * @param w2 2nd component of inline vector. * @param w3 3rd component of inline vector. * @param el linearity in range [0,1]. */ public void applyForInlineLinear(float[][][] x, float[][][] w1, float[][][] w2, float[][][] w3, float[][][] el) { apply(x, null,null, null,null,null, null,null,null, w1,w2,w3, null,null,null, null,el); }
/** * Applies this filter to estimate 2-D structure tensors. * @param x input array for 2-D image. * @return structure tensors. */ public EigenTensors2 applyForTensors(float[][] x) { int n1 = x[0].length; int n2 = x.length; float[][] u1 = new float[n2][n1]; float[][] u2 = new float[n2][n1]; float[][] eu = new float[n2][n1]; float[][] ev = new float[n2][n1]; apply(x, null, u1,u2, null,null, eu,ev, null); return new EigenTensors2(u1,u2,eu,ev); }
float[][][] ev = new float[n3][n2][n1]; float[][][] ew = new float[n3][n2][n1]; apply(x, null,null, null,u2,u3,