当前位置: 首页>>代码示例>>Java>>正文


Java GaussianBlur类代码示例

本文整理汇总了Java中ij.plugin.filter.GaussianBlur的典型用法代码示例。如果您正苦于以下问题:Java GaussianBlur类的具体用法?Java GaussianBlur怎么用?Java GaussianBlur使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GaussianBlur类属于ij.plugin.filter包,在下文中一共展示了GaussianBlur类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Create_Gaussian_Image

import ij.plugin.filter.GaussianBlur; //导入依赖的package包/类
/**
 * Create the filtered images
 *
 * @param stack2: new duplicated stack image from the Original Stack Image
 * @param sigmaX  : Sigma value for the X axis
 * @param sigmaY  : Sigma value for the Y axis
 * @return : returns the image obtained after applying the Gaussian Filter
 */

public ImageStack Create_Gaussian_Image(ImageStack stack2, double sigmaX, double sigmaY) {

    int slice;                                                     // Define the type of slice
    int size3_ = stack2.getSize();                                 // Size of the stack image
    ImageProcessor ip_Gauss;                                       // Work on the duplicated images.
    GaussianBlur blurimg = new GaussianBlur();                     // Create ImageType
    ImageStack Gauss_Stack = stack2.duplicate();                   // We duplicate the original stack image .Create new empty stack to put the pixel values obtained after blurring blur

    for (slice = 1; slice <= size3_; slice++) {                    // Go through each slice
        ip_Gauss = Gauss_Stack.getProcessor(slice);                     // Returns an ImageProcessor for the specified slice using the Original stack image
        blurimg.blurGaussian(ip_Gauss, sigmaX, sigmaY, 0.01);      // Apply the blurring on the given slice
    }
    return Gauss_Stack;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:24,代码来源:OBS_SME_Plugin_GUI.java

示例2: createSpots

import ij.plugin.filter.GaussianBlur; //导入依赖的package包/类
private static float[] createSpots(int size, int n, int min, int max, double sigmaX, double sigmaY)
{
	float[] data = new float[size * size];
	// Randomly put on spots
	RandomDataGenerator rg = new RandomDataGenerator(rand);
	while (n-- > 0)
	{
		data[rand.nextInt(data.length)] = rg.nextInt(min, max);
	}

	// Blur
	FloatProcessor fp = new FloatProcessor(size, size, data);
	GaussianBlur gb = new GaussianBlur();
	gb.blurFloat(fp, sigmaX, sigmaY, 0.0002);

	return (float[]) fp.getPixels();
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:18,代码来源:FindFociTest.java

示例3: createSpots3D

import ij.plugin.filter.GaussianBlur; //导入依赖的package包/类
private static float[][] createSpots3D(int size, int z, int n, int min, int max, double sigmaX, double sigmaY)
{
	float[] data = new float[size * size];
	// Randomly put on spots
	RandomDataGenerator rg = new RandomDataGenerator(rand);
	while (n-- > 0)
	{
		data[rand.nextInt(data.length)] = rg.nextInt(min, max);
	}

	int middle = z / 2;
	float[][] result = new float[z][];
	for (int i = 0; i < z; i++)
	{
		FloatProcessor fp = new FloatProcessor(size, size, data.clone());
		GaussianBlur gb = new GaussianBlur();
		// Increase blur when out-of-focus
		double scale = createWidthScale(Math.abs(middle - i), middle);
		gb.blurFloat(fp, sigmaX * scale, sigmaY * scale, 0.0002);
		result[i] = (float[]) fp.getPixels();
	}
	return result;
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:24,代码来源:FindFociTest.java

示例4: makeMeanAndVariance

import ij.plugin.filter.GaussianBlur; //导入依赖的package包/类
@Override
protected void makeMeanAndVariance(ByteProcessor I, Parameters params) {
	// //uses ImageJ's GaussianBlur
	// local variance over square of size (size + 1 + size)^2
	int width = I.getWidth();
	int height = I.getHeight();
	
	Imean = new FloatProcessor(width,height);
	Isigma = new FloatProcessor(width,height);

	FloatProcessor A = (FloatProcessor) I.convertToFloatProcessor();
	FloatProcessor B = (FloatProcessor) I.convertToFloatProcessor();
	B.sqr();
	
	GaussianBlur gb = new GaussianBlur();
	double sigma = params.radius * 0.6;	// sigma of Gaussian filter should be approx. 0.6 of the disk's radius
	gb.blurFloat(A, sigma, sigma, 0.002);
	gb.blurFloat(B, sigma, sigma, 0.002);

	for (int v = 0; v < height; v++) {
		for (int u = 0; u < width; u++) {
			float a = A.getf(u, v);
			float b = B.getf(u, v);
			float sigmaG = (float) Math.sqrt(b - a*a);
			Imean.setf(u, v, a);
			Isigma.setf(u, v, sigmaG);
		}
	}
}
 
开发者ID:imagingbook,项目名称:imagingbook-common,代码行数:30,代码来源:NiblackThresholder.java

示例5: findCirclesUEP

import ij.plugin.filter.GaussianBlur; //导入依赖的package包/类
private TMAPointsResult findCirclesUEP(PlanarImage image) {
    ImagePlus ip = new ImagePlus("TMAPoints", image.getAsBufferedImage());

    // blur: this fills small 'holes'
    GaussianBlur blur = new GaussianBlur();
    blur.blur(ip.getProcessor(), 2d);

    // Make Binary
    thresholder.applyThreshold(ip);

    // fill holes
    binary.setup("fill", null);
    binary.run(ip.getProcessor());

    // open
    binary.setup("open", null);
    binary.run(ip.getProcessor());

    // UEP
    edm.setup("points", null); // "points" for Ultimate points
    edm.run(ip.getProcessor());

    PlanarImage img = PlanarImage.wrapRenderedImage(ip.getBufferedImage());
    List<Point> pList = reportPoints(img, 1);
    double radius = guessRadius(pList);
    return new TMAPointsResult(pList, radius, ip.getBufferedImage());
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:28,代码来源:TMAPoints.java

示例6: Create_Gaussian_Image

import ij.plugin.filter.GaussianBlur; //导入依赖的package包/类
/**
 * Create the filtered images
 *
 * @param stack2: new duplicated stack image from the Original Stack Image
 * @param sigmaX  : Sigma value for the X axis
 * @param sigmaY  : Sigma value for the Y axis
 * @return : returns the image obtained after applying the Gaussian Filter
 */

public void Create_Gaussian_Image(ImageStack stack2, double sigmaX, double sigmaY) {

    int slice;                                                     // Define the type of slice
    int size3_ = stack2.getSize();                                 // Size of the stack image
    ImageProcessor ip_Gauss;                                       // Work on the duplicated images.
    GaussianBlur blurimg = new GaussianBlur();                     // Create ImageType
    ImageStack Gauss_Stack = stack2.duplicate();                   // We duplicate the original stack image .Create new empty stack to put the pixel values obtained after blurring blur

    for (slice = 1; slice <= size3_; slice++) {                    // Go through each slice
        ip_Gauss = Gauss_Stack.getProcessor(slice);                     // Returns an ImageProcessor for the specified slice using the Original stack image
        blurimg.blurGaussian(ip_Gauss, sigmaX, sigmaY, 0.01);      // Apply the blurring on the given slice
    }

    sme_pluginGetManifold.setStack1(Gauss_Stack);
    int size_   = sme_pluginGetManifold.getStack1().getSize();

    //Image display in new window
    sme_pluginGetManifold.setImp2( new ImagePlus("sML_" + sme_pluginGetManifold.getImp().getTitle(), sme_pluginGetManifold.getStack1()));
    sme_pluginGetManifold.getImp2().setStack(sme_pluginGetManifold.getStack1(), 1, size_, 1);
    sme_pluginGetManifold.getImp2().setCalibration(sme_pluginGetManifold.getImp2().getCalibration());

    sme_pluginGetManifold.getImp2().show();

    //return Gauss_Stack;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:35,代码来源:SME_ENS_GaussianProccessing.java

示例7: smoothForScale

import ij.plugin.filter.GaussianBlur; //导入依赖的package包/类
/**
 * 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 );
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:16,代码来源:MiscTools.java

示例8: sharpenFloat

import ij.plugin.filter.GaussianBlur; //导入依赖的package包/类
/**
 * Dynamic Density Optimization of a float image. 'fp' must have a valid snapshot. 
 * Almost identical to sharpenFloat in UnsharpMask.java from ImageJ.
 * Unsharp mask is added instead of subtracted as the filter is applied in log domain.
 * 
 * @param fp the Processor to be masked
 * @param sigma the standard deviation
 * @param weight the weight of the mask [0,1]
 */
public void sharpenFloat(FloatProcessor fp, double sigma, float weight) {
	GaussianBlur 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);
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:22,代码来源:DynamicDensityOptimizationScatterCorrectionTool.java

示例9: run

import ij.plugin.filter.GaussianBlur; //导入依赖的package包/类
public void run()
{
	GaussianBlur gb = new GaussianBlur();
	for (int i = 0; i < slices && slice <= inputStack.getSize(); i++, slice++)
	{
		IJ.showStatus(
				String.format("Calculating blur ... %.1f%%", (100.0 * ++blurCount) / inputStack.getSize()));
		ImageProcessor ip = inputStack.getProcessor(slice).duplicate();
		ip.setRoi(bounds);
		ip.snapshot();
		gb.blurGaussian(ip, blur, blur, 0.002);
		outputStack.setPixels(ip.getPixels(), slice);
	}
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:15,代码来源:SpotAnalysis.java

示例10: applyBlur

import ij.plugin.filter.GaussianBlur; //导入依赖的package包/类
private ImageProcessor applyBlur(ImageProcessor median)
{
	ImageProcessor blur = median;
	if (sigma > 0)
	{
		blur = median.duplicate();
		GaussianBlur gb = new GaussianBlur();
		gb.blurGaussian(blur, sigma, sigma, 0.0002);
	}
	return blur;
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:12,代码来源:ImageBackground.java

示例11: applyBlur

import ij.plugin.filter.GaussianBlur; //导入依赖的package包/类
/**
 * Apply a Gaussian blur to the image and returns a new image.
 * Returns the original image if blur <= 0.
 * <p>
 * Only blurs the current channel and frame for use in the FindFoci algorithm.
 * 
 * @param imp
 * @param blur
 *            The blur standard deviation
 * @return the blurred image
 */
public static ImagePlus applyBlur(ImagePlus imp, double blur)
{
	if (blur > 0)
	{
		// Note: imp.duplicate() crops the image if there is an ROI selection
		// so duplicate each ImageProcessor instead.
		GaussianBlur gb = new GaussianBlur();
		ImageStack stack = imp.getImageStack();
		ImageStack newStack = new ImageStack(stack.getWidth(), stack.getHeight(), stack.getSize());
		int channel = imp.getChannel();
		int frame = imp.getFrame();
		int[] dim = imp.getDimensions();
		// Copy the entire stack
		for (int slice = 1; slice <= stack.getSize(); slice++)
			newStack.setPixels(stack.getProcessor(slice).getPixels(), slice);
		// Now blur the current channel and frame
		for (int slice = 1; slice <= dim[3]; slice++)
		{
			int stackIndex = imp.getStackIndex(channel, slice, frame);
			ImageProcessor ip = stack.getProcessor(stackIndex).duplicate();
			gb.blurGaussian(ip, blur, blur, 0.0002);
			newStack.setPixels(ip.getPixels(), stackIndex);
		}
		imp = new ImagePlus(null, newStack);
		imp.setDimensions(dim[2], dim[3], dim[4]);
		imp.setC(channel);
		imp.setT(frame);
	}
	return imp;
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:42,代码来源:FindFociBaseProcessor.java

示例12: gaussianBlurResizeInHalf

import ij.plugin.filter.GaussianBlur; //导入依赖的package包/类
/** 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
}
 
开发者ID:trakem2,项目名称:TrakEM2,代码行数:9,代码来源:FSLoader.java

示例13: runAnalysis

import ij.plugin.filter.GaussianBlur; //导入依赖的package包/类
/** This runs all steps of the analysis, given an ImageStack as input. */
   void runAnalysis( ImageStack stck, float pxMin, float pxMax  ) {

// helpers
Timing t1 = new Timing();
GaussianBlur gb = new GaussianBlur();
final int imgPerResult  = stck.getSize() / nrResImages;

IJ.log("ESI: input images per resulting images: "+imgPerResult);

// stacks to store the results
ImageStack rec      = 
    new ImageStack(2*stck.getWidth(), 2*stck.getHeight());

ImagePlus interm = null;

// image to show the summed-up result
FloatProcessor summedImg = 
    new FloatProcessor( 2*stck.getWidth(), 2*stck.getHeight());
ImagePlus summedImgP = 
    new ImagePlus("summed ESI result", summedImg) ;
summedImgP.show();

// Array to hold one TraceStack per Image Substack
TraceStack [] trStArray = new TraceStack[ nrResImages ];

// loop over subimages
for( int k=0; k < nrResImages ; k++) {
    t1.start();

    // generate and normalize the TraceStack
    TraceStack trSt = new TraceStack( stck , k*imgPerResult , (k+1)*imgPerResult );
    trSt.normalizeFrom( pxMin, pxMax );
    trSt.createNormBinning( nrBins ); 

    // run the analysis
    FloatProcessor reconstruction;
    if (doMultiCore)  {
	MTP mp = new MTP(this);
	reconstruction = mp.doESI(trSt, esi_order);
    } else {
	reconstruction = doESI(trSt, esi_order);
    }

    gb.blurFloat( reconstruction , 0.8, 0.8, 0.01);
    if (normOutput)
	normalize( reconstruction );

    // add these to the result stacks
    rec.addSlice(reconstruction);

    // add the slice to the current sum
    ESI_Analysis.addFP( reconstruction, summedImg);
    summedImg.resetMinAndMax();
    summedImgP.updateAndDraw();
    
    // present some intermediate result
    if ( (rec.getSize()>1)||(nrResImages==1))
    if ( interm == null) {
	    interm= new ImagePlus("ESI result", rec);
	    interm.show();
    } else {
	    interm.setPosition( rec.getSize() );
    }

    t1.stop();
    IJ.log("ESI: SubImg "+k+"/"+nrResImages+" took "+t1 );
}

   }
 
开发者ID:biophotonics-bielefeld,项目名称:ESI,代码行数:71,代码来源:ESI_Analysis.java

示例14: IJFilter

import ij.plugin.filter.GaussianBlur; //导入依赖的package包/类
IJFilter(boolean internal)
{
	super(GaussianBlur.class.getSimpleName(), internal);
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:5,代码来源:GaussianFilterTest.java

示例15: createColorChannel

import ij.plugin.filter.GaussianBlur; //导入依赖的package包/类
private void createColorChannel(String title)
{
	ImageProcessor cp = getImageProcessor();
	ByteProcessor bp = null;

	Random rng = new Random(seed++);

	for (int point = 0; point < NUMBER_OF_POINTS; point++)
	{
		int x = rng.nextInt(width - 2 * padding) + padding;
		int y = minSize + maxExpansionSize + rng.nextInt(height - 2 * (minSize + maxExpansionSize));

		int xSize = minSize + rng.nextInt(maxExpansionSize);
		int ySize = minSize + rng.nextInt(maxExpansionSize);

		int value = rng.nextInt(CHANNEL_MAX - CHANNEL_MIN) + CHANNEL_MIN;
		cp.set(x, y, value);

		for (int i = -xSize; i < xSize; i++)
		{
			for (int j = -ySize; j < ySize; j++)
			{
				cp.set(x + i, y + j, value);
			}
		}
	}

	GaussianBlur gb = new GaussianBlur();
	gb.blurGaussian(cp, 20, 20, 0.02);

	// Get all values above zero as the ROI
	if (createMasks)
	{
		bp = new ByteProcessor(width, height);
		bp.add(background);

		for (int i = cp.getPixelCount(); i-- > 0;)
		{
			if (cp.get(i) > CHANNEL_MIN)
			{
				bp.set(i, foreground);
				roi.set(i, foreground);
			}
		}
	}

	// Add some noise to the image
	cp.noise(CHANNEL_MAX / 16);

	// Show the images
	ImagePlus im = new ImagePlus(title, cp);
	im.show();

	if (bp != null)
	{
		ImagePlus imRoi = new ImagePlus(title + "roi" + sequenceNumber, bp);
		imRoi.show();
	}
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:60,代码来源:Create_Colocalised_Images.java


注:本文中的ij.plugin.filter.GaussianBlur类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。