Example #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);
  }
Example #2
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");
  }
Example #3
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");
  }