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

Method run

ij/src/main/java/ij/plugin/ScaleBar.java:49–72  ·  view source on GitHub ↗

This method is called when the plugin is loaded. 'arg', which may be blank, is the argument specified for this plugin in IJ_Props.txt.

(String arg)

Source from the content-addressed store, hash-verified

47 * IJ_Props.txt.
48 */
49 public void run(String arg) {
50 imp = WindowManager.getCurrentImage();
51 if (imp == null) {
52 IJ.noImage();
53 return;
54 }
55 // Snapshot before anything, so we can revert if the user cancels the action.
56 imp.getProcessor().snapshot();
57 saveAndDeleteOverlayScaleBar();
58
59 userRoiExists = parseCurrentROI();
60 GenericDialog dialog = askUserConfiguration(userRoiExists);
61
62 if (dialog.wasCanceled()) {
63 removeScalebar();
64 restoreOverlayScaleBar();
65 return;
66 } else if (dialog.wasOKed()) {
67 if (!IJ.isMacro())
68 persistConfiguration();
69 updateScalebar(!config.labelAll);
70 } else //user has pressed 'remove scale bar'
71 removeScalebar();
72 }
73
74 /**
75 * Remove the scalebar drawn by this plugin.

Callers

nothing calls this directly

Calls 14

getCurrentImageMethod · 0.95
noImageMethod · 0.95
parseCurrentROIMethod · 0.95
askUserConfigurationMethod · 0.95
wasCanceledMethod · 0.95
removeScalebarMethod · 0.95
wasOKedMethod · 0.95
isMacroMethod · 0.95
persistConfigurationMethod · 0.95
updateScalebarMethod · 0.95

Tested by

no test coverage detected