Search in sources :

Example 1 with UnsignedLongType

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

the class InvertTest method testUnsignedLongTypeInvert.

@Test
public void testUnsignedLongTypeInvert() {
    final Img<UnsignedLongType> inUnsignedLongType = generateUnsignedLongArrayTestImg(true, 5, 5);
    final Img<UnsignedLongType> outUnsignedLongType = inUnsignedLongType.factory().create(inUnsignedLongType, new UnsignedLongType());
    assertIntegerInvert(inUnsignedLongType, outUnsignedLongType);
    assertIntegerInvertMinMaxProvided(inUnsignedLongType, outUnsignedLongType, new UnsignedLongType(3025), new UnsignedLongType(3846));
}
Also used : UnsignedLongType(net.imglib2.type.numeric.integer.UnsignedLongType) AbstractOpTest(net.imagej.ops.AbstractOpTest) Test(org.junit.Test)

Example 2 with UnsignedLongType

use of net.imglib2.type.numeric.integer.UnsignedLongType 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

UnsignedLongType (net.imglib2.type.numeric.integer.UnsignedLongType)2 AbstractOpTest (net.imagej.ops.AbstractOpTest)1 UnboundedIntegerType (net.imagej.types.UnboundedIntegerType)1 Unsigned128BitType (net.imglib2.type.numeric.integer.Unsigned128BitType)1 Test (org.junit.Test)1