Search in sources :

Example 81 with DoubleType

use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.

the class UnaryRealTypeMathTest method testArccoth.

@Test
public void testArccoth() {
    final LongType in = new LongType(1234567890);
    final DoubleType out = new DoubleType();
    ops.run(Arccoth.class, out, in);
    final double result = 0.5 * Math.log(1234567891.0 / 1234567889.0);
    assertEquals(out.get(), result, 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 82 with DoubleType

use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.

the class UnaryRealTypeMathTest method testArctan.

@Test
public void testArctan() {
    final LongType in = new LongType(1234567890);
    final DoubleType out = new DoubleType();
    ops.run(Arctan.class, out, in);
    assertEquals(out.get(), Math.atan(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 83 with DoubleType

use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.

the class UnaryRealTypeMathTest method testLog2.

@Test
public void testLog2() {
    final LongType in = new LongType(1234567890);
    final DoubleType out = new DoubleType();
    ops.run(Log2.class, out, in);
    assertEquals(out.get(), Math.log(1234567890) / Math.log(2), 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 84 with DoubleType

use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.

the class UnaryRealTypeMathTest method testCosh.

@Test
public void testCosh() {
    final LongType in = new LongType(1234567890);
    final DoubleType out = new DoubleType();
    ops.run(Cosh.class, out, in);
    assertEquals(out.get(), Math.cosh(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 85 with DoubleType

use of net.imglib2.type.numeric.real.DoubleType in project imagej-ops by imagej.

the class UnaryRealTypeMathTest method assertArccsc.

// -- Helper methods --
private void assertArccsc(final double i, final double o) {
    final DoubleType in = new DoubleType(i);
    final DoubleType out = (DoubleType) ops.run(Arccsc.class, in.createVariable(), in);
    assertEquals(o, out.get(), 1e-15);
}
Also used : DoubleType(net.imglib2.type.numeric.real.DoubleType) Arccsc(net.imagej.ops.math.UnaryRealTypeMath.Arccsc)

Aggregations

DoubleType (net.imglib2.type.numeric.real.DoubleType)142 Test (org.junit.Test)114 AbstractOpTest (net.imagej.ops.AbstractOpTest)104 LongType (net.imglib2.type.numeric.integer.LongType)37 Random (java.util.Random)19 Img (net.imglib2.img.Img)9 FinalInterval (net.imglib2.FinalInterval)8 ArrayList (java.util.ArrayList)7 Ops (net.imagej.ops.Ops)7 BitType (net.imglib2.type.logic.BitType)7 UnaryComputerOp (net.imagej.ops.special.computer.UnaryComputerOp)6 RandomAccessibleInterval (net.imglib2.RandomAccessibleInterval)6 RealLocalizable (net.imglib2.RealLocalizable)6 LocalThresholdMethod (net.imagej.ops.threshold.LocalThresholdMethod)5 FinalDimensions (net.imglib2.FinalDimensions)5 CreateImgFromImg (net.imagej.ops.create.img.CreateImgFromImg)4 Dimensions (net.imglib2.Dimensions)4 UnsignedByteType (net.imglib2.type.numeric.integer.UnsignedByteType)4 Module (org.scijava.module.Module)4 CreateImgFromDimsAndType (net.imagej.ops.create.img.CreateImgFromDimsAndType)3