Returns a measurement result, where 'measurement' is "Area", "Mean", "StdDev", "Mode", "Min", "Max", "X", "Y", "XM", "YM", "Perim.", "BX", "BY", "Width", "Height", "Major", "Minor", "Angle", "Circ.", "Feret", "IntDen", "Median", "Skew", "Kurt", "%Area", "RawIntDen", "Ch", "Slice", "Frame", "FeretX",
(ImagePlus imp, String measurement)
| 769 | * the "limit to threshold" option. |
| 770 | */ |
| 771 | public static double getValue(ImagePlus imp, String measurement) { |
| 772 | String options = ""; |
| 773 | int index = measurement.indexOf(" "); |
| 774 | if (index>0) { |
| 775 | if (index<measurement.length()-1) |
| 776 | options = measurement.substring(index+1, measurement.length()); |
| 777 | measurement = measurement.substring(0, index); |
| 778 | } |
| 779 | int measurements = Measurements.ALL_STATS + Measurements.SLICE; |
| 780 | if (options.contains("limit")) |
| 781 | measurements += Measurements.LIMIT; |
| 782 | Calibration cal = null; |
| 783 | if (options.contains("raw")) { |
| 784 | cal = imp.getCalibration(); |
| 785 | imp.setCalibration(null); |
| 786 | } |
| 787 | ResultsTable rt = new ResultsTable(); |
| 788 | Analyzer analyzer = new Analyzer(imp, measurements, rt); |
| 789 | analyzer.measure(); |
| 790 | double value = Double.NaN; |
| 791 | try { |
| 792 | value = rt.getValue(measurement, 0); |
| 793 | } catch (Exception e) {}; |
| 794 | if (cal!=null) |
| 795 | imp.setCalibration(cal); |
| 796 | return value; |
| 797 | } |
| 798 | |
| 799 | /** Returns a reference to the "Results" window TextPanel. |
| 800 | Opens the "Results" window if it is currently not open. |
no test coverage detected