本文整理了Java中ij.plugin.filter.GaussianBlur.blurGaussian()
方法的一些代码示例,展示了GaussianBlur.blurGaussian()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GaussianBlur.blurGaussian()
方法的具体详情如下:
包路径:ij.plugin.filter.GaussianBlur
类名称:GaussianBlur
方法名:blurGaussian
[英]Gaussian Filtering of an ImageProcessor
[中]图像处理器的高斯滤波
代码示例来源:origin: net.imagej/ij
/** Gaussian Filtering of an ImageProcessor
* @param ip The ImageProcessor to be filtered.
* @param sigma Standard deviation of the Gaussian (pixels)
*
* @see ij.process.ImageProcessor#blurGaussian(double)
*/
public void blurGaussian(ImageProcessor ip, double sigma) {
double accuracy = (ip instanceof ByteProcessor||ip instanceof ColorProcessor)?0.002:0.0002;
blurGaussian(ip, sigma, sigma, accuracy);
}
代码示例来源:origin: imagej/ImageJA
/** Gaussian Filtering of an ImageProcessor
* @param ip The ImageProcessor to be filtered.
* @param sigma Standard deviation of the Gaussian (pixels)
*
* @see ij.process.ImageProcessor#blurGaussian(double)
*/
public void blurGaussian(ImageProcessor ip, double sigma) {
double accuracy = (ip instanceof ByteProcessor||ip instanceof ColorProcessor)?0.002:0.0002;
blurGaussian(ip, sigma, sigma, accuracy);
}
代码示例来源:origin: sc.fiji/TrakEM2_
@Override
public ImageProcessor process(ImageProcessor ip) {
ij.plugin.filter.GaussianBlur g = new ij.plugin.filter.GaussianBlur();
g.blurGaussian(ip, sigmaX, sigmaY, accuracy);
return ip;
}
代码示例来源:origin: mpicbg/mpicbg
/**
* Smooth with a Gaussian kernel that represents downsampling at a given
* scale factor and sourceSigma.
*/
final static public void smoothForScale(
final ImageProcessor source,
final double scale,
final float sourceSigma,
final float targetSigma )
{
final double s = targetSigma / scale;
final double v = s * s - sourceSigma * sourceSigma;
if ( v <= 0 )
return;
final double sigma = Math.sqrt( v );
new GaussianBlur().blurGaussian( source, sigma, sigma, 0.01 );
}
代码示例来源:origin: sc.fiji/bUnwarpJ_
/**
* 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 );
}
代码示例来源:origin: axtimwalde/mpicbg
/**
* Smooth with a Gaussian kernel that represents downsampling at a given
* scale factor and sourceSigma.
*/
final static public void smoothForScale(
final ImageProcessor source,
final double scale,
final float sourceSigma,
final float targetSigma )
{
final double s = targetSigma / scale;
final double v = s * s - sourceSigma * sourceSigma;
if ( v <= 0 )
return;
final double sigma = Math.sqrt( v );
new GaussianBlur().blurGaussian( source, sigma, sigma, 0.01 );
}
代码示例来源:origin: net.imagej/ij
/** 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);
}
代码示例来源:origin: net.imagej/ij
/** This method is invoked for each slice during execution
* @param ip The image subject to filtering. It must have a valid snapshot if
* the height of the roi is less than the full image height.
*/
public void run(ImageProcessor ip) {
double sigmaX = sigmaScaled ? sigma/imp.getCalibration().pixelWidth : sigma;
double sigmaY = sigmaScaled ? sigma/imp.getCalibration().pixelHeight : sigma;
double accuracy = (ip instanceof ByteProcessor || ip instanceof ColorProcessor) ?
0.002 : 0.0002;
Rectangle roi = ip.getRoi();
blurGaussian(ip, sigmaX, sigmaY, accuracy);
}
代码示例来源:origin: net.imagej/ij
/** 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);
}
代码示例来源:origin: imagej/ImageJA
/** This method is invoked for each slice during execution
* @param ip The image subject to filtering. It must have a valid snapshot if
* the height of the roi is less than the full image height.
*/
public void run(ImageProcessor ip) {
double sigmaX = sigmaScaled ? sigma/imp.getCalibration().pixelWidth : sigma;
double sigmaY = sigmaScaled ? sigma/imp.getCalibration().pixelHeight : sigma;
double accuracy = (ip instanceof ByteProcessor || ip instanceof ColorProcessor) ?
0.002 : 0.0002;
Rectangle roi = ip.getRoi();
blurGaussian(ip, sigmaX, sigmaY, accuracy);
}
代码示例来源:origin: imagej/ImageJA
/** 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);
}
代码示例来源:origin: imagej/ImageJA
/** 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);
}
代码示例来源:origin: net.imagej/ij
/** Gaussian Filtering of an ImageProcessor. This method is for compatibility with the
* previous code (before 1.38r) and uses a low-accuracy kernel, only slightly better
* than the previous ImageJ code.
* The 'radius' in this call is different from the one used in ImageJ 1.38r and later.
* Therefore, use blurGaussian(ip, sigma, sigma, accuracy), where 'sigma' is equivalent
* to the 'sigma (radius)' of the Menu, and accuracy should be 0.02 unless better
* accuracy is desired.
*/
@Deprecated
public boolean blur(ImageProcessor ip, double radius) {
Rectangle roi = ip.getRoi();
if (roi.height!=ip.getHeight() && ip.getMask()==null)
ip.snapshot(); // a snapshot is needed for out-of-Rectangle pixels
blurGaussian(ip, 0.4*radius, 0.4*radius, 0.01);
return true;
}
代码示例来源:origin: imagej/ImageJA
/** Gaussian Filtering of an ImageProcessor. This method is for compatibility with the
* previous code (before 1.38r) and uses a low-accuracy kernel, only slightly better
* than the previous ImageJ code.
* The 'radius' in this call is different from the one used in ImageJ 1.38r and later.
* Therefore, use blurGaussian(ip, sigma, sigma, accuracy), where 'sigma' is equivalent
* to the 'sigma (radius)' of the Menu, and accuracy should be 0.02 unless better
* accuracy is desired.
*/
@Deprecated
public boolean blur(ImageProcessor ip, double radius) {
Rectangle roi = ip.getRoi();
if (roi.height!=ip.getHeight() && ip.getMask()==null)
ip.snapshot(); // a snapshot is needed for out-of-Rectangle pixels
blurGaussian(ip, 0.4*radius, 0.4*radius, 0.01);
return true;
}
代码示例来源:origin: fiji/Trainable_Segmentation
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);
}
};
代码示例来源:origin: sc.fiji/Trainable_Segmentation
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);
}
};
代码示例来源:origin: sc.fiji/Trainable_Segmentation
/**
* 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);
}
/**
代码示例来源:origin: fiji/Trainable_Segmentation
/**
* 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);
}
/**
代码示例来源:origin: sc.fiji/TrakEM2_
public Pair<ColorProcessor, ByteProcessor> makeFlatColorImage()
{
if ( canUseAWTImage() ) { // less than 0.5 GB array size
final ColorProcessor cp = new ColorProcessor( createAWTImage( ImagePlus.COLOR_RGB ) );
final ByteProcessor alpha = new ByteProcessor( cp.getWidth(), cp.getHeight(), cp.getChannel( 4 ) );
return new Pair<ColorProcessor, ByteProcessor>( cp, alpha );
}
if ( !isSmallerThan2GB() ) {
Utils.log("Cannot create an image larger than 2 GB.");
return null;
}
if ( loader.isMipMapsRegenerationEnabled() )
{
return ExportARGB.makeFlatImageARGBFromMipMaps( patches, finalBox, 0, scale );
}
// No mipmaps: create an image as large as possible, then downsample it
final Pair<ColorProcessor, ByteProcessor> pair = ExportARGB.makeFlatImageARGBFromOriginals( patches, finalBox, 0, scaleUP );
final double sigma = computeSigma( pair.a.getWidth(), pair.a.getHeight());
new GaussianBlur().blurGaussian( pair.a, sigma, sigma, 0.0002 );
new GaussianBlur().blurGaussian( pair.b, sigma, sigma, 0.0002 );
return pair;
}
代码示例来源:origin: net.imagej/ij
public static void blur(ImagePlus imp, double sigmaX, double sigmaY, double sigmaZ) {
imp.deleteRoi();
ImageStack stack = imp.getStack();
if (sigmaX>0.0 || sigmaY>0.0) {
GaussianBlur gb = new GaussianBlur();
int channels = stack.getProcessor(1).getNChannels();
gb.setNPasses(channels*imp.getStackSize());
for (int i=1; i<=imp.getStackSize(); i++) {
ImageProcessor ip = stack.getProcessor(i);
double accuracy = (imp.getBitDepth()==8||imp.getBitDepth()==24)?0.002:0.0002;
gb.blurGaussian(ip, sigmaX, sigmaY, accuracy);
}
}
if (sigmaZ>0.0) {
if (imp.isHyperStack())
blurHyperStackZ(imp, sigmaZ);
else
blurZ(stack, sigmaZ);
imp.updateAndDraw();
}
}
内容来源于网络,如有侵权,请联系作者删除!