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