private ComboItemListener<KernelData> newFilterAction() { return new ComboItemListener<KernelData>(ActionW.FILTER, KernelData.getAllFilters()) { @Override public void itemStateChanged(Object object) { if (object instanceof KernelData) { firePropertyChange(ActionW.SYNCH.cmd(), null, new SynchEvent(getSelectedViewPane(), action.cmd(), object)); } } }; }
public static List<AbbreviationUnit> getAbbreviationUnits() { ArrayList<AbbreviationUnit> units = new ArrayList<>(); for (Unit u : Unit.values()) { if (u.getId() != Unit.PIXEL.getId()) { units.add(new AbbreviationUnit(u)); } } return units; }
/** * Returns the abbreviation of the unit. * * @return the abbreviation of the unit */ @Override public String toString() { return unit.getAbbreviation(); }
public KernelData(String name, boolean morphologicalFilter, int width, int height, int xOrigin, int yOrigin, float[] data, int divisor) { this.name = name; this.morphologicalFilter = morphologicalFilter; this.width = width; this.height = height; setXOrigin(xOrigin); setYOrigin(yOrigin); this.divisor = divisor; this.data = divideKernel(data); }
public static double corrCoef(double[] xVal, double[] yVal) { double r = 0.0D; double mX = mean(xVal); double mY = mean(yVal); double sdX = stDev(xVal, mX); double sdY = stDev(yVal, mY); for (int i = 0; i < xVal.length; i++) { r += ((xVal[i] - mX) * (yVal[i] - mY)) / (sdX * sdY); } r /= (xVal.length - 1); return r; }
public static final float[] getDataFloat(DataBuffer dataBuffer) { return (float[]) invokeDataBufferMethod(dataBuffer, "getData", null, null); //$NON-NLS-1$ }
public static final KernelData gaussianKernel(String name, int nx, int ny) { int x = nx; int y = ny; if (x % 2 == 0) { x++; } if (y % 2 == 0) { y++; } float sigmax = (x - 1) / 6F; float sigmay = (y - 1) / 6F; return gaussianKernel(name, sigmax, sigmay); }
private static double moment(double[] x, int order) { if (x == null || order == 1) { return Double.NaN; } else { double mu = mean(x); double sum = 0; for (int i = 0; i < x.length; i++) { sum += Math.pow(x[i] - mu, order); } return sum / (x.length - 1); } }
@Override public float[] fromRGB(float[] rgbvalue) { float[] xyz = CIEXYZ.fromRGB(rgbvalue); return fromCIEXYZ(xyz); }
private ComboItemListener<KernelData> newFilterAction() { return new ComboItemListener<KernelData>(ActionW.FILTER, KernelData.getAllFilters()) { @Override public void itemStateChanged(Object object) { if (object instanceof KernelData) { firePropertyChange(ActionW.SYNCH.cmd(), null, new SynchEvent(getSelectedViewPane(), action.cmd(), object)); } } }; }
public static final float[][] getBankDataFloat(DataBuffer dataBuffer) { return (float[][]) invokeDataBufferMethod(dataBuffer, "getBankData", null, null); //$NON-NLS-1$ }
public static final double[][] getBankDataDouble(DataBuffer dataBuffer) { return (double[][]) invokeDataBufferMethod(dataBuffer, "getBankData", null, null); //$NON-NLS-1$ }
public static final double[] getDataDouble(DataBuffer dataBuffer) { return (double[]) invokeDataBufferMethod(dataBuffer, "getData", null, null); //$NON-NLS-1$ }
public static final double[] getDataDouble(DataBuffer dataBuffer, int bank) { return (double[]) invokeDataBufferMethod(dataBuffer, "getData", new Class[] { int.class }, //$NON-NLS-1$ new Object[] { new Integer(bank) }); } }