/** Depracated. For compatibility with previous ImageJ versions */ public void subtractBackround(ImageProcessor ip, int ballRadius) { rollingBallBackground(ip, (double)ballRadius, false, lightBackground, false, true, true); }
/** Depracated. For compatibility with previous ImageJ versions */ public void subtractBackround(ImageProcessor ip, int ballRadius) { rollingBallBackground(ip, (double)ballRadius, false, lightBackground, false, true, true); }
BackgroundSubtracter bs = new BackgroundSubtracter(); bs.rollingBallBackground(img.getProcessor(), (double)rollballsize, false, true, false, true, true); img.getProcessor().resetMinAndMax();
/** Background for any image type */ public void run(ImageProcessor ip) { if (isRGB && !separateColors) rollingBallBrightnessBackground((ColorProcessor)ip, radius, createBackground, lightBackground, useParaboloid, doPresmooth, true); else rollingBallBackground(ip, radius, createBackground, lightBackground, useParaboloid, doPresmooth, true); if (previewing && (ip instanceof FloatProcessor || ip instanceof ShortProcessor)) { ip.resetMinAndMax(); } }
/** Background for any image type */ public void run(ImageProcessor ip) { if (isRGB && !separateColors) rollingBallBrightnessBackground((ColorProcessor)ip, radius, createBackground, lightBackground, useParaboloid, doPresmooth, true); else rollingBallBackground(ip, radius, createBackground, lightBackground, useParaboloid, doPresmooth, true); if (previewing && (ip instanceof FloatProcessor || ip instanceof ShortProcessor)) { ip.resetMinAndMax(); } }
/** Create or subtract a background, based on the brightness of an RGB image (keeping * the hue of each pixel unchanged) * @param ip The RGB image. On output, it will become the background-subtracted image or * the background (depending on <code>createBackground</code>). * @param radius Radius of the rolling ball creating the background (actually a * paraboloid of rotation with the same curvature) * @param createBackground Whether to create a background, not to subtract it. * @param lightBackground Whether the image has a light background. * @param doPresmooth Whether the image should be smoothened (3x3 mean) before creating * the background. With smoothing, the background will not necessarily * be below the image data. * @param correctCorners Whether the algorithm should try to detect corner particles to avoid * subtracting them as a background. */ public void rollingBallBrightnessBackground(ColorProcessor ip, double radius, boolean createBackground, boolean lightBackground, boolean useParaboloid, boolean doPresmooth, boolean correctCorners) { int width = ip.getWidth(); int height = ip.getHeight(); byte[] H = new byte[width*height]; byte[] S = new byte[width*height]; byte[] B = new byte[width*height]; ip.getHSB(H, S, B); ByteProcessor bp = new ByteProcessor(width, height, B, null); rollingBallBackground(bp, radius, createBackground, lightBackground, useParaboloid, doPresmooth, correctCorners); ip.setHSB(H, S, (byte[])bp.getPixels()); }
/** Create or subtract a background, based on the brightness of an RGB image (keeping * the hue of each pixel unchanged) * @param ip The RGB image. On output, it will become the background-subtracted image or * the background (depending on <code>createBackground</code>). * @param radius Radius of the rolling ball creating the background (actually a * paraboloid of rotation with the same curvature) * @param createBackground Whether to create a background, not to subtract it. * @param lightBackground Whether the image has a light background. * @param doPresmooth Whether the image should be smoothened (3x3 mean) before creating * the background. With smoothing, the background will not necessarily * be below the image data. * @param correctCorners Whether the algorithm should try to detect corner particles to avoid * subtracting them as a background. */ public void rollingBallBrightnessBackground(ColorProcessor ip, double radius, boolean createBackground, boolean lightBackground, boolean useParaboloid, boolean doPresmooth, boolean correctCorners) { int width = ip.getWidth(); int height = ip.getHeight(); byte[] H = new byte[width*height]; byte[] S = new byte[width*height]; byte[] B = new byte[width*height]; ip.getHSB(H, S, B); ByteProcessor bp = new ByteProcessor(width, height, B, null); rollingBallBackground(bp, radius, createBackground, lightBackground, useParaboloid, doPresmooth, correctCorners); ip.setHSB(H, S, (byte[])bp.getPixels()); }