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;
}
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)));
}
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;
}
Aggregations