コード例 #1
0
ファイル: Viewer3D.java プロジェクト: psava/cwp12
 public void saveView(String filename) {
   BoundingSphere bs = _ipg.getBoundingSphere(true);
   Vector3 tvec = _view.getTranslate();
   try {
     FileWriter fw = new FileWriter(filename);
     PrintWriter out = new PrintWriter(fw);
     out.println(bs.getRadius());
     Point3 center = bs.getCenter();
     out.printf("%f %f %f \n", center.x, center.y, center.z);
     out.println(_view.getAzimuth());
     out.println(_view.getElevation());
     out.println(_view.getScale());
     out.printf("%f %f %f \n", tvec.x, tvec.y, tvec.z);
     Iterator<ImagePanel> itr = _ipg.getImagePanels();
     while (itr.hasNext()) {
       ImagePanel ip = itr.next();
       AxisAlignedFrame aaf = ip.getFrame();
       Point3 min = aaf.getCornerMin();
       Point3 max = aaf.getCornerMax();
       out.printf("%f %f %f %f %f %f\n", min.x, min.y, min.z, max.x, max.y, max.z);
     }
     out.println(_pmax);
     out.println(_color.getCode());
     out.close();
   } catch (Exception e) {
     System.out.println(e);
   }
 }
コード例 #2
0
ファイル: IvusFrame.java プロジェクト: BKJackson/idh
 private static void addSlices(World world, Float3 f) {
   int nx = f.getN3();
   int ny = f.getN2();
   int nz = f.getN1();
   double dx = 1.0;
   double dy = 1.0;
   double dz = 1.0;
   double fx = 0.0;
   double fy = 0.0;
   double fz = 0.0;
   double lx = fx + (nx - 1) * dx;
   double ly = fy + (ny - 1) * dy;
   double lz = fz + (nz - 1) * dz;
   Sampling sx = new Sampling(nx, dx, fx);
   Sampling sy = new Sampling(ny, dy, fy);
   Sampling sz = new Sampling(nz, dz, fz);
   Point3 qmin = new Point3(fx, fy, fz);
   Point3 qmax = new Point3(lx, ly, lz);
   Axis[] axes = new Axis[] {Axis.X, Axis.Y, Axis.Z};
   for (int iaxis = 0; iaxis < axes.length; ++iaxis) {
     AxisAlignedQuad aaq = new AxisAlignedQuad(axes[iaxis], qmin, qmax);
     AxisAlignedFrame aaf = aaq.getFrame();
     ImagePanel ip = new ImagePanel(sz, sy, sx, f);
     ip.setColorModel(ColorMap.GRAY);
     System.out.println("clip min=" + ip.getClipMin() + " max=" + ip.getClipMax());
     aaf.addChild(ip);
     world.addChild(aaq);
   }
 }
コード例 #3
0
ファイル: Viewer3D.java プロジェクト: psava/cwp12
  public void loadView(String filename) {
    Point3 point;
    Vector3 tvec;
    double radius;
    double azimuth;
    double elevation;
    double scale;
    double x, y, z;
    double vx, vy, vz;

    try {
      if (_ipg == null) throw new Exception("Must load a cube first!");
      Scanner s = new Scanner(new File(filename));
      radius = s.nextDouble();
      x = s.nextDouble();
      y = s.nextDouble();
      z = s.nextDouble();
      point = new Point3(x, y, z);
      azimuth = s.nextDouble();
      elevation = s.nextDouble();
      scale = s.nextDouble();
      vx = s.nextDouble();
      vy = s.nextDouble();
      vz = s.nextDouble();
      tvec = new Vector3(vx, vy, vz);
      Iterator<ImagePanel> itr = _ipg.getImagePanels();
      while (itr.hasNext()) {
        ImagePanel ip = itr.next();
        AxisAlignedFrame aaf = ip.getFrame();
        double lx = s.nextDouble();
        double ly = s.nextDouble();
        double lz = s.nextDouble();
        double mx = s.nextDouble();
        double my = s.nextDouble();
        double mz = s.nextDouble();

        Point3 min = new Point3(lx, ly, lz);
        Point3 max = new Point3(mx, my, mz);
        aaf.setCorners(min, max);
      }
      _pmax = s.nextFloat();
      int code = s.nextInt();
      _color = ColorList.getMatch(code);
      setColorMap();
      _view.setWorldSphere(new BoundingSphere(point, radius));
      _view.setTranslate(tvec);
      _view.setAzimuth(azimuth);
      _view.setElevation(elevation);
      _view.setScale(scale);
      _ipg.setPercentiles(_pmin, _pmax);

    } catch (Exception e) {
      System.out.println("Failed to load view point!");
      System.out.println(e);
    }
  }