()
| 2199 | } |
| 2200 | |
| 2201 | void makeSelection() { |
| 2202 | String type = null; |
| 2203 | int roiType = -1; |
| 2204 | interp.getLeftParen(); |
| 2205 | if (isStringArg()) { |
| 2206 | type = getString().toLowerCase(); |
| 2207 | roiType = Roi.POLYGON; |
| 2208 | if (type.contains("free")) |
| 2209 | roiType = Roi.FREEROI; |
| 2210 | if (type.contains("traced")) |
| 2211 | roiType = Roi.TRACED_ROI; |
| 2212 | if (type.contains("line")) { |
| 2213 | if (type.contains("free")) |
| 2214 | roiType = Roi.FREELINE; |
| 2215 | else |
| 2216 | roiType = Roi.POLYLINE; |
| 2217 | } |
| 2218 | if (type.contains("angle")) |
| 2219 | roiType = Roi.ANGLE; |
| 2220 | if (type.contains("point")||type.contains("cross")||type.contains("circle")||type.contains("dot")) |
| 2221 | roiType = Roi.POINT; |
| 2222 | } else { |
| 2223 | roiType = (int)interp.getExpression(); |
| 2224 | if (roiType<0 || roiType==Roi.COMPOSITE) |
| 2225 | interp.error("Invalid selection type ("+roiType+")"); |
| 2226 | if (roiType==Roi.RECTANGLE) roiType = Roi.POLYGON; |
| 2227 | if (roiType==Roi.OVAL) roiType = Roi.FREEROI; |
| 2228 | } |
| 2229 | double[] x = getNextArray(); |
| 2230 | int n = x.length; |
| 2231 | interp.getComma(); |
| 2232 | double[] y = getNumericArray(); |
| 2233 | if (interp.nextToken()==',') { |
| 2234 | n = (int)getLastArg(); |
| 2235 | if (n>x.length || n>y.length) |
| 2236 | interp.error("Array too short"); |
| 2237 | } else { |
| 2238 | interp.getRightParen(); |
| 2239 | if (y.length!=n) |
| 2240 | interp.error("Arrays are not the same length"); |
| 2241 | } |
| 2242 | ImagePlus imp = getImage(); |
| 2243 | boolean floatCoordinates = false; |
| 2244 | for (int i=0; i<n; i++) { |
| 2245 | if (x[i]!=(int)x[i] || y[i]!=(int)y[i]) { |
| 2246 | floatCoordinates = true; |
| 2247 | break; |
| 2248 | } |
| 2249 | } |
| 2250 | int[] xcoord = null; |
| 2251 | int[] ycoord = null; |
| 2252 | float[] xfcoord = null; |
| 2253 | float[] yfcoord = null; |
| 2254 | if (floatCoordinates) { |
| 2255 | xfcoord = new float[n]; |
| 2256 | yfcoord = new float[n]; |
| 2257 | for (int i=0; i<n; i++) { |
| 2258 | xfcoord[i] = (float)x[i]; |
no test coverage detected