/** Create background for a float image by rolling a ball over * the image. */ void rollingBallFloatBackground(FloatProcessor fp, float radius, boolean invert, boolean doPresmooth, RollingBall ball) { float[] pixels = (float[])fp.getPixels(); //this will become the background boolean shrink = ball.shrinkFactor >1; showProgress(0.0); if (invert) for (int i=0; i<pixels.length; i++) pixels[i] = -pixels[i]; if (doPresmooth) filter3x3(fp, MEAN); double[] minmax = Tools.getMinMax(pixels); if (Thread.currentThread().isInterrupted()) return; FloatProcessor smallImage = shrink ? shrinkImage(fp, ball.shrinkFactor) : fp; if (Thread.currentThread().isInterrupted()) return; rollBall(ball, smallImage); if (Thread.currentThread().isInterrupted()) return; showProgress(0.9); if (shrink) enlargeImage(smallImage, fp, ball.shrinkFactor); if (Thread.currentThread().isInterrupted()) return; if (invert) for (int i=0; i<pixels.length; i++) pixels[i] = -pixels[i]; pass++; }
/** Create background for a float image by rolling a ball over * the image. */ void rollingBallFloatBackground(FloatProcessor fp, float radius, boolean invert, boolean doPresmooth, RollingBall ball) { float[] pixels = (float[])fp.getPixels(); //this will become the background boolean shrink = ball.shrinkFactor >1; showProgress(0.0); if (invert) for (int i=0; i<pixels.length; i++) pixels[i] = -pixels[i]; if (doPresmooth) filter3x3(fp, MEAN); double[] minmax = Tools.getMinMax(pixels); if (Thread.currentThread().isInterrupted()) return; FloatProcessor smallImage = shrink ? shrinkImage(fp, ball.shrinkFactor) : fp; if (Thread.currentThread().isInterrupted()) return; rollBall(ball, smallImage); if (Thread.currentThread().isInterrupted()) return; showProgress(0.9); if (shrink) enlargeImage(smallImage, fp, ball.shrinkFactor); if (Thread.currentThread().isInterrupted()) return; if (invert) for (int i=0; i<pixels.length; i++) pixels[i] = -pixels[i]; pass++; }