本文整理了Java中ij.plugin.filter.GaussianBlur.blurFloat()
方法的一些代码示例,展示了GaussianBlur.blurFloat()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GaussianBlur.blurFloat()
方法的具体详情如下:
包路径:ij.plugin.filter.GaussianBlur
类名称:GaussianBlur
方法名:blurFloat
[英]Gaussian Filtering of a FloatProcessor. This method does NOT include resetOutOfRoi(ip), i.e., pixels above and below the roi rectangle will be also subject to filtering in x direction and must be restored afterwards (unless the full image height is processed).
[中]浮点处理器的高斯滤波。此方法不包括resetOutOfRoi(ip),即,roi矩形上方和下方的像素也将在x方向进行过滤,并且必须在之后恢复(除非处理完整图像高度)。
代码示例来源:origin: mpicbg/mpicbg
/**
* Smooth with a Gaussian kernel that represents downsampling at a given
* scale factor and sourceSigma.
*/
final static public void smoothForScale(
final FloatProcessor source,
final double scale,
final float sourceSigma,
final float targetSigma )
{
assert scale <= 1.0f : "Downsampling requires a scale factor < 1.0";
final double s = targetSigma / scale;
final double v = s * s - sourceSigma * sourceSigma;
if ( v <= 0 )
return;
final float sigma = ( float )Math.sqrt( v );
// final float[] kernel = createNormalizedGaussianKernel( sigma );
// convolveSeparable( source, kernel, kernel );
new GaussianBlur().blurFloat( 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 FloatProcessor source,
final double scale,
final float sourceSigma,
final float targetSigma )
{
assert scale <= 1.0f : "Downsampling requires a scale factor < 1.0";
final double s = targetSigma / scale;
final double v = s * s - sourceSigma * sourceSigma;
if ( v <= 0 )
return;
final float sigma = ( float )Math.sqrt( v );
// final float[] kernel = createNormalizedGaussianKernel( sigma );
// convolveSeparable( source, kernel, kernel );
new GaussianBlur().blurFloat( source, sigma, sigma, 0.01 );
}
代码示例来源:origin: sc.fiji/TrakEM2_
/** 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
}
代码示例来源:origin: net.imagej/ij
/** Gaussian Filtering of an ImageProcessor
* @param ip The ImageProcessor to be filtered.
* @param sigmaX Standard deviation of the Gaussian in x direction (pixels)
* @param sigmaY Standard deviation of the Gaussian in y direction (pixels)
* @param accuracy Accuracy of kernel, should not be above 0.02. Better (lower)
* accuracy needs slightly more computing time.
*/
public void blurGaussian(ImageProcessor ip, double sigmaX, double sigmaY, double accuracy) {
boolean hasRoi = ip.getRoi().height!=ip.getHeight() && sigmaX>0 && sigmaY>0;
if (hasRoi && !calledAsPlugin)
ip.snapshot();
if (nPasses<=1)
nPasses = ip.getNChannels() * (sigmaX>0 && sigmaY>0 ? 2 : 1);
FloatProcessor fp = null;
for (int i=0; i<ip.getNChannels(); i++) {
fp = ip.toFloat(i, fp);
if (Thread.currentThread().isInterrupted()) return; // interruption for new parameters during preview?
blurFloat(fp, sigmaX, sigmaY, accuracy);
if (Thread.currentThread().isInterrupted()) return;
ip.setPixels(i, fp);
}
if (hasRoi)
resetOutOfRoi(ip, (int)Math.ceil(5*sigmaY)); // reset out-of-Rectangle pixels above and below roi
return;
}
代码示例来源:origin: imagej/ImageJA
/** Gaussian Filtering of an ImageProcessor
* @param ip The ImageProcessor to be filtered.
* @param sigmaX Standard deviation of the Gaussian in x direction (pixels)
* @param sigmaY Standard deviation of the Gaussian in y direction (pixels)
* @param accuracy Accuracy of kernel, should not be above 0.02. Better (lower)
* accuracy needs slightly more computing time.
*/
public void blurGaussian(ImageProcessor ip, double sigmaX, double sigmaY, double accuracy) {
boolean hasRoi = ip.getRoi().height!=ip.getHeight() && sigmaX>0 && sigmaY>0;
if (hasRoi && !calledAsPlugin)
ip.snapshot();
if (nPasses<=1)
nPasses = ip.getNChannels() * (sigmaX>0 && sigmaY>0 ? 2 : 1);
FloatProcessor fp = null;
for (int i=0; i<ip.getNChannels(); i++) {
fp = ip.toFloat(i, fp);
if (Thread.currentThread().isInterrupted()) return; // interruption for new parameters during preview?
blurFloat(fp, sigmaX, sigmaY, accuracy);
if (Thread.currentThread().isInterrupted()) return;
ip.setPixels(i, fp);
}
if (hasRoi)
resetOutOfRoi(ip, (int)Math.ceil(5*sigmaY)); // reset out-of-Rectangle pixels above and below roi
return;
}
代码示例来源:origin: sc.fiji/TrakEM2_
/**
* 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 ) );
}
代码示例来源:origin: sc.fiji/Fiji_Plugins
public static ImagePlus getShapeIndexMap(final ImagePlus image, final double gaussianBlurRadius) {
final ImageStack stack = image.getStack();
final ImageStack result = new ImageStack(image.getWidth(), image.getHeight());
for (int i = 1; i <= stack.getSize(); i++) {
ImageProcessor ip = stack.getProcessor(i);
if (gaussianBlurRadius > 0) {
final FloatProcessor fp = (FloatProcessor)
(image.getType() != ImagePlus.GRAY32 ? ip.convertToFloat() : ip.duplicate());
if (gaussianBlur == null)
gaussianBlur = new GaussianBlur();
gaussianBlur.blurFloat(fp, gaussianBlurRadius, gaussianBlurRadius, 0.02);
ip = fp;
}
result.addSlice("", getShapeIndex(ip));
}
return new ImagePlus("Shape index of " + image.getTitle(), result);
}
代码示例来源:origin: mpicbg/mpicbg_
filter.blurFloat( ipD, sigma, sigma, 0.002 );
代码示例来源:origin: axtimwalde/mpicbg
filter.blurFloat( ipD, sigma, sigma, 0.002 );
内容来源于网络,如有侵权,请联系作者删除!