本文整理汇总了Java中net.imglib2.type.numeric.real.DoubleType.setReal方法的典型用法代码示例。如果您正苦于以下问题:Java DoubleType.setReal方法的具体用法?Java DoubleType.setReal怎么用?Java DoubleType.setReal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.imglib2.type.numeric.real.DoubleType
的用法示例。
在下文中一共展示了DoubleType.setReal方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compute
import net.imglib2.type.numeric.real.DoubleType; //导入方法依赖的package包/类
@Override
public void compute(final IterableInterval<T> input, final DoubleType output) {
final double[][] matrix = getCooccurrenceMatrix(input);
final double mux = coocMeanXFunc.calculate(matrix).getRealDouble();
final double muy = coocMeanYFunc.calculate(matrix).getRealDouble();
double res = 0;
for (int j = 0; j < matrix.length; j++) {
for (int i = 0; i < matrix.length; i++) {
res += (Math.pow((i + j - mux - muy), 3) * matrix[j][i]);
}
}
output.setReal(res);
}
示例2: compute
import net.imglib2.type.numeric.real.DoubleType; //导入方法依赖的package包/类
@Override
public void compute(final IterableInterval<T> input, final DoubleType output) {
final double[][] matrix = getCooccurrenceMatrix(input);
final int nrGrayLevels = matrix.length;
final double mux = coocMeanXFunc.calculate(matrix).getRealDouble();
final double muy = coocMeanYFunc.calculate(matrix).getRealDouble();
double res = 0;
for (int i = 0; i < nrGrayLevels; i++) {
for (int j = 0; j < nrGrayLevels; j++) {
res += Math.pow(i + j - mux - muy, 4) * matrix[i][j];
}
}
output.setReal(res);
}
示例3: compute
import net.imglib2.type.numeric.real.DoubleType; //导入方法依赖的package包/类
@Override
public void compute(final IterableInterval<T> input, final DoubleType output) {
final double[][] matrix = getCooccurrenceMatrix(input);
final int nrGrayLevels = matrix.length;
double res = 0;
for (int i = 0; i < nrGrayLevels; i++) {
for (int j = 0; j < nrGrayLevels; j++) {
res += matrix[i][j] * matrix[i][j];
}
}
output.setReal(res);
}
示例4: testCreateAndConvolvePoints
import net.imglib2.type.numeric.real.DoubleType; //导入方法依赖的package包/类
/** tests fft based convolve */
@Test
public void testCreateAndConvolvePoints() {
final int xSize = 128;
final int ySize = 128;
final int zSize = 128;
int[] size = new int[] { xSize, ySize, zSize };
Img<DoubleType> phantom = ops.create().img(size);
RandomAccess<DoubleType> randomAccess = phantom.randomAccess();
randomAccess.setPosition(new long[] { xSize / 2, ySize / 2, zSize / 2 });
randomAccess.get().setReal(255.0);
randomAccess.setPosition(new long[] { xSize / 4, ySize / 4, zSize / 4 });
randomAccess.get().setReal(255.0);
Point location = new Point(phantom.numDimensions());
location.setPosition(new long[] { 3 * xSize / 4, 3 * ySize / 4, 3 * zSize /
4 });
HyperSphere<DoubleType> hyperSphere = new HyperSphere<>(phantom, location,
5);
for (DoubleType value : hyperSphere) {
value.setReal(16);
}
// create psf using the gaussian kernel op (alternatively PSF could be an
// input to the script)
RandomAccessibleInterval<DoubleType> psf = ops.create().kernelGauss(
new double[] { 5, 5, 5 }, new DoubleType());
// convolve psf with phantom
RandomAccessibleInterval<DoubleType> convolved = ops.filter().convolve(
phantom, psf);
DoubleType sum = new DoubleType();
DoubleType max = new DoubleType();
DoubleType min = new DoubleType();
ops.stats().sum(sum, Views.iterable(convolved));
ops.stats().max(max, Views.iterable(convolved));
ops.stats().min(min, Views.iterable(convolved));
assertEquals(sum.getRealDouble(), 8750.00, 0.001);
assertEquals(max.getRealDouble(), 3.155, 0.001);
assertEquals(min.getRealDouble(), 2.978E-7, 0.001);
}