Exemple #1
0
  public void loadCoord(String filename) {
    System.out.println("add tensor coordinates: " + filename);
    Input file = new Input(filename);
    int n1 = file.getN(1);
    int n2 = file.getN(2);
    assert n1 == 3;

    _coord = new float[n2][n1];
    file.read(_coord);
  }
Exemple #2
0
  public void loadTensorCoords(String filename) {
    System.out.println("add tensors at coordinates: " + filename);
    Input file = new Input(filename);
    int n1 = file.getN(1);
    int n2 = file.getN(2);
    assert n2 == 9;

    _etc = new float[n2][n1];
    file.read(_etc);

    _etg = new ViewerEigenTensorsGroup(_s1, _s2, _s3);

    _etg.pullTensor(_coord, _etc, true);

    _etg.setEllipsoidSize(4.f);
    _world.addChild(_etg);
  }
Exemple #3
0
  public void loadTensors(String filename) {
    System.out.println("add tensor ellipsoids: " + filename);
    Input file = new Input(filename);

    int n1 = _s1.getCount();
    int n2 = _s2.getCount();
    int n3 = _s3.getCount();

    float[][][][] et = new float[9][n3][n2][n1];

    file.read(et);
    file.close();
    System.out.println("Done reading tensors...");

    _d = new EigenTensors3(n1, n2, n3, true);

    float u1, u2, u3;
    float w1, w2, w3;
    for (int i3 = 0; i3 < n3; ++i3)
      for (int i2 = 0; i2 < n2; ++i2)
        for (int i1 = 0; i1 < n1; ++i1) {
          u1 = et[0][i3][i2][i1];
          u2 = et[1][i3][i2][i1];
          u3 = et[2][i3][i2][i1];
          w1 = et[3][i3][i2][i1];
          w2 = et[4][i3][i2][i1];
          w3 = et[5][i3][i2][i1];
          if (u3 < 0.f) {
            u1 *= -1.f;
            u2 *= -1.f;
            u3 *= -1.f;
          }
          _d.setEigenvectorU(i1, i2, i3, u1, u2, u3);
          if (w3 < 0.f) {
            w1 *= -1.f;
            w2 *= -1.f;
            w3 *= -1.f;
          }
          _d.setEigenvectorW(i1, i2, i3, w1, w2, w3);
        }

    _d.setEigenvalues(et[6], et[7], et[8]);
  }
Exemple #4
0
  public float[] getPointArray(String filename) {
    Input file = new Input(filename);
    int n1 = file.getN(1);
    int n2 = file.getN(2);
    assert n1 == 3;

    float[][] data = new float[n2][3];
    file.read(data);

    float[] points = new float[n2 * 3];
    int ii;
    for (int ip = 0; ip < n2; ++ip) {
      ii = ip * 3;
      points[ii] = data[ip][2];
      points[ii + 1] = data[ip][1];
      points[ii + 2] = data[ip][0];
    }

    return points;
  }
Exemple #5
0
  public void addRSFCube(String filename) {
    System.out.println("add cube: " + filename);
    Input file = new Input(filename);

    int n3 = file.getN(3);
    float d3 = file.getDelta(3);
    float o3 = file.getOrigin(3);
    int n2 = file.getN(2);
    float d2 = file.getDelta(2);
    float o2 = file.getOrigin(2);
    int n1 = file.getN(1);
    float d1 = file.getDelta(1);
    float o1 = file.getOrigin(1);

    Sampling s1 = new Sampling(n1, d1, o1);
    Sampling s2 = new Sampling(n2, d2, o2);
    Sampling s3 = new Sampling(n3, d3, o3);
    _s1 = s1;
    _s2 = s2;
    _s3 = s3;
    float[][][] data = new float[n3][n2][n1];
    file.read(data);
    file.close();
    System.out.println("Done reading data...");
    _ipg = addImagePanels(s1, s2, s3, data);
    _ipg.setClips(ArrayMath.min(data), ArrayMath.max(data));

    _ipg.addColorMapListener(_cb);

    System.out.printf("pclip: (%f,%f) \n", _ipg.getPercentileMin(), _ipg.getPercentileMax());
    _view.setWorldSphere(_ipg.getBoundingSphere(true));
  }