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

Method run

ij/src/main/java/ij/plugin/StackMaker.java:18–52  ·  view source on GitHub ↗
(String arg)

Source from the content-addressed store, hash-verified

16 private int border;
17
18 public void run(String arg) {
19 ImagePlus imp = WindowManager.getCurrentImage();
20 if (imp==null) {
21 IJ.noImage();
22 return;
23 }
24 if (imp.getStackSize()>1) {
25 IJ.error("This command requires a montage");
26 return;
27 }
28 String options = Macro.getOptions();
29 if (options!=null) {
30 options = options.replace("images_per_row=", "columns=");
31 options = options.replace("images_per_column=", "rows=");
32 }
33 columns = info("xMontage", imp, 2);
34 rows = info("yMontage", imp, 2);
35 String montageHeight = (String)imp.getProperty("yMontage");
36 if (montageHeight!=null)
37 rows = Integer.parseInt(montageHeight);
38 GenericDialog gd = new GenericDialog("Stack Maker");
39 gd.addNumericField("Columns: ", columns, 0);
40 gd.addNumericField("Rows: ", rows, 0);
41 gd.addNumericField("Border width: ", border, 0);
42 gd.showDialog();
43 if (gd.wasCanceled())
44 return;
45 columns = (int)gd.getNextNumber();
46 rows = (int)gd.getNextNumber();
47 border = (int)gd.getNextNumber();
48 if (rows==0 || columns==0)
49 return;
50 ImageStack stack = makeStack(imp.getProcessor(), rows, columns, border);
51 new ImagePlus("Stack", stack).show();
52 }
53
54 private int info(String key, ImagePlus imp, int value) {
55 String svalue = imp.getStringProperty(key);

Callers

nothing calls this directly

Calls 15

getCurrentImageMethod · 0.95
noImageMethod · 0.95
getStackSizeMethod · 0.95
errorMethod · 0.95
getOptionsMethod · 0.95
infoMethod · 0.95
getPropertyMethod · 0.95
addNumericFieldMethod · 0.95
showDialogMethod · 0.95
wasCanceledMethod · 0.95
getNextNumberMethod · 0.95
makeStackMethod · 0.95

Tested by

no test coverage detected