Ejemplo n.º 1
0
  private static void go() {
    int n1 = 101;
    int n2 = 101;
    // float[][] f = sin(rampfloat(0.0f,0.1f,0.1f,n1,n2));
    float[][] f = zerofloat(n1, n2);

    PlotPanel.Orientation orientation = PlotPanel.Orientation.X1DOWN_X2RIGHT;
    PlotPanel panel = new PlotPanel(orientation);

    PixelsView pv = panel.addPixels(f);
    pv.setInterpolation(PixelsView.Interpolation.NEAREST);
    pv.setColorModel(ColorMap.JET);

    panel.addColorBar("time");
    panel.setVLabel("depth (km)");
    panel.setHLabel("distance (km)");

    PlotFrame frame = new PlotFrame(panel);
    frame.setDefaultCloseOperation(PlotFrame.EXIT_ON_CLOSE);
    frame.setSize(800, 700);
    frame.setFontSize(24);
    frame.setVisible(true);

    ModeManager mm = frame.getModeManager();
    ImageEditMode iem = new ImageEditMode(mm, pv, 0.0f, f);
    iem.setActive(true);
  }
Ejemplo n.º 2
0
 /**
  * Constructs an image edit mode with specified manager.
  *
  * @param modeManager the mode manager for this mode.
  */
 public ImageEditMode(ModeManager modeManager, PixelsView pixels, float vnull, float[][] v) {
   super(modeManager);
   setName("Edit");
   // setIcon(loadIcon(ImageEditMode.class,"resources/ImageEdit16.gif"));
   // setIcon(loadIcon(MouseTrackMode.class,"resources/Track24.gif"));
   setMnemonicKey(KeyEvent.VK_E);
   setAcceleratorKey(KeyStroke.getKeyStroke(KeyEvent.VK_E, 0));
   setShortDescription("Edit points");
   _tile = pixels.getTile();
   _pixels = pixels;
   fill(vnull, v);
   _vnull = vnull;
   _n1 = v[0].length;
   _n2 = v.length;
   _v = v;
   _is2 = new ImageSampler2(_v);
   _ns = 0;
   _x1 = new float[0][0];
   _x2 = new float[0][0];
   _vx = new float[0][0];
   _points = new PointsView(_x1, _x2);
   if (pixels.getOrientation() == PixelsView.Orientation.X1RIGHT_X2UP) {
     _points.setOrientation(PointsView.Orientation.X1RIGHT_X2UP);
   } else {
     _points.setOrientation(PointsView.Orientation.X1DOWN_X2RIGHT);
   }
   _points.setStyle("w-o");
 }
Ejemplo n.º 3
0
 private void updatePixelsView() {
   _pixels.set(_v);
 }
Ejemplo n.º 4
0
  private static void test2() {
    int n1 = 11;
    int n2 = 11;
    float d1 = 1.0f / (float) max(1, n1 - 1);
    float d2 = 1.0f / (float) max(1, n2 - 1);
    float[][] f0 = rampfloat(0.0f, d1, d2, n1, n2);
    float[][] f1 = zerofloat(n1, n2);
    float[][] f2 = zerofloat(n1, n2);
    // float[][] f1 = rampfloat(0.0f,d1,d2,n1,n2);
    // float[][] f2 = rampfloat(0.0f,d1,d2,n1,n2);

    Sampling s1 = new Sampling(n1, 0.5, 0.25 * (n1 - 1));
    Sampling s2 = new Sampling(n2, 0.5, 0.25 * (n2 - 1));

    PlotPanel panel = new PlotPanel(1, 2);
    PixelsView pv0 = panel.addPixels(0, 0, new float[][][] {f0, f1, f2});
    pv0.setInterpolation(PixelsView.Interpolation.NEAREST);
    pv0.setClips(0, 0.0f, 2.0f);
    pv0.setClips(1, 0.0f, 2.0f);
    pv0.setClips(2, 0.0f, 2.0f);
    pv0.set(new float[][][] {f0, f1, f2}); // should have no effect!

    PixelsView pv0b = panel.addPixels(0, 0, s1, s2, new float[][][] {f1, f0, f2});
    pv0b.setInterpolation(PixelsView.Interpolation.LINEAR);
    pv0b.setClips(0, 0.0f, 2.0f);
    pv0b.setClips(1, 0.0f, 2.0f);
    pv0b.setClips(2, 0.0f, 2.0f);

    PixelsView pv1 = panel.addPixels(0, 1, new float[][][] {f1, f2, f0});
    pv1.setInterpolation(PixelsView.Interpolation.LINEAR);
    pv1.setClips(0, 0.0f, 2.0f);
    pv1.setClips(1, 0.0f, 2.0f);
    pv1.setClips(2, 0.0f, 2.0f);

    PixelsView pv1b = panel.addPixels(0, 1, s1, s2, new float[][][] {f1, f0, f2});
    pv1b.setInterpolation(PixelsView.Interpolation.NEAREST);
    pv1b.setClips(0, 0.0f, 2.0f);
    pv1b.setClips(1, 0.0f, 2.0f);
    pv1b.setClips(2, 0.0f, 2.0f);

    PlotFrame frame = new PlotFrame(panel);
    frame.setDefaultCloseOperation(PlotFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
    // frame.paintToPng(300,6,"junk.png");
  }
Ejemplo n.º 5
0
  private static void test1() {
    int n1 = 11;
    int n2 = 11;
    float d1 = 1.0f / (float) max(1, n1 - 1);
    float d2 = 1.0f / (float) max(1, n2 - 1);
    float[][] f = rampfloat(0.0f, d1, d2, n1, n2);

    Sampling s1 = new Sampling(n1, 0.5, 0.25 * (n1 - 1));
    Sampling s2 = new Sampling(n2, 0.5, 0.25 * (n2 - 1));

    PlotPanel panel = new PlotPanel(1, 2);
    PixelsView pv0 = panel.addPixels(0, 0, f);
    pv0.setInterpolation(PixelsView.Interpolation.NEAREST);
    pv0.setColorModel(ColorMap.JET);
    pv0.setPercentiles(0.0f, 100.0f);
    f = mul(10.0f, f);
    pv0.set(f);

    PixelsView pv0b = panel.addPixels(0, 0, s1, s2, f);
    pv0b.setInterpolation(PixelsView.Interpolation.LINEAR);
    pv0b.setColorModel(ColorMap.GRAY);
    pv0b.setPercentiles(0.0f, 100.0f);

    PixelsView pv1 = panel.addPixels(0, 1, f);
    pv1.setInterpolation(PixelsView.Interpolation.LINEAR);
    pv1.setColorModel(ColorMap.GRAY);
    pv1.setPercentiles(0.0f, 100.0f);
    f = mul(10.0f, f);
    pv1.set(f);

    PixelsView pv1b = panel.addPixels(0, 1, s1, s2, f);
    pv1b.setInterpolation(PixelsView.Interpolation.NEAREST);
    pv1b.setColorModel(ColorMap.JET);
    pv1b.setPercentiles(0.0f, 100.0f);

    PlotFrame frame = new PlotFrame(panel);
    frame.setDefaultCloseOperation(PlotFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
    // frame.paintToPng(300,6,"junk.png");
  }