/** * Throws StoppedByUserException if IJ.escapePressed flag is true. Does not * reset the flag. */ public static void checkIJEscapePressed() throws StoppedByUserException { if(IJ.escapePressed()) { throw new StoppedByUserException("Escape pressed"); } }
public void run(ImageProcessor ip) { rank(ip, radius, filterType, whichOutliers, (float)threshold); if (IJ.escapePressed()) // interrupted by user? ip.reset(); }
public void run(ImageProcessor ip) { rank(ip, radius, filterType, whichOutliers, (float)threshold); if (IJ.escapePressed()) // interrupted by user? ip.reset(); }
void doIterations (ImageProcessor ip, String mode) { if (escapePressed) return; if (!previewing && iterations>1) IJ.showStatus(arg+"... press ESC to cancel"); for (int i=0; i<iterations; i++) { if (Thread.currentThread().isInterrupted()) return; if (IJ.escapePressed()) { escapePressed = true; ip.reset(); return; } if (mode.equals("erode")) ((ByteProcessor)ip).erode(count, background); else ((ByteProcessor)ip).dilate(count, background); } }
void doIterations (ImageProcessor ip, String mode) { if (escapePressed) return; if (!previewing && iterations>1) IJ.showStatus(arg+"... press ESC to cancel"); for (int i=0; i<iterations; i++) { if (Thread.currentThread().isInterrupted()) return; if (IJ.escapePressed()) { escapePressed = true; ip.reset(); return; } if (mode.equals("erode")) ((ByteProcessor)ip).erode(count, background); else ((ByteProcessor)ip).dilate(count, background); } }
if(IJ.escapePressed()){ break;
IJ.log(names[i]+": "+e); if (IJ.escapePressed()) {IJ.beep(); break;};
IJ.log(names[i]+": "+e); if (IJ.escapePressed()) {IJ.beep(); break;};
int startingCount = WindowManager.getImageCount(); for (int i=0; i<list.length; i++) { if (IJ.escapePressed()) break; String path = inputPath + list[i]; if (IJ.debugMode) IJ.log(i+": "+path);
@Override public void run() { parser.parse(); if (IJ.escapePressed()) { IJ.showStatus("Canceling Parsing..."); parser.terminate(); } if (!parser.successful()) { IJ.showStatus("No valid profile retrieved."); return; } setProfile(parser.getProfile()); } }
void processVirtualStack(String outputPath) { ImageStack stack = virtualStack.getStack(); int n = stack.getSize(); int index = 0; for (int i=1; i<=n; i++) { if (IJ.escapePressed()) break; IJ.showProgress(i, n); ImageProcessor ip = stack.getProcessor(i); if (ip==null) return; ImagePlus imp = new ImagePlus(i+"/"+stack.getSize(), ip); if (!macro.equals("")) { if (!runMacro("i="+(index++)+";"+"n="+stack.getSize()+";"+macro, imp)) break; } if (saveOutput && !outputPath.equals("")) { if (format.equals("8-bit TIFF") || format.equals("GIF")) { if (imp.getBitDepth()==24) IJ.run(imp, "8-bit Color", "number=256"); else IJ.run(imp, "8-bit", ""); } IJ.saveAs(imp, format, outputPath+pad(i)); } saveOutput = true; imp.close(); } if (outputPath!=null && !outputPath.equals("")) IJ.run("Image Sequence...", "open=[" + outputPath + "]"+" use"); }
void processVirtualStack(String outputPath) { ImageStack stack = virtualStack.getStack(); int n = stack.getSize(); int index = 0; for (int i=1; i<=n; i++) { if (IJ.escapePressed()) break; IJ.showProgress(i, n); ImageProcessor ip = stack.getProcessor(i); if (ip==null) return; ImagePlus imp = new ImagePlus(i+"/"+stack.getSize(), ip); if (!macro.equals("")) { if (!runMacro("i="+(index++)+";"+"n="+stack.getSize()+";"+macro, imp)) break; } if (saveOutput && !outputPath.equals("")) { if (format.equals("8-bit TIFF") || format.equals("GIF")) { if (imp.getBitDepth()==24) IJ.run(imp, "8-bit Color", "number=256"); else IJ.run(imp, "8-bit", ""); } IJ.saveAs(imp, format, outputPath+pad(i)); } saveOutput = true; imp.close(); } if (outputPath!=null && !outputPath.equals("")) IJ.run("Image Sequence...", "open=[" + outputPath + "]"+" use"); }
public void runLipschitz(ImageProcessor ip) { if (IJ.escapePressed()) return; breaked = false; Date d1, d2; d1 = new Date(); IJ.showStatus("Initializing..."); m_stack_out = m_imp.createEmptyStack(); ImagePlus imp2 = null; for(int i = 0; ((i < m_scount) && (!breaked)); i++) { if (m_scount >1) { ip = m_stack.getProcessor(i+1); } iptmp = ip.createProcessor(ImageWidth, ImageHeight); iptmp.copyBits(ip, 0, 0, Blitter.COPY); IJ.showStatus("Filtering "+ (i+1)+ "/"+m_scount +" slice."); Lipschitz2D(iptmp); m_stack_out.addSlice(m_imp.getShortTitle()+" "+(i+1)+"/"+m_scount, iptmp); if (breaked = IJ.escapePressed()) IJ.beep(); } imp2 = new ImagePlus(m_imp.getShortTitle()+" Filtered (Lipschitz) Slope:"+m_Slope+" "+((m_Down)?" -Down":" ")+" "+((m_TopHat)?" -TopHat":" ")+((breaked)?" -INTERUPTED":""), m_stack_out); imp2.show(); imp2.updateAndDraw(); IJ.showProgress(1.0); } // end of 'runLipschitz' method
public void runLipschitz(ImageProcessor ip) { if (IJ.escapePressed()) return; breaked = false; Date d1, d2; d1 = new Date(); IJ.showStatus("Initializing..."); m_stack_out = m_imp.createEmptyStack(); ImagePlus imp2 = null; for(int i = 0; ((i < m_scount) && (!breaked)); i++) { if (m_scount >1) { ip = m_stack.getProcessor(i+1); } iptmp = ip.createProcessor(ImageWidth, ImageHeight); iptmp.copyBits(ip, 0, 0, Blitter.COPY); IJ.showStatus("Filtering "+ (i+1)+ "/"+m_scount +" slice."); Lipschitz2D(iptmp); m_stack_out.addSlice(m_imp.getShortTitle()+" "+(i+1)+"/"+m_scount, iptmp); if (breaked = IJ.escapePressed()) IJ.beep(); } imp2 = new ImagePlus(m_imp.getShortTitle()+" Filtered (Lipschitz) Slope:"+m_Slope+" "+((m_Down)?" -Down":" ")+" "+((m_TopHat)?" -TopHat":" ")+((breaked)?" -INTERUPTED":""), m_stack_out); imp2.show(); imp2.updateAndDraw(); IJ.showProgress(1.0); } // end of 'runLipschitz' method
public void run(ImageProcessor ip) { if (arg.equals("demo")) { IJ.resetEscape(); while (!IJ.escapePressed()) { north(ip); imp.updateAndDraw(); ip.reset(); northeast(ip); imp.updateAndDraw(); ip.reset(); east(ip); imp.updateAndDraw(); ip.reset(); southeast(ip); imp.updateAndDraw(); ip.reset(); south(ip); imp.updateAndDraw(); ip.reset(); southwest(ip); imp.updateAndDraw(); ip.reset(); west(ip); imp.updateAndDraw(); ip.reset(); northwest(ip); imp.updateAndDraw(); ip.reset(); } } else if (arg.equals("north")) north(ip); else if (arg.equals("northeast")) northeast(ip); else if (arg.equals("east")) east(ip); else if (arg.equals("southeast")) southeast(ip); else if (arg.equals("south")) south(ip); else if (arg.equals("southwest")) southwest(ip); else if (arg.equals("west")) west(ip); else if (arg.equals("northwest")) northwest(ip); }
public void run(ImageProcessor ip) { if (arg.equals("demo")) { IJ.resetEscape(); while (!IJ.escapePressed()) { north(ip); imp.updateAndDraw(); ip.reset(); northeast(ip); imp.updateAndDraw(); ip.reset(); east(ip); imp.updateAndDraw(); ip.reset(); southeast(ip); imp.updateAndDraw(); ip.reset(); south(ip); imp.updateAndDraw(); ip.reset(); southwest(ip); imp.updateAndDraw(); ip.reset(); west(ip); imp.updateAndDraw(); ip.reset(); northwest(ip); imp.updateAndDraw(); ip.reset(); } } else if (arg.equals("north")) north(ip); else if (arg.equals("northeast")) northeast(ip); else if (arg.equals("east")) east(ip); else if (arg.equals("southeast")) southeast(ip); else if (arg.equals("south")) south(ip); else if (arg.equals("southwest")) southwest(ip); else if (arg.equals("west")) west(ip); else if (arg.equals("northwest")) northwest(ip); }
/** Process a stack or part of it. The slice given by class variable * processedAsPreview remains unchanged. * @param firstSlice Slice number of the first slice to be processed * @param endSlice Slice number of the last slice to be processed */ private void processStack(int firstSlice, int endSlice) { ImageStack stack = imp.getStack(); ImageProcessor ip = stack.getProcessor(firstSlice); prepareProcessor(ip, imp); ip.setLineWidth(Line.getWidth()); //in contrast to imp.getProcessor, stack.getProcessor does not do this FloatProcessor fp = null; int slices = imp.getNSlices(); for (int i=firstSlice; i<=endSlice; i++) { if (i != processedAsPreview) { announceSliceNumber(i); ip.setPixels(stack.getPixels(i)); ip.setSliceNumber(i); processOneImage(ip, fp, false); if (IJ.escapePressed()) {IJ.beep(); break;} } } }
/** Process a stack or part of it. The slice given by class variable * processedAsPreview remains unchanged. * @param firstSlice Slice number of the first slice to be processed * @param endSlice Slice number of the last slice to be processed */ private void processStack(int firstSlice, int endSlice) { ImageStack stack = imp.getStack(); ImageProcessor ip = stack.getProcessor(firstSlice); prepareProcessor(ip, imp); ip.setLineWidth(Line.getWidth()); //in contrast to imp.getProcessor, stack.getProcessor does not do this FloatProcessor fp = null; int slices = imp.getNSlices(); for (int i=firstSlice; i<=endSlice; i++) { if (i != processedAsPreview) { announceSliceNumber(i); ip.setPixels(stack.getPixels(i)); ip.setSliceNumber(i); processOneImage(ip, fp, false); if (IJ.escapePressed()) {IJ.beep(); break;} } } }
for (int i=0; i<rois.length; i++) { IJ.showProgress(i, rois.length-1); if (IJ.escapePressed()) { IJ.showProgress(1.0); return;
for (int i=0; i<rois.length; i++) { IJ.showProgress(i, rois.length-1); if (IJ.escapePressed()) { IJ.showProgress(1.0); return;