Ejemplo n.º 1
0
 public void run(ImageProcessor ip) {
   if (enlarge && gd.wasOKed())
     synchronized (this) {
       if (!isEnlarged) {
         enlargeCanvas();
         isEnlarged = true;
       }
     }
   if (isEnlarged) { // enlarging may have made the ImageProcessor invalid, also for the parallel
                     // threads
     int slice = pfr.getSliceNumber();
     if (imp.getStackSize() == 1) ip = imp.getProcessor();
     else ip = imp.getStack().getProcessor(slice);
   }
   ip.setInterpolationMethod(interpolationMethod);
   if (fillWithBackground) {
     Color bgc = Toolbar.getBackgroundColor();
     if (bitDepth == 8) ip.setBackgroundValue(ip.getBestIndex(bgc));
     else if (bitDepth == 24) ip.setBackgroundValue(bgc.getRGB());
   } else ip.setBackgroundValue(0);
   ip.rotate(angle);
   if (!gd.wasOKed()) drawGridLines(gridLines);
   if (isEnlarged && imp.getStackSize() == 1) {
     imp.changes = true;
     imp.updateAndDraw();
     Undo.setup(Undo.COMPOUND_FILTER_DONE, imp);
   }
 }
Ejemplo n.º 2
0
 public void run(String arg) {
   imp = IJ.getImage();
   Roi roi = imp.getRoi();
   if (roi != null && !roi.isArea()) imp.killRoi(); // ignore any line selection
   ImageProcessor ip = imp.getProcessor();
   if (!showDialog(ip)) return;
   if (ip.getWidth() > 1 && ip.getHeight() > 1) ip.setInterpolate(interpolate);
   else ip.setInterpolate(false);
   ip.setBackgroundValue(bgValue);
   imp.startTiming();
   try {
     if (newWindow && imp.getStackSize() > 1 && processStack) createNewStack(imp, ip);
     else scale(ip);
   } catch (OutOfMemoryError o) {
     IJ.outOfMemory("Scale");
   }
   IJ.showProgress(1.0);
 }