本文整理汇总了Java中ij.plugin.filter.GaussianBlur.blurGaussian方法的典型用法代码示例。如果您正苦于以下问题:Java GaussianBlur.blurGaussian方法的具体用法?Java GaussianBlur.blurGaussian怎么用?Java GaussianBlur.blurGaussian使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ij.plugin.filter.GaussianBlur
的用法示例。
在下文中一共展示了GaussianBlur.blurGaussian方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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;
}
示例3: 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);
}
示例4: 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);
}
}
示例5: 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;
}
示例6: 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;
}
示例7: 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();
}
}
示例8: run
import ij.plugin.filter.GaussianBlur; //导入方法依赖的package包/类
public void run(ImageProcessor inputIp)
{
// Just run the particle analyser
noOfParticles = 0;
// Avoid destructively modifying the image. Work on the selected channel for thresholding
int index = imp.getStackIndex(thresholdChannel, imp.getSlice(), imp.getFrame());
ImageProcessor ip = imp.getImageStack().getProcessor(index).duplicate();
if (!checkData(ip))
{
IJ.error(TITLE, "Channel has no data range");
resetImage();
return;
}
if (containsRoiMask && maskOption == 1)
{
ip = maskIp.duplicate();
ip.setThreshold(254, 255, ImageProcessor.NO_LUT_UPDATE);
}
else
{
// Blur the image
if (blur > 0)
{
GaussianBlur gb = new GaussianBlur();
gb.blurGaussian(ip, blur, blur, 0.002);
}
// Threshold
int t = AutoThreshold.getThreshold(thresholdMethod, ip.getHistogram());
ip.setThreshold(t, 65536, ImageProcessor.NO_LUT_UPDATE);
}
// Analyse particles
ImagePlus particlesImp = new ImagePlus(imp.getTitle() + " Particles", ip);
int analyserOptions = ParticleAnalyzer.SHOW_ROI_MASKS + ParticleAnalyzer.IN_SITU_SHOW +
ParticleAnalyzer.EXCLUDE_EDGE_PARTICLES;
int measurements = 0;
ResultsTable rt = new ResultsTable();
double maxSize = Double.POSITIVE_INFINITY;
ParticleAnalyzer pa = new ParticleAnalyzer(analyserOptions, measurements, rt, minSize, maxSize);
pa.analyze(particlesImp, ip);
ImageProcessor particlesIp = particlesImp.getProcessor();
noOfParticles = rt.getCounter();
if (label != null)
label.setText(String.format("%d particle%s", noOfParticles, (noOfParticles == 1) ? "" : "s"));
// Show the particles
inputIp.copyBits(particlesIp, 0, 0, Blitter.COPY);
inputIp.setMinAndMax(0, noOfParticles);
imp.updateAndDraw();
}