/** * Sets the clips for this view. A pixels view maps values of the sampled * function f(x1,x2) to bytes, which are then used as indices into a * specified color model. This mapping from sample values to byte indices * is linear, and depends on only these two clip values. The minimum clip * value corresponds to byte index 0, and the maximum clip value corresponds * to byte index 255. Sample values outside of the range (clipMin,clipMax) * are clipped to lie inside this range. * <p> * Calling this method disables the computation of clips from percentiles. * Any clip values computed or specified previously will be forgotten. * <p> * If multiple color components, sets clips for all components. * @param clipMin the sample value corresponding to color model index 0. * @param clipMax the sample value corresponding to color model index 255. */ public void setClips(float clipMin, float clipMax) { for (int ic=0; ic<_nc; ++ic) setClips(ic,clipMin,clipMax); }
public void actionPerformed(ActionEvent action) { if (combopc.getSelectedItem()=="JET") { pv2.setColorModel(ColorMap.JET); } else if (combopc.getSelectedItem()=="HUE") { pv2.setColorModel(ColorMap.HUE); } else if (combopc.getSelectedItem()=="GRAY") { pv2.setColorModel(ColorMap.GRAY); } } });
/** * Sets the method for interpolation between samples. * @param interpolation the interpolation method. */ public void setInterpolation(PixelsView.Interpolation interpolation) { _p12.setInterpolation(interpolation); _p13.setInterpolation(interpolation); _p23.setInterpolation(interpolation); }
/** * Sets the clips for the specified color component. * @param ic the index (0, 1, 2, or 3) of the color component. * @param clipMin the sample value corresponding to byte value 0. * @param clipMax the sample value corresponding to byte value 255. */ public void setClips(int ic, float clipMin, float clipMax) { checkComponent(ic); _clips[ic].setClips(clipMin,clipMax); repaint(); }
private PixelsView addPixelsView(int irow, int icol, PixelsView pv) { pv.getColorMap().addListener(_colorMapHandler); if (_orientation==Orientation.X1RIGHT_X2UP) { pv.setOrientation(PixelsView.Orientation.X1RIGHT_X2UP); } else if (_orientation==Orientation.X1DOWN_X2RIGHT) { pv.setOrientation(PixelsView.Orientation.X1DOWN_X2RIGHT); } addTiledView(irow,icol,pv); return pv; }
_pixels = new PixelsView(va); _pixels.setOrientation(PixelsView.Orientation.X1RIGHT_X2UP); _pixels.setInterpolation(PixelsView.Interpolation.LINEAR); _tile.addTiledView(_pixels); _pixels.setClips(vmin,vmax); _pixels.setColorModel(icm); Sampling s1 = new Sampling(1); Sampling s2 = vs; _pixels.set(s1,s2,va);
public void run() { System.out.println("min="+ min(g)+" max="+ max(g)); SimplePlot sp = new SimplePlot(); sp.setTitle(method); sp.setSize(847,740); sp.addColorBar(); sp.getPlotPanel().setColorBarWidthMinimum(100); PixelsView pv = sp.addPixels(SX,SX,g); pv.setColorModel(ColorMap.JET); pv.setInterpolation(PixelsView.Interpolation.LINEAR); if (cmin<cmax) pv.setClips(cmin,cmax); PointsView px = sp.addPoints(x1,x2); px.setLineStyle(PointsView.Line.NONE); px.setMarkStyle(PointsView.Mark.FILLED_CIRCLE); px.setMarkSize(6); } });
pv0.setInterpolation(PixelsView.Interpolation.NEAREST); pv0.setColorModel(ColorMap.JET); pv0.setPercentiles(0.0f,100.0f); f = mul(10.0f,f); pv0.set(f); pv0b.setInterpolation(PixelsView.Interpolation.LINEAR); pv0b.setColorModel(ColorMap.GRAY); pv0b.setPercentiles(0.0f,100.0f); pv1.setInterpolation(PixelsView.Interpolation.LINEAR); pv1.setColorModel(ColorMap.GRAY); pv1.setPercentiles(0.0f,100.0f); f = mul(10.0f,f); pv1.set(f); pv1b.setInterpolation(PixelsView.Interpolation.NEAREST); pv1b.setColorModel(ColorMap.JET); pv1b.setPercentiles(0.0f,100.0f);
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! 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); 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); 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);
private static void plot(float[][] f) { trace("plot f min="+ min(f)+" max="+max(f)); edu.mines.jtk.mosaic.SimplePlot sp = new edu.mines.jtk.mosaic.SimplePlot( edu.mines.jtk.mosaic.SimplePlot.Origin.UPPER_LEFT); sp.setSize(920,900); edu.mines.jtk.mosaic.PixelsView pv = sp.addPixels(f); pv.setColorModel(edu.mines.jtk.awt.ColorMap.JET); pv.setInterpolation(edu.mines.jtk.mosaic.PixelsView.Interpolation.NEAREST); } }
/** * Sets the sampled function f(x1,x2) for this view. * Function values are converted to colors using an index color model. * @param s1 the sampling of the variable x1; must be uniform. * @param s2 the sampling of the variable x2; must be uniform. * @param f array[n2][n1] of sampled function values f(x1,x2). */ public void set(Sampling s1, Sampling s2, float[][] f) { set(s1,s2,new float[][][]{f}); }
/** * Sets the percentiles used to compute clips for this view. The default * percentiles are 0 and 100, which correspond to the minimum and maximum * values of the sampled function f(x1,x2). * <p> * Calling this method enables the computation of clips from percentiles. * Any clip values specified or computed previously will be forgotten. * <p> * If multiple color components, sets percentiles for all components. * @param percMin the percentile corresponding to clipMin. * @param percMax the percentile corresponding to clipMax. */ public void setPercentiles(float percMin, float percMax) { for (int ic=0; ic<_nc; ++ic) setPercentiles(ic,percMin,percMax); }
/** * Adds a pixels view of the specified sampled function f(x1,x2). * Assumes zero first sample values and unit sampling intervals. * @param irow the tile row index. * @param icol the tile column index. * @param f array[n2][n1] of sampled function values f(x1,x2), * where n1 = f[0].length and n2 = f.length. * @return the pixels view. */ public PixelsView addPixels(int irow, int icol, float[][] f) { PixelsView pv = new PixelsView(f); return addPixelsView(irow,icol,pv); }
/** * Gets the minimum clip value. If multiple color components, gets the * minimum clip value for only the first color component. * @return the minimum clip value. */ public float getClipMin() { return getClipMin(0); }
public void run() { System.out.println("min="+ min(g)+" max="+ max(g)); SimplePlot sp = new SimplePlot(); sp.setTitle(method); sp.setSize(847,740); sp.addColorBar(); sp.getPlotPanel().setColorBarWidthMinimum(100); PixelsView pv = sp.addPixels(SX,SX,g); pv.setColorModel(ColorMap.JET); pv.setInterpolation(PixelsView.Interpolation.LINEAR); if (cmin<cmax) pv.setClips(cmin,cmax); PointsView px = sp.addPoints(x1,x2); px.setLineStyle(PointsView.Line.NONE); px.setMarkStyle(PointsView.Mark.FILLED_CIRCLE); px.setMarkSize(6); } });
private static void plot(float[][] f) { trace("plot f min="+ min(f)+" max="+max(f)); edu.mines.jtk.mosaic.SimplePlot sp = new edu.mines.jtk.mosaic.SimplePlot( edu.mines.jtk.mosaic.SimplePlot.Origin.UPPER_LEFT); sp.setSize(920,900); edu.mines.jtk.mosaic.PixelsView pv = sp.addPixels(f); pv.setColorModel(edu.mines.jtk.awt.ColorMap.JET); pv.setInterpolation(edu.mines.jtk.mosaic.PixelsView.Interpolation.NEAREST); } }
/** * Constructs a pixels view of the specified sampled functions f(x1,x2). * Assumes zero first sample values and unit sampling intervals. * Function values are converted to colors using a direct color model. * @param f array[nc][n2][n1] of sampled function values f(x1,x2), * where nc is the number (three or four) of color components. */ public PixelsView(float[][][] f) { set(f); }
/** * Adds a pixels view of the specified sampled function f(x1,x2). * Assumes zero first sample values and unit sampling intervals. * @param irow the tile row index. * @param icol the tile column index. * @param f array[nc][n2][n1] of sampled function values f(x1,x2), * where n1 = f[0][0].length, n2 = f[0].length, and nc is the * number of components. * @return the pixels view. */ public PixelsView addPixels(int irow, int icol, float[][][] f) { PixelsView pv = new PixelsView(f); return addPixelsView(irow,icol,pv); }
/** * Sets the clips for this panel. * Calling this method disables the computation of clips from percentiles. * Any clip values computed or specified previously will be forgotten. * @param clipMin the sample value corresponding to color model index 0. * @param clipMax the sample value corresponding to color model index 255. */ public void setClips(float clipMin, float clipMax) { for (int ic=0; ic<_nc; ++ic) _clips[ic].setClips(clipMin,clipMax); _p12.setClips(clipMin,clipMax); _p13.setClips(clipMin,clipMax); _p23.setClips(clipMin,clipMax); }
/** * Returns a new plot with a pixels view of a sampled function f(x1,x2). * Assumes zero first-sample values and unit sampling intervals. * @param f array[n2][n1] of sampled function values f(x1,x2), where * n1 = f[0].length and n2 = f.length. * @return the plot. */ public static SimplePlot asPixels(float[][] f) { SimplePlot plot = new SimplePlot(Origin.UPPER_LEFT); PixelsView pv = plot.addPixels(f); pv.setInterpolation(PixelsView.Interpolation.NEAREST); return plot; }