use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.
the class IntegralImgTest method testIntegralImageSimilarity.
/**
* @see DefaultIntegralImg
* @see SquareIntegralImg
*/
@SuppressWarnings({ "unchecked" })
@Test
public void testIntegralImageSimilarity() {
RandomAccessibleInterval<LongType> out1 = (RandomAccessibleInterval<LongType>) ops.run(DefaultIntegralImg.class, in);
RandomAccessibleInterval<DoubleType> out2 = (RandomAccessibleInterval<DoubleType>) ops.run(WrappedIntegralImg.class, in);
// Remove 0s from integralImg by shifting its interval by +1
final long[] min = new long[out2.numDimensions()];
final long[] max = new long[out2.numDimensions()];
for (int d = 0; d < out2.numDimensions(); ++d) {
min[d] = out2.min(d) + 1;
max[d] = out2.max(d);
}
// Define the Interval on the infinite random accessibles
final FinalInterval interval = new FinalInterval(min, max);
LocalThresholdTest.testIterableIntervalSimilarity(Views.iterable(out1), Views.iterable(Views.offsetInterval(out2, interval)));
}
use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.
the class InvertTest method testDoubleTypeInvert.
@Test
public void testDoubleTypeInvert() {
final Img<DoubleType> inDoubleType = generateDoubleArrayTestImg(true, 5, 5);
final Img<DoubleType> outDoubleType = inDoubleType.factory().create(inDoubleType, new DoubleType());
assertDefaultInvert(inDoubleType, outDoubleType);
assertDefaultInvertMinMaxProvided(inDoubleType, outDoubleType, new DoubleType(437d), new DoubleType(8008d));
assertDefaultInvertMinMaxProvided(inDoubleType, outDoubleType, new DoubleType(5d), new DoubleType(Double.MAX_VALUE));
}
use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.
the class UnaryRealTypeMathTest method testArccsch.
@Test
public void testArccsch() {
final LongType in = new LongType(1234567890);
final DoubleType out = new DoubleType();
ops.run(Arccsch.class, out, in);
final double delta = Math.sqrt(1 + 1 / (1234567890.0 * 1234567890.0));
assertEquals(out.get(), Math.log(1 / 1234567890.0 + delta), 0.0);
}
use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.
the class UnaryRealTypeMathTest method assertRandomGaussian.
private void assertRandomGaussian(final double i, final double o, final long seed) {
final DoubleType in = new DoubleType(i);
final DoubleType out = (DoubleType) ops.run(RandomGaussian.class, in.createVariable(), in, seed);
assertEquals(o, out.get(), 0);
}
use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.
the class UnaryRealTypeMathTest method testArcsech.
@Test
public void testArcsech() {
final LongType in = new LongType(1234567890);
final DoubleType out = new DoubleType();
ops.run(Arcsech.class, out, in);
final double numer = 1 + Math.sqrt(1 - 1234567890.0 * 1234567890.0);
assertEquals(out.get(), Math.log(numer / 1234567890.0), 0.0);
}
Aggregations