Search in sources :

Example 11 with LongType

use of net.imglib2.type.numeric.integer.LongType in project imagej-ops by imagej.

the class UnaryRealTypeMathTest method testCoth.

@Test
public void testCoth() {
    final LongType in = new LongType(1234567890);
    final DoubleType out = new DoubleType();
    ops.run(Coth.class, out, in);
    assertEquals(out.get(), 1 / Math.tanh(1234567890), 0.0);
}
Also used : LongType(net.imglib2.type.numeric.integer.LongType) DoubleType(net.imglib2.type.numeric.real.DoubleType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 12 with LongType

use of net.imglib2.type.numeric.integer.LongType in project imagej-ops by imagej.

the class UnaryRealTypeMathTest method testSqr.

@Test
public void testSqr() {
    final LongType in = new LongType(94906267L);
    final LongType out = (LongType) ops.run(Sqr.class, in.createVariable(), in);
    // NB: for any odd number greater than LARGE_NUM - 1, its double
    // representation is not exact.
    assertEquals(out.get(), 94906267L * 94906267L - 1);
}
Also used : LongType(net.imglib2.type.numeric.integer.LongType) Sqr(net.imagej.ops.math.UnaryRealTypeMath.Sqr) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 13 with LongType

use of net.imglib2.type.numeric.integer.LongType in project imagej-ops by imagej.

the class UnaryRealTypeMathTest method testCubeRoot.

@Test
public void testCubeRoot() {
    final LongType in = new LongType(1234567890);
    final DoubleType out = new DoubleType();
    ops.run(CubeRoot.class, out, in);
    assertEquals(out.get(), Math.cbrt(1234567890), 0.0);
}
Also used : LongType(net.imglib2.type.numeric.integer.LongType) DoubleType(net.imglib2.type.numeric.real.DoubleType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 14 with LongType

use of net.imglib2.type.numeric.integer.LongType in project imagej-ops by imagej.

the class UnaryRealTypeMathTest method testSqrt.

@Test
public void testSqrt() {
    final LongType in = new LongType(1234567890);
    final DoubleType out = new DoubleType();
    ops.run(Sqrt.class, out, in);
    assertEquals(out.get(), Math.sqrt(1234567890), 0.0);
}
Also used : LongType(net.imglib2.type.numeric.integer.LongType) DoubleType(net.imglib2.type.numeric.real.DoubleType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 15 with LongType

use of net.imglib2.type.numeric.integer.LongType in project imagej-ops by imagej.

the class UnaryRealTypeMathTest method testArcsinh.

@Test
public void testArcsinh() {
    final LongType in = new LongType(1234567890);
    final DoubleType out = new DoubleType();
    ops.run(Arcsinh.class, out, in);
    final double delta = Math.sqrt(1234567890.0 * 1234567890.0 + 1);
    assertEquals(out.get(), Math.log(1234567890 + delta), 0.0);
}
Also used : LongType(net.imglib2.type.numeric.integer.LongType) DoubleType(net.imglib2.type.numeric.real.DoubleType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Aggregations

LongType (net.imglib2.type.numeric.integer.LongType)50 AbstractOpTest (net.imagej.ops.AbstractOpTest)48 Test (org.junit.Test)48 DoubleType (net.imglib2.type.numeric.real.DoubleType)37 ArrayList (java.util.ArrayList)1 Abs (net.imagej.ops.math.UnaryRealTypeMath.Abs)1 Ceil (net.imagej.ops.math.UnaryRealTypeMath.Ceil)1 Floor (net.imagej.ops.math.UnaryRealTypeMath.Floor)1 Invert (net.imagej.ops.math.UnaryRealTypeMath.Invert)1 MaxConstant (net.imagej.ops.math.UnaryRealTypeMath.MaxConstant)1 MinConstant (net.imagej.ops.math.UnaryRealTypeMath.MinConstant)1 NearestInt (net.imagej.ops.math.UnaryRealTypeMath.NearestInt)1 Negate (net.imagej.ops.math.UnaryRealTypeMath.Negate)1 Round (net.imagej.ops.math.UnaryRealTypeMath.Round)1 Sqr (net.imagej.ops.math.UnaryRealTypeMath.Sqr)1 LocalThresholdTest (net.imagej.ops.threshold.apply.LocalThresholdTest)1 FinalInterval (net.imglib2.FinalInterval)1 RandomAccessibleInterval (net.imglib2.RandomAccessibleInterval)1 UnsignedLongType (net.imglib2.type.numeric.integer.UnsignedLongType)1