(String arg)
| 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); |
nothing calls this directly
no test coverage detected