Search in sources :

Example 1 with Unsigned128BitType

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

the class AbstractOpTest method generateUnsigned128BitArrayTestImg.

public ArrayImg<Unsigned128BitType, LongArray> generateUnsigned128BitArrayTestImg(final boolean fill, final long... dims) {
    ArrayImg<Unsigned128BitType, LongArray> bits = ArrayImgs.unsigned128Bits(dims);
    if (fill) {
        MersenneTwisterFast betterRNG = new MersenneTwisterFast(0xf1eece);
        for (Unsigned128BitType b : bits) {
            BigInteger big = BigInteger.valueOf(betterRNG.nextLong());
            b.set(big);
        }
    }
    return bits;
}
Also used : LongArray(net.imglib2.img.basictypeaccess.array.LongArray) MersenneTwisterFast(org.scijava.util.MersenneTwisterFast) BigInteger(java.math.BigInteger) Unsigned128BitType(net.imglib2.type.numeric.integer.Unsigned128BitType)

Example 2 with Unsigned128BitType

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

the class InvertTest method testUnsigned128ByteTypeInvert.

@Test
public void testUnsigned128ByteTypeInvert() {
    final Img<Unsigned128BitType> inUnsigned128BitType = generateUnsigned128BitArrayTestImg(true, 5, 5);
    final Img<Unsigned128BitType> outUnsigned128BitType = inUnsigned128BitType.factory().create(inUnsigned128BitType, new Unsigned128BitType());
    assertIntegerInvert(inUnsigned128BitType, outUnsigned128BitType);
    assertIntegerInvertMinMaxProvided(inUnsigned128BitType, outUnsigned128BitType, new Unsigned128BitType(BigInteger.valueOf(3025)), new Unsigned128BitType(BigInteger.valueOf(3468)));
}
Also used : Unsigned128BitType(net.imglib2.type.numeric.integer.Unsigned128BitType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 3 with Unsigned128BitType

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

the class InvertIIInteger method maxValue.

public static <T extends RealType<T>> T maxValue(T type) {
    // TODO: Consider making maxValue an op.
    final T max = type.createVariable();
    if (max instanceof Unsigned128BitType) {
        final Unsigned128BitType t = (Unsigned128BitType) max;
        t.set(t.getMaxBigIntegerValue());
    } else if (max instanceof UnsignedLongType) {
        final UnsignedLongType t = (UnsignedLongType) max;
        t.set(t.getMaxBigIntegerValue());
    } else if (max instanceof UnboundedIntegerType) {
        max.setReal(0);
    } else {
        max.setReal(type.getMaxValue());
    }
    return max;
}
Also used : UnboundedIntegerType(net.imagej.types.UnboundedIntegerType) UnsignedLongType(net.imglib2.type.numeric.integer.UnsignedLongType) Unsigned128BitType(net.imglib2.type.numeric.integer.Unsigned128BitType)

Aggregations

Unsigned128BitType (net.imglib2.type.numeric.integer.Unsigned128BitType)3 BigInteger (java.math.BigInteger)1 AbstractOpTest (net.imagej.ops.AbstractOpTest)1 UnboundedIntegerType (net.imagej.types.UnboundedIntegerType)1 LongArray (net.imglib2.img.basictypeaccess.array.LongArray)1 UnsignedLongType (net.imglib2.type.numeric.integer.UnsignedLongType)1 Test (org.junit.Test)1 MersenneTwisterFast (org.scijava.util.MersenneTwisterFast)1