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

Method run

ij/src/main/java/ij/plugin/RoiRotator.java:27–55  ·  view source on GitHub ↗
(String arg)

Source from the content-addressed store, hash-verified

25 private static boolean rotateAroundImageCenter;
26
27 public void run(String arg) {
28 ImagePlus imp = IJ.getImage();
29 Roi roi = imp.getRoi();
30 if (roi==null) {
31 IJ.error("Rotate", "This command requires a selection");
32 return;
33 }
34 double angle = showDialog(defaultAngle);
35 if (Double.isNaN(angle))
36 return;
37 if (!IJ.macroRunning())
38 defaultAngle = angle;
39 FloatPolygon center = roi.getRotationCenter();
40 double xcenter = center.xpoints[0];
41 double ycenter = center.ypoints[0];
42 if (rotateAroundImageCenter) {
43 xcenter = imp.getWidth()/2.0;
44 ycenter = imp.getHeight()/2.0;
45 }
46 Roi roi2 = rotate(roi, angle, xcenter, ycenter);
47 if (roi2==null && (roi instanceof ImageRoi))
48 return;
49 if (!rotateAroundImageCenter)
50 roi2.setRotationCenter(xcenter,ycenter);
51 Undo.setup(Undo.ROI, imp);
52 roi = (Roi)roi.clone();
53 imp.setRoi(roi2);
54 Roi.setPreviousRoi(roi);
55 }
56
57 public double showDialog(double angle) {
58 GenericDialog gd = new GenericDialog("Rotate Selection");

Callers

nothing calls this directly

Calls 14

getImageMethod · 0.95
getRoiMethod · 0.95
errorMethod · 0.95
showDialogMethod · 0.95
macroRunningMethod · 0.95
getRotationCenterMethod · 0.95
getWidthMethod · 0.95
getHeightMethod · 0.95
rotateMethod · 0.95
setRotationCenterMethod · 0.95
setupMethod · 0.95
cloneMethod · 0.95

Tested by

no test coverage detected