Ejemplo n.º 1
0
  /**
   * Gets mappings computed from specified slopes and planarities.
   *
   * @param s1 sampling of 1st dimension.
   * @param s2 sampling of 2nd dimension.
   * @param p2 array of slopes of image features.
   * @param ep array of planarities of image features.
   */
  public Mappings getMappingsFromSlopes(
      Sampling s1, Sampling s2, Sampling s3, float[][][] p2, float[][][] p3, float[][][] ep) {
    // Sampling parameters.
    final int n1 = s1.getCount();
    final int n2 = s2.getCount();
    final int n3 = s3.getCount();
    float d1 = (float) s1.getDelta();
    float d2 = (float) s2.getDelta();
    float d3 = (float) s3.getDelta();
    float f1 = (float) s1.getFirst();

    // If necessary, convert units for slopes to samples per sample.
    if (d1 != d2) p2 = mul(d2 / d1, p2);
    if (d1 != d3) p3 = mul(d3 / d1, p3);

    // Compute shifts r(x1,x2,x3), in samples.
    float[][][] b = new float[n3][n2][n1]; // right-hand side
    float[][][] r = new float[n3][n2][n1]; // shifts, in samples
    VecArrayFloat3 vb = new VecArrayFloat3(b);
    VecArrayFloat3 vr = new VecArrayFloat3(r);
    Smoother3 smoother3 = new Smoother3(n1, n2, n3, _sigma1, _sigma2, _sigma3, ep);
    A3 a3 = new A3(smoother3, _weight1, ep, p2, p3);
    CgSolver cs = new CgSolver(_small, _niter);
    makeRhs(ep, p2, p3, b);
    smoother3.applyTranspose(b);
    cs.solve(a3, vb, vr);
    smoother3.apply(r);
    cleanShifts(r);

    // Compute u1(x1,x2,x3).
    final float[][][] u1 = r;
    for (int i3 = 0; i3 < n3; ++i3) {
      for (int i2 = 0; i2 < n2; ++i2) {
        for (int i1 = 0; i1 < n1; ++i1) {
          float x1i = f1 + i1 * d1;
          u1[i3][i2][i1] = x1i + r[i3][i2][i1] * d1;
        }
      }
    }

    // Compute x1(u1,u2).
    final float[][][] x1 = b;
    final InverseInterpolator ii = new InverseInterpolator(s1, s1);
    Parallel.loop(
        n3,
        new Parallel.LoopInt() {
          public void compute(int i3) {
            for (int i2 = 0; i2 < n2; ++i2) ii.invert(u1[i3][i2], x1[i3][i2]);
          }
        });

    return new Mappings(s1, s2, s3, u1, x1);
  }
Ejemplo n.º 2
0
 /**
  * @param us[0] array of fault likelihoods.
  * @param us[1] array of 1st component of fault normal vectors.
  * @param us[2] array of 2nd component of fault normal vectors.
  * @param us[3] array of 3rd component of fault normal vectors.
  */
 public float[][][] saltIndicator(float[][][] mk, float[][][] u1, float[][][] u2, float[][][] u3) {
   int n3 = u1.length;
   int n2 = u1[0].length;
   int n1 = u1[0][0].length;
   float[][][] b = new float[n3][n2][n1]; // right-hand side
   float[][][] f = new float[n3][n2][n1]; // fault isosurface volume, in samples
   VecArrayFloat3 vb = new VecArrayFloat3(b);
   VecArrayFloat3 vf = new VecArrayFloat3(f);
   Smoother3 smoother3 = new Smoother3(n1, n2, n3, _sigma1, _sigma2, _sigma3);
   A3 a3 = new A3(smoother3, mk);
   CgSolver cs = new CgSolver(_small, _niter);
   makeRhs(u1, u2, u3, b);
   smoother3.applyTranspose(b);
   cs.solve(a3, vb, vf);
   smoother3.apply(f);
   return f;
 }