importClass(Packages.ij.plugin.filter.GaussianBlur); var imp = IJ.openImage("http://imagej.nih.gov/ij/images/clown.jpg"); IJ.run(imp, "8-bit", ""); var ip = imp.getProcessor(); var gs = new GaussianBlur(); gs.blurGaussian(ip,20,20,0.01); imp.show();
/** Since most computing time is spent in GaussianBlur, forward the * information about the number of passes to Gaussian Blur. The * ProgressBar will be handled by GaussianBlur. */ public void setNPasses(int nPasses) { if (gb == null) gb = new GaussianBlur(); gb.setNPasses(nPasses); } }
@Override public ImageProcessor process(ImageProcessor ip) { ij.plugin.filter.GaussianBlur g = new ij.plugin.filter.GaussianBlur(); g.blurGaussian(ip, sigmaX, sigmaY, accuracy); return ip; }
/** Since most computing time is spent in GaussianBlur, forward the * information about the number of passes to Gaussian Blur. The * ProgressBar will be handled by GaussianBlur. */ public void setNPasses(int nPasses) { if (gb == null) gb = new GaussianBlur(); gb.setNPasses(nPasses); } }
/** * Smooth with a Gaussian kernel that represents downsampling at a given * scale factor and sourceSigma. */ final static public void smoothForScale( final ImageProcessor source, final float scale, final float sourceSigma, final float targetSigma ) { if ( scale >= 1.0f ) return; float s = targetSigma / scale; float sigma = ( float )Math.sqrt( s * s - sourceSigma * sourceSigma ); new GaussianBlur().blurGaussian( source, sigma, sigma, 0.01 ); }
@Override public void start(Stage primaryStage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("/views/main.fxml")); Scene scene = new Scene(root); scene.getStylesheets().add(this.getClass().getResource("/style/main.css").toExternalForm()); primaryStage.setScene(scene); primaryStage.show(); windowMain = primaryStage; root.setEffect(new GaussianBlur()); loginWindow.display(); root.setEffect(null); }
int[] smooth(int[] a, int n) { FloatProcessor fp = new FloatProcessor(n, 1); for (int i=0; i<n; i++) fp.putPixelValue(i, 0, a[i]); GaussianBlur gb = new GaussianBlur(); gb.blur1Direction(fp, 2.0, 0.01, true, 0); for (int i=0; i<n; i++) a[i] = (int)Math.round(fp.getPixelValue(i, 0)); return a; }
/** Blurs the image by convolving with a Gaussian function. */ public void blurGaussian(double sigma) { resetRoi(); GaussianBlur gb = new GaussianBlur(); gb.showProgress(false); gb.blurGaussian(this, sigma); }
int[] smooth(int[] a, int n) { FloatProcessor fp = new FloatProcessor(n, 1); for (int i=0; i<n; i++) fp.putPixelValue(i, 0, a[i]); GaussianBlur gb = new GaussianBlur(); gb.blur1Direction(fp, 2.0, 0.01, true, 0); for (int i=0; i<n; i++) a[i] = (int)Math.round(fp.getPixelValue(i, 0)); return a; }
/** Unsharp Mask filtering of a float image. 'fp' must have a valid snapshot. */ public void sharpenFloat(FloatProcessor fp, double sigma, float weight) { if (gb == null) gb = new GaussianBlur(); gb.blurGaussian(fp, sigma, sigma, 0.01); if (Thread.currentThread().isInterrupted()) return; float[] pixels = (float[])fp.getPixels(); float[] snapshotPixels = (float[])fp.getSnapshotPixels(); int width = fp.getWidth(); Rectangle roi = fp.getRoi(); for (int y=roi.y; y<roi.y+roi.height; y++) for (int x=roi.x, p=width*y+x; x<roi.x+roi.width; x++,p++) pixels[p] = (snapshotPixels[p] - weight*pixels[p])/(1f - weight); }
/** Blurs the image by convolving with a Gaussian function. */ public void blurGaussian(double sigma) { resetRoi(); GaussianBlur gb = new GaussianBlur(); gb.showProgress(false); gb.blurGaussian(this, sigma); }
/** Unsharp Mask filtering of a float image. 'fp' must have a valid snapshot. */ public void sharpenFloat(FloatProcessor fp, double sigma, float weight) { if (gb == null) gb = new GaussianBlur(); gb.blurGaussian(fp, sigma, sigma, 0.01); if (Thread.currentThread().isInterrupted()) return; float[] pixels = (float[])fp.getPixels(); float[] snapshotPixels = (float[])fp.getSnapshotPixels(); int width = fp.getWidth(); Rectangle roi = fp.getRoi(); for (int y=roi.y; y<roi.y+roi.height; y++) for (int x=roi.x, p=width*y+x; x<roi.x+roi.width; x++,p++) pixels[p] = (snapshotPixels[p] - weight*pixels[p])/(1f - weight); }
public ImagePlus call(){ ImageProcessor ip = originalImage.getProcessor().duplicate(); GaussianBlur gs = new GaussianBlur(); //gs.blur(ip, sigma); gs.blurGaussian(ip, 0.4 * sigma, 0.4 * sigma, 0.0002); return new ImagePlus (availableFeatures[GAUSSIAN] + "_" + sigma, ip); } };
float[] smooth(float[] a, int n) { FloatProcessor fp = new FloatProcessor(n, 1); for (int i=0; i<n; i++) fp.setf(i, 0, a[i]); GaussianBlur gb = new GaussianBlur(); gb.blur1Direction(fp, 2.0, 0.01, true, 0); for (int i=0; i<n; i++) a[i] = fp.getf(i, 0); return a; }
public ImagePlus call(){ ImageProcessor ip = originalImage.getProcessor().duplicate(); GaussianBlur gs = new GaussianBlur(); //gs.blur(ip, sigma); gs.blurGaussian(ip, 0.4 * sigma, 0.4 * sigma, 0.0002); return new ImagePlus (availableFeatures[GAUSSIAN] + "_" + sigma, ip); } };
/** WARNING will resize the FloatProcessorT2 source in place, unlike ImageJ standard FloatProcessor class. */ static final private byte[] gaussianBlurResizeInHalf(final FloatProcessorT2 source) { new GaussianBlur().blurFloat( source, SIGMA_2, SIGMA_2, 0.01 ); source.halfSizeInPlace(); return (byte[])source.convertToByte(false).getPixels(); // no scaling }
float[] smooth(float[] a, int n) { FloatProcessor fp = new FloatProcessor(n, 1); for (int i=0; i<n; i++) fp.setf(i, 0, a[i]); GaussianBlur gb = new GaussianBlur(); gb.blur1Direction(fp, 2.0, 0.01, true, 0); for (int i=0; i<n; i++) a[i] = fp.getf(i, 0); return a; }
/** * Add Gaussian blur slice to current stack * @param sigma Gaussian radius */ public void addGaussianBlur(float sigma) { ImageProcessor ip = originalImage.getProcessor().duplicate(); GaussianBlur gs = new GaussianBlur(); //gs.blur(ip, sigma); gs.blurGaussian(ip, 0.4 * sigma, 0.4 * sigma, 0.0002); wholeStack.addSlice(availableFeatures[GAUSSIAN] + "_" + sigma, ip); } /**
/** * Add Gaussian blur slice to current stack * @param sigma Gaussian radius */ public void addGaussianBlur(float sigma) { ImageProcessor ip = originalImage.getProcessor().duplicate(); GaussianBlur gs = new GaussianBlur(); //gs.blur(ip, sigma); gs.blurGaussian(ip, 0.4 * sigma, 0.4 * sigma, 0.0002); wholeStack.addSlice(availableFeatures[GAUSSIAN] + "_" + sigma, ip); } /**
/** * Gaussian-downsample to the target dimensions * @param ip * @return */ protected FloatProcessor gaussianDownsampled( final FloatProcessor ip ) { loader.releaseToFit( ( (float[])ip.getPixels() ).length * 2 ); // Gaussian-downsample final double sigma = computeSigma( ip.getWidth(), ip.getHeight() ); Utils.log("Gaussian downsampling. If this is slow, check the number of threads in the plugin preferences."); new GaussianBlur().blurFloat( ip, sigma, sigma, 0.0002 ); ip.setInterpolationMethod( ImageProcessor.NEAREST_NEIGHBOR ); return (FloatProcessor) ip.resize( ( int ) Math.ceil( finalBox.width * scale ) ); }