Skip to content

Commit eb1b6e1

Browse files
committed
Add a few missing convert ops
1 parent 5aea9a5 commit eb1b6e1

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

scijava-ops-image/src/main/java/org/scijava/ops/image/convert/ConvertNumbersToRealTypes.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class ConvertNumbersToRealTypes<N extends Number, T extends RealType<T>,
5858
/**
5959
* @input num the {@link Number} to convert
6060
* @output a {@link UnsignedByteType} containing the information in {@code num}
61-
* @implNote op names='engine.convert, convert.int8'
61+
* @implNote op names='engine.convert, convert.uint8'
6262
*/
6363
public final Function<N, UnsignedByteType> numberToUnsignedByteType = //
6464
num -> new UnsignedByteType(num.shortValue());
@@ -71,6 +71,14 @@ public class ConvertNumbersToRealTypes<N extends Number, T extends RealType<T>,
7171
public final Function<N, ShortType> numberToShortType = //
7272
num -> new ShortType(num.shortValue());
7373

74+
/**
75+
* @input num the {@link Number} to convert
76+
* @output a {@link UnsignedShortType} containing the information in {@code num}
77+
* @implNote op names='engine.convert, convert.uint16'
78+
*/
79+
public final Function<N, UnsignedShortType> numberToUnsignedShortType = //
80+
num -> new UnsignedShortType(num.intValue());
81+
7482
/**
7583
* @input num the {@link Number} to convert
7684
* @output a {@link IntType} containing the information in {@code num}
@@ -79,6 +87,14 @@ public class ConvertNumbersToRealTypes<N extends Number, T extends RealType<T>,
7987
public final Function<N, IntType> numberToIntType = //
8088
num -> new IntType(num.intValue());
8189

90+
/**
91+
* @input num the {@link Number} to convert
92+
* @output a {@link UnsignedIntType} containing the information in {@code num}
93+
* @implNote op names='engine.convert, convert.uint32'
94+
*/
95+
public final Function<N, UnsignedIntType> numberToUnsignedIntType = //
96+
num -> new UnsignedIntType(num.longValue());
97+
8298
/**
8399
* @input num the {@link Number} to convert
84100
* @output a {@link LongType} containing the information in {@code num}

scijava-ops-image/src/test/java/org/scijava/ops/image/OpRegressionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public class OpRegressionTest {
4242

4343
@Test
4444
public void testOpDiscoveryRegression() {
45-
long expected = 1962;
45+
long expected = 1964;
4646
long actual = ops.infos().size();
4747
assertEquals(expected, actual);
4848
}

scijava-ops-image/src/test/java/org/scijava/ops/image/convert/TestConvertNumbersToRealTypes.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ public class TestConvertNumbersToRealTypes extends AbstractOpTest {
4040

4141
public static final Class<?>[] REAL_TYPES = {
4242
ByteType.class,
43+
UnsignedByteType.class,
4344
ShortType.class,
45+
UnsignedShortType.class,
4446
IntType.class,
47+
UnsignedIntType.class,
4548
LongType.class,
4649
FloatType.class,
4750
DoubleType.class

0 commit comments

Comments
 (0)