本文整理汇总了Java中net.imglib2.type.numeric.real.DoubleType.getRealDouble方法的典型用法代码示例。如果您正苦于以下问题:Java DoubleType.getRealDouble方法的具体用法?Java DoubleType.getRealDouble怎么用?Java DoubleType.getRealDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.imglib2.type.numeric.real.DoubleType
的用法示例。
在下文中一共展示了DoubleType.getRealDouble方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compute
import net.imglib2.type.numeric.real.DoubleType; //导入方法依赖的package包/类
@Override
public void compute(final I center,
final RectangleNeighborhood<Composite<DoubleType>> neighborhood,
final BitType output)
{
final DoubleType mean = new DoubleType();
integralMean.compute(neighborhood, mean);
final DoubleType variance = new DoubleType();
integralVariance.compute(neighborhood, variance);
final DoubleType stdDev = new DoubleType(Math.sqrt(variance.get()));
final DoubleType threshold = new DoubleType(mean.getRealDouble() * (1.0d +
p * Math.exp(-q * mean.getRealDouble()) + k * ((stdDev.getRealDouble() /
r) - 1.0)));
// Set value
final Converter<I, DoubleType> conv = new RealDoubleConverter<>();
final DoubleType centerPixelAsDoubleType = variance; // NB: Reuse
// DoubleType
conv.convert(center, centerPixelAsDoubleType);
output.set(centerPixelAsDoubleType.compareTo(threshold) > 0);
}
示例2: compute
import net.imglib2.type.numeric.real.DoubleType; //导入方法依赖的package包/类
@Override
public void compute(final I center,
final RectangleNeighborhood<Composite<DoubleType>> neighborhood,
final BitType output)
{
final DoubleType mean = new DoubleType();
integralMean.compute(neighborhood, mean);
final DoubleType variance = new DoubleType();
integralVariance.compute(neighborhood, variance);
final DoubleType stdDev = new DoubleType(Math.sqrt(variance.get()));
final DoubleType threshold = new DoubleType(mean.getRealDouble() * (1.0d +
k * ((Math.sqrt(stdDev.getRealDouble()) / r) - 1.0)));
// Set value
final Converter<I, DoubleType> conv = new RealDoubleConverter<>();
final DoubleType centerPixelAsDoubleType = variance; // NB: Reuse
// DoubleType
conv.convert(center, centerPixelAsDoubleType);
output.set(centerPixelAsDoubleType.compareTo(threshold) > 0);
}
示例3: unaryComputer
import net.imglib2.type.numeric.real.DoubleType; //导入方法依赖的package包/类
@Override
protected CenterAwareComputerOp<T, V> unaryComputer(final T inType,
final V outType)
{
final AbstractCenterAwareComputerOp<T, V> op =
new AbstractCenterAwareComputerOp<T, V>()
{
private UnaryComputerOp<Iterable<T>, DoubleType> variance;
@Override
public void compute(final Iterable<T> neighborhood, final T center, final V output) {
if (variance == null) {
variance = Computers.unary(ops(), Ops.Stats.Variance.class,
DoubleType.class, neighborhood);
}
DoubleType varianceResult = new DoubleType();
variance.compute(neighborhood, varianceResult);
double varianceValue = varianceResult.getRealDouble() * range;
final double centerValue = center.getRealDouble();
double sumAll = 0;
double sumWithin = 0;
long countAll = 0;
long countWithin = 0;
for (T neighbor : neighborhood) {
final double pixelValue = neighbor.getRealDouble();
final double diff = centerValue - pixelValue;
sumAll += pixelValue;
++countAll;
if (diff > varianceValue || diff < -varianceValue) {
continue;
}
// pixel within variance range
sumWithin += pixelValue;
++countWithin;
}
if (countWithin < (int) (minPixelFraction * countAll)) {
output.setReal(sumAll / countAll); // simply mean
}
else {
// mean over pixels in variance range only
output.setReal(sumWithin / countWithin);
}
}
};
op.setEnvironment(ops());
return op;
}