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

Method run

ij/src/main/java/ij/plugin/StackCombiner.java:28–74  ·  view source on GitHub ↗
(String arg)

Source from the content-addressed store, hash-verified

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();

Callers

nothing calls this directly

Calls 15

showDialogMethod · 0.95
errorMethod · 0.95
LutsDifferMethod · 0.95
convertToRGBMethod · 0.95
errorMethod · 0.95
combineVerticallyMethod · 0.95
combineHorizontallyMethod · 0.95
setStackMethod · 0.95
setDimensionsMethod · 0.95
setTitleMethod · 0.95
showMethod · 0.95
isCompositeMethod · 0.80

Tested by

no test coverage detected