MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / fitSpline

Method fitSpline

ij/src/main/java/ij/plugin/Selection.java:265–294  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

263 }
264
265 void fitSpline() {
266 Roi roi = imp.getRoi();
267 if (roi==null)
268 {noRoi("Spline"); return;}
269 int type = roi.getType();
270 boolean segmentedSelection = type==Roi.POLYGON||type==Roi.POLYLINE;
271 if (!(segmentedSelection||type==Roi.FREEROI||type==Roi.TRACED_ROI||type==Roi.FREELINE))
272 {IJ.error("Spline Fit", "Polygon or polyline selection required"); return;}
273 if (roi instanceof EllipseRoi)
274 return;
275 PolygonRoi p = (PolygonRoi)roi;
276 p = (PolygonRoi)p.clone();
277 Undo.setup(Undo.ROI, imp);
278 if (!segmentedSelection && p.getNCoordinates()>3) {
279 if (p.subPixelResolution())
280 p = trimFloatPolygon(p, p.getUncalibratedLength());
281 else
282 p = trimPolygon(p, p.getUncalibratedLength());
283 }
284 String options = Macro.getOptions();
285 if (options!=null && options.indexOf("straighten")!=-1)
286 p.fitSplineForStraightening();
287 else if (options!=null && options.indexOf("remove")!=-1)
288 p.removeSplineFit();
289 else
290 p.fitSpline();
291 imp.setRoi(p);
292 imp.draw();
293 LineWidthAdjuster.update();
294 }
295
296 void interpolate() {
297 Roi roi = imp.getRoi();

Callers 1

runMethod · 0.95

Calls 15

noRoiMethod · 0.95
getTypeMethod · 0.95
errorMethod · 0.95
cloneMethod · 0.95
setupMethod · 0.95
getNCoordinatesMethod · 0.95
trimFloatPolygonMethod · 0.95
getUncalibratedLengthMethod · 0.95
trimPolygonMethod · 0.95
getOptionsMethod · 0.95
removeSplineFitMethod · 0.95

Tested by

no test coverage detected