/** Converts a number to a formatted string using 2 digits to the right of the decimal point. */ public static String d2s(double n) { return d2s(n, 2); }
public String toString() // Use a format that is compatible with file names. { return "S s"+sigmas+" tau1"+tau1+" tau2"+tau2 +" N"+N+" n"+n+" i"+i+" w"+w+" ("+IJ.d2s(density*100,2)+"%)"; } public void filterAll(ImageStack stack, int center, float sigmas)
public String toString() { return "FJ s"+sigmas+" t"+sigmat+" tau"+tau+" maxamp"+maxampFraction*100+"% cond"+conditionLimit +" resid"+residualThreshold+" ("+IJ.d2s(density*100,2)+"%)"; } public int getWidth()
public String toString() // Use a format that is compatible with file names. { return "U s"+sigmas+" t"+sigmat+" tau"+ tau+" region"+region+" ("+IJ.d2s(density*100,2)+"%) (support="+support+")"; } public void filterAll(ImageStack is, int center, float sigmat, float sigmas)
public void clipboard(PrintWriter pw) /* Copy the error statistics to the clipboard in MS Excel readable format. */ { pw.print("v-ang\t" + "psi "+flow.toString() + "\tstddev\tdelta l" +"\tdelta angle\tdensity\n"); for (int i = 0; i < binNr; i++) pw.print(IJ.d2s(i*binWidth, 2) + "\t" + IJ.d2s(binPsi[i], 2) + "\t" + IJ.d2s(binStdDev[i], 2) + "\t" + IJ.d2s(binDeltaLength[i], 2) + "\t" + IJ.d2s(binDeltaAngle[i], 2) + "\t" + IJ.d2s(density[i]*100,3)+"%\n"); } }
void addText() { double value2 = (double)value/1048576L; String s = IJ.d2s(value2,value2>50?0:2)+"MB"; if (maxMemory>0L) { double percent = value*100/maxMemory; s += " ("+(percent<1.0?"<1":IJ.d2s(percent,0)) + "%)"; } g.drawString(s, 2, 15); String images = ""+WindowManager.getImageCount(); g.drawString(images, WIDTH-(5+images.length()*8), 15); }
private String d2s(double n) { int digits = Tools.getDecimalPlaces(n); if (digits>2) digits=2; return IJ.d2s(n,digits); }
/** Experimental */ public static String time(ImagePlus imp, long startNanoTime) { double planes = imp.getStackSize(); double seconds = (System.nanoTime()-startNanoTime)/1000000000.0; double mpixels = imp.getWidth()*imp.getHeight()*planes/1000000.0; String time = seconds<1.0?d2s(seconds*1000.0,0)+" ms":d2s(seconds,1)+" seconds"; return time+", "+d2s(mpixels/seconds,1)+" million pixels/second"; }
/** Display the contents of the edge table*/ void printEdges() { for (int i=0; i<edges; i++) { int index = sedge[i]; IJ.log(i+" "+ex[index]+" "+ey1[index]+" "+ey2[index] + " " + IJ.d2s(eslope[index],2) ); } }
/** * Prints an HTML table entry onto the stream. */ protected void printTableRow(PrintWriter out, String name, double number, int decimalPlaces) { String stringNum = IJ.d2s(number, decimalPlaces); printTableRow(out, name, stringNum); }
void setWidth(float width) { Vector numericFields = gd.getNumericFields(); TextField widthField = (TextField)numericFields.elementAt(0); widthField.setText(IJ.d2s(width,1)); Vector sliders = gd.getSliders(); Scrollbar sb = (Scrollbar)sliders.elementAt(0); sb.setValue((int)(width+0.5f)); }
public void updateFromResults(final ShollResults results) { dendriteMaximumLabel.setText("" + results.getDendriteMaximum()); criticalValuesLabel.setText(IJ.d2s(results.getCriticalValue(), 3)); shollsRegressionCoefficientLabel.setText(IJ.d2s(results.getShollRegressionCoefficient(), -3)); shollsRegressionInterceptLabel.setText(IJ.d2s(results.getRegressionIntercept(), 3)); shollsRegressionRSquaredLabel.setText(IJ.d2s(results.getRegressionRSquare(), 3)); } }
String doToString() { String s = getFirstString(); interp.getToken(); if (interp.token==',') { double value = Tools.parseDouble(s); s = IJ.d2s(value, (int)interp.getExpression()); interp.getToken(); } if (interp.token!=')') interp.error("')' expected"); return s; }