Returns the profile plot as a Plot object.
()
| 121 | |
| 122 | /** Returns the profile plot as a Plot object. */ |
| 123 | public Plot getPlot() { |
| 124 | if (profile==null) |
| 125 | return null; |
| 126 | String xLabel = "Distance ("+units+")"; |
| 127 | int n = profile.length; |
| 128 | if (xValues==null) { |
| 129 | xValues = new float[n]; |
| 130 | for (int i=0; i<n; i++) |
| 131 | xValues[i] = (float)(i*xInc); |
| 132 | } |
| 133 | float[] yValues = new float[n]; |
| 134 | for (int i=0; i<n; i++) |
| 135 | yValues[i] = (float)profile[i]; |
| 136 | boolean fixedYScale = fixedMin!=0.0 || fixedMax!=0.0; |
| 137 | Plot plot = new Plot("Plot of "+getShortTitle(imp), xLabel, yLabel, xValues, yValues); |
| 138 | if (fixedYScale) { |
| 139 | double[] a = Tools.getMinMax(xValues); |
| 140 | plot.setLimits(a[0],a[1],fixedMin,fixedMax); |
| 141 | } |
| 142 | return plot; |
| 143 | } |
| 144 | |
| 145 | String getShortTitle(ImagePlus imp) { |
| 146 | String title = imp.getTitle(); |
no test coverage detected