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