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

Method run

ij/src/main/java/ij/plugin/SurfacePlotter.java:42–94  ·  view source on GitHub ↗
(String arg)

Source from the content-addressed store, hash-verified

40 LookUpTable lut;
41
42 public void run(String arg) {
43 img = WindowManager.getCurrentImage();
44 if (img==null)
45 {IJ.noImage(); return;}
46 if (img.getType()==ImagePlus.COLOR_RGB)
47 {IJ.error("Surface Plotter", "Grayscale or pseudo-color image required"); return;}
48 invertedLut = img.getProcessor().isInvertedLut();
49 if (firstTime) {
50 if (invertedLut)
51 whiteBackground = true;
52 firstTime = false;
53 }
54 if (!showDialog())
55 return;
56
57 int stackFlags = IJ.setupDialog(img, 0);
58 if(stackFlags == PlugInFilter.DONE)
59 return;
60 Date start = new Date();
61 lut = img.createLut();
62
63 if (stackFlags==PlugInFilter.DOES_STACKS && img.getStack().getSize()>1){
64 ImageStack stackSource = img.getStack();
65 ImageProcessor ip = stackSource.getProcessor(1);
66 ImageProcessor plot = makeSurfacePlot(ip);
67 ImageStack stack = new ImageStack(plot.getWidth(), plot.getHeight());
68 stack.setColorModel(plot.getColorModel());
69 for (int i=1;i<=stackSource.getSize();i++)
70 stack.addSlice(null, plot.duplicate().getPixels());
71 stack.setPixels(plot.getPixels(), 1);
72 ImagePlus plots = new ImagePlus("Surface Plot", stack);
73 plots.show();
74 for (int i=2;i<=stackSource.getSize();i++) {
75 IJ.showStatus("Drawing slice " + i + "..." + " (" + (100*(i-1)/stackSource.getSize()) + "% done)");
76 ip = stackSource.getProcessor(i);
77 plot = makeSurfacePlot(ip);
78 ImageWindow win = plots.getWindow();
79 if (win!=null && win.isClosed()) break;
80 stack.setPixels(plot.getPixels(), i);
81 plots.setSlice(i);
82 }
83 } else {
84 ImageProcessor plot = makeSurfacePlot(img.getProcessor());
85 new ImagePlus("Surface Plot", plot).show();
86 }
87
88 Date end = new Date();
89 long lstart = start.getTime();
90 long lend = end.getTime();
91 long difference = lend - lstart;
92 IJ.register(SurfacePlotter.class);
93 IJ.showStatus("Done in "+difference+" msec." );
94 }
95
96 boolean showDialog() {
97 GenericDialog gd = new GenericDialog("Surface Plotter");

Callers

nothing calls this directly

Calls 15

getCurrentImageMethod · 0.95
noImageMethod · 0.95
errorMethod · 0.95
showDialogMethod · 0.95
setupDialogMethod · 0.95
getProcessorMethod · 0.95
makeSurfacePlotMethod · 0.95
getWidthMethod · 0.95
getHeightMethod · 0.95
setColorModelMethod · 0.95
getColorModelMethod · 0.95
getSizeMethod · 0.95

Tested by

no test coverage detected