Esempio n. 1
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));
  }
Esempio n. 2
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]);
  }