(String arg)
| 26 | static boolean vertical; |
| 27 | |
| 28 | public void run(String arg) { |
| 29 | if (!showDialog()) |
| 30 | return; |
| 31 | if (imp1.getBitDepth()!=imp2.getBitDepth()) { |
| 32 | error(); |
| 33 | return; |
| 34 | } |
| 35 | imp1.setDisplayMode(IJ.COLOR); |
| 36 | imp2.setDisplayMode(IJ.COLOR); |
| 37 | if (LUT.LutsDiffer(imp1,imp2)) { |
| 38 | RGBStackConverter.convertToRGB(imp1); |
| 39 | RGBStackConverter.convertToRGB(imp2); |
| 40 | } |
| 41 | int[] dim1 = imp1.getDimensions(); |
| 42 | int[] dim2 = imp2.getDimensions(); |
| 43 | boolean isHyperStack1 = imp1.isHyperStack() || imp1.isComposite(); |
| 44 | boolean isHyperStack2 = imp2.isHyperStack() || imp2.isComposite(); |
| 45 | if (imp1.isHyperStack() || imp2.isHyperStack()) { |
| 46 | if (dim1[2]!=dim2[2] || dim1[3]!=dim2[3] || dim1[4]!=dim2[4]) { |
| 47 | IJ.error("StackCombiner", "Hyperstacks must have identical CZT dimensions"); |
| 48 | return; |
| 49 | } |
| 50 | } |
| 51 | LUT[] luts = null; |
| 52 | if (imp1.isComposite()) |
| 53 | luts = imp1.getLuts(); |
| 54 | ImageStack stack1 = imp1.getStack(); |
| 55 | ImageStack stack2 = imp2.getStack(); |
| 56 | ImageStack stack3 = vertical?combineVertically(stack1, stack2):combineHorizontally(stack1, stack2); |
| 57 | imp1.changes = false; |
| 58 | imp1.close(); |
| 59 | imp2.changes = false; |
| 60 | imp2.close(); |
| 61 | ImagePlus imp3 = imp1.createImagePlus(); |
| 62 | imp3.setStack(stack3); |
| 63 | if (isHyperStack1) |
| 64 | imp3.setDimensions(dim1[2],dim1[3],dim1[4]); |
| 65 | if (imp1.isComposite()) { |
| 66 | imp3 = new CompositeImage(imp3, imp1.getCompositeMode()); |
| 67 | imp3.setDimensions(dim1[2],dim1[3],dim1[4]); |
| 68 | if (luts!=null) |
| 69 | ((CompositeImage)imp3).setLuts(luts); |
| 70 | ((CompositeImage)imp3).resetDisplayRanges(); |
| 71 | } |
| 72 | imp3.setTitle("Combined Stacks"); |
| 73 | imp3.show(); |
| 74 | } |
| 75 | |
| 76 | public ImageStack combineHorizontally(ImageStack stack1, ImageStack stack2) { |
| 77 | int d1 = stack1.getSize(); |
nothing calls this directly
no test coverage detected