diff --git a/src/main/java/io/bioimage/modelrunner/tensor/ListToImgLib2.java b/src/main/java/io/bioimage/modelrunner/tensor/ListToImgLib2.java index 37c2fdff..45eaba9c 100644 --- a/src/main/java/io/bioimage/modelrunner/tensor/ListToImgLib2.java +++ b/src/main/java/io/bioimage/modelrunner/tensor/ListToImgLib2.java @@ -165,7 +165,7 @@ public static < T extends RealType< T > & NativeType< T > > RandomAccessibleInte * @return the reconstructed {@link RandomAccessibleInterval} * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of {@link Byte}s or {@link Integer}s */ - private static RandomAccessibleInterval buildInt8(List array, List tensorShape) + private static RandomAccessibleInterval buildInt8(List array, List tensorShape) throws IllegalArgumentException { if (!(array.get(0) instanceof Byte) && !(array.get(0) instanceof Integer)) { @@ -183,11 +183,10 @@ private static RandomAccessibleInterval buildInt8(List array, List buildInt8FromByte(List tensor, List tensorShape) { @@ -203,11 +202,10 @@ private static RandomAccessibleInterval buildInt8FromByte(List t * * @param array * {@link List} object containing the flat data of the {@link RandomAccessibleInterval}. - * The list should contain either {@link Byte} objects or {@link Integer} objects + * The list should contain {@link Integer} objects * @param shape * {@link List} containing the shape of the {@link RandomAccessibleInterval} that wants to be created from the flat array * @return the reconstructed {@link RandomAccessibleInterval} - * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of {@link Byte}s or {@link Integer}s */ private static RandomAccessibleInterval buildInt8FromInteger(List tensor, List tensorShape) { @@ -224,7 +222,7 @@ private static RandomAccessibleInterval buildInt8FromInteger(List buildInt8FromInteger(List buildUint8(List array, List tensorShape) + private static RandomAccessibleInterval buildUint8(List array, List tensorShape) throws IllegalArgumentException { if (!(array.get(0) instanceof Byte) && !(array.get(0) instanceof Integer)) { @@ -248,15 +246,14 @@ private static RandomAccessibleInterval buildUint8(List array, } /** - * Creates a {@link ByteType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. + * Creates a {@link UnsignedByteType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. * * @param array * {@link List} object containing the flat data of the {@link RandomAccessibleInterval}. - * The list should contain either {@link Byte} objects or {@link Integer} objects + * The list should contain {@link Byte} objects * @param shape * {@link List} containing the shape of the {@link RandomAccessibleInterval} that wants to be created from the flat array * @return the reconstructed {@link RandomAccessibleInterval} - * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of {@link Byte}s or {@link Integer}s */ private static RandomAccessibleInterval buildUint8FromByte(List tensor, List tensorShape) { @@ -273,15 +270,14 @@ private static RandomAccessibleInterval buildUint8FromByte(Lis } /** - * Creates a {@link ByteType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. + * Creates a {@link UnsignedByteType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. * * @param array * {@link List} object containing the flat data of the {@link RandomAccessibleInterval}. - * The list should contain either {@link Byte} objects or {@link Integer} objects + * The list should contain {@link Integer} objects * @param shape * {@link List} containing the shape of the {@link RandomAccessibleInterval} that wants to be created from the flat array * @return the reconstructed {@link RandomAccessibleInterval} - * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of {@link Byte}s or {@link Integer}s */ private static RandomAccessibleInterval buildUint8FromInteger(List tensor, List tensorShape) { @@ -298,17 +294,17 @@ private static RandomAccessibleInterval buildUint8FromInteger( } /** - * Creates a {@link ByteType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. + * Creates a {@link ShortType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. * * @param array * {@link List} object containing the flat data of the {@link RandomAccessibleInterval}. - * The list should contain either {@link Byte} objects or {@link Integer} objects + * The list should contain either {@link Short} objects or {@link Integer} objects * @param shape * {@link List} containing the shape of the {@link RandomAccessibleInterval} that wants to be created from the flat array * @return the reconstructed {@link RandomAccessibleInterval} - * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of {@link Byte}s or {@link Integer}s + * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of {@link Short}s or {@link Integer}s */ - private static RandomAccessibleInterval buildInt16(List array, List tensorShape) + private static RandomAccessibleInterval buildInt16(List array, List tensorShape) throws IllegalArgumentException { if (!(array.get(0) instanceof Short) && !(array.get(0) instanceof Integer)) { @@ -322,15 +318,14 @@ private static RandomAccessibleInterval buildInt16(List array, List buildInt16FromShort(List tensor, List tensorShape) { @@ -347,15 +342,14 @@ private static RandomAccessibleInterval buildInt16FromShort(List buildInt16FromInteger(List tensor, List tensorShape) { @@ -372,17 +366,17 @@ private static RandomAccessibleInterval buildInt16FromInteger(List buildUint16(List array, List tensorShape) + private static RandomAccessibleInterval buildUint16(List array, List tensorShape) throws IllegalArgumentException { if (!(array.get(0) instanceof Short) && !(array.get(0) instanceof Integer)) { @@ -396,15 +390,14 @@ private static RandomAccessibleInterval buildUint16(List arra } /** - * Creates a {@link ByteType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. + * Creates a {@link UnsignedShortType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. * * @param array * {@link List} object containing the flat data of the {@link RandomAccessibleInterval}. - * The list should contain either {@link Byte} objects or {@link Integer} objects + * The list should contain {@link Short} objects * @param shape * {@link List} containing the shape of the {@link RandomAccessibleInterval} that wants to be created from the flat array * @return the reconstructed {@link RandomAccessibleInterval} - * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of {@link Byte}s or {@link Integer}s */ private static RandomAccessibleInterval buildUint16FromShort(List tensor, List tensorShape) { @@ -421,15 +414,14 @@ private static RandomAccessibleInterval buildUint16FromShort( } /** - * Creates a {@link ByteType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. + * Creates a {@link UnsignedShortType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. * * @param array * {@link List} object containing the flat data of the {@link RandomAccessibleInterval}. - * The list should contain either {@link Byte} objects or {@link Integer} objects + * The list should contain {@link Integer} objects * @param shape * {@link List} containing the shape of the {@link RandomAccessibleInterval} that wants to be created from the flat array * @return the reconstructed {@link RandomAccessibleInterval} - * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of {@link Byte}s or {@link Integer}s */ private static RandomAccessibleInterval buildUint16FromInteger(List tensor, List tensorShape) { @@ -446,17 +438,17 @@ private static RandomAccessibleInterval buildUint16FromIntege } /** - * Creates a {@link ByteType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. + * Creates a {@link IntType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. * * @param array * {@link List} object containing the flat data of the {@link RandomAccessibleInterval}. - * The list should contain either {@link Byte} objects or {@link Integer} objects + * The list should contain {@link Integer} objects * @param shape * {@link List} containing the shape of the {@link RandomAccessibleInterval} that wants to be created from the flat array * @return the reconstructed {@link RandomAccessibleInterval} - * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of {@link Byte}s or {@link Integer}s + * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of @link Integer}s */ - private static RandomAccessibleInterval buildInt32(List array, List tensorShape) + private static RandomAccessibleInterval buildInt32(List array, List tensorShape) throws IllegalArgumentException { if (!(array.get(0) instanceof Integer)) { throw new IllegalArgumentException("Unable to build ImgLib2 array of data type " @@ -467,15 +459,14 @@ private static RandomAccessibleInterval buildInt32(List array, List buildInt32FromInteger(List tensor, List tensorShape) { @@ -492,17 +483,17 @@ private static RandomAccessibleInterval buildInt32FromInteger(List buildUint32(List array, List tensorShape) + private static RandomAccessibleInterval buildUint32(List array, List tensorShape) throws IllegalArgumentException { if (!(array.get(0) instanceof Long) && !(array.get(0) instanceof Integer)) { @@ -516,15 +507,14 @@ private static RandomAccessibleInterval buildUint32(List array, } /** - * Creates a {@link ByteType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. + * Creates a {@link UnsignedIntType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. * * @param array * {@link List} object containing the flat data of the {@link RandomAccessibleInterval}. - * The list should contain either {@link Byte} objects or {@link Integer} objects + * The list should contain {@link Integer} objects * @param shape * {@link List} containing the shape of the {@link RandomAccessibleInterval} that wants to be created from the flat array * @return the reconstructed {@link RandomAccessibleInterval} - * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of {@link Byte}s or {@link Integer}s */ private static RandomAccessibleInterval buildUint32FromInteger(List tensor, List tensorShape) { @@ -541,15 +531,14 @@ private static RandomAccessibleInterval buildUint32FromInteger( } /** - * Creates a {@link ByteType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. + * Creates a {@link UnsignedIntType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. * * @param array * {@link List} object containing the flat data of the {@link RandomAccessibleInterval}. - * The list should contain either {@link Byte} objects or {@link Integer} objects + * The list should contain {@link Long} objects * @param shape * {@link List} containing the shape of the {@link RandomAccessibleInterval} that wants to be created from the flat array * @return the reconstructed {@link RandomAccessibleInterval} - * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of {@link Byte}s or {@link Integer}s */ private static RandomAccessibleInterval buildUint32FromLong(List tensor, List tensorShape) { @@ -566,17 +555,17 @@ private static RandomAccessibleInterval buildUint32FromLong(Lis } /** - * Creates a {@link ByteType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. + * Creates a {@link LongType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. * * @param array * {@link List} object containing the flat data of the {@link RandomAccessibleInterval}. - * The list should contain either {@link Byte} objects or {@link Integer} objects + * The list should contain either {@link Long} objects or {@link Integer} objects * @param shape * {@link List} containing the shape of the {@link RandomAccessibleInterval} that wants to be created from the flat array * @return the reconstructed {@link RandomAccessibleInterval} - * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of {@link Byte}s or {@link Integer}s + * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of {@link Long}s or {@link Integer}s */ - private static RandomAccessibleInterval buildInt64(List array, List tensorShape) + private static RandomAccessibleInterval buildInt64(List array, List tensorShape) throws IllegalArgumentException { if (!(array.get(0) instanceof Long) && !(array.get(0) instanceof Integer)) { @@ -590,15 +579,14 @@ private static RandomAccessibleInterval buildInt64(List array, List buildInt64FromLong(List tensor, List tensorShape) { @@ -615,15 +603,14 @@ private static RandomAccessibleInterval buildInt64FromLong(List } /** - * Creates a {@link ByteType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. + * Creates a {@link LongType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. * * @param array * {@link List} object containing the flat data of the {@link RandomAccessibleInterval}. - * The list should contain either {@link Byte} objects or {@link Integer} objects + * The list should contain {@link Integer} objects * @param shape * {@link List} containing the shape of the {@link RandomAccessibleInterval} that wants to be created from the flat array * @return the reconstructed {@link RandomAccessibleInterval} - * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of {@link Byte}s or {@link Integer}s */ private static RandomAccessibleInterval buildInt64FromInteger(List tensor, List tensorShape) { @@ -640,17 +627,17 @@ private static RandomAccessibleInterval buildInt64FromInteger(List buildFloat32(List array, List tensorShape) + private static RandomAccessibleInterval buildFloat32(List array, List tensorShape) throws IllegalArgumentException { if (!(array.get(0) instanceof Float) && !(array.get(0) instanceof BigDecimal)) { @@ -664,15 +651,14 @@ private static RandomAccessibleInterval buildFloat32(List array, List } /** - * Creates a {@link ByteType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. + * Creates a {@link FloatType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. * * @param array * {@link List} object containing the flat data of the {@link RandomAccessibleInterval}. - * The list should contain either {@link Byte} objects or {@link Integer} objects + * The list should contain {@link Float} objects * @param shape * {@link List} containing the shape of the {@link RandomAccessibleInterval} that wants to be created from the flat array * @return the reconstructed {@link RandomAccessibleInterval} - * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of {@link Byte}s or {@link Integer}s */ private static RandomAccessibleInterval buildFloat32FromFloat(List tensor, List tensorShape) { @@ -689,15 +675,14 @@ private static RandomAccessibleInterval buildFloat32FromFloat(List buildFloat32FromBigDecimal(List tensor, List tensorShape) { @@ -714,17 +699,17 @@ private static RandomAccessibleInterval buildFloat32FromBigDecimal(Li } /** - * Creates a {@link ByteType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. + * Creates a {@link DoubleType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. * * @param array * {@link List} object containing the flat data of the {@link RandomAccessibleInterval}. - * The list should contain either {@link Byte} objects or {@link Integer} objects + * The list should contain either {@link Float} objects, {@link BigDecimal} objects or {@link Double} objects * @param shape * {@link List} containing the shape of the {@link RandomAccessibleInterval} that wants to be created from the flat array * @return the reconstructed {@link RandomAccessibleInterval} - * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of {@link Byte}s or {@link Integer}s + * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of {@link Float}s , {@link Double}s or {@link BigDecimal}s */ - private static RandomAccessibleInterval buildFloat64(List array, List tensorShape) + private static RandomAccessibleInterval buildFloat64(List array, List tensorShape) throws IllegalArgumentException { if (!(array.get(0) instanceof Float) && !(array.get(0) instanceof Double) @@ -741,15 +726,14 @@ private static RandomAccessibleInterval buildFloat64(List array, Lis } /** - * Creates a {@link ByteType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. + * Creates a {@link DoubleType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. * * @param array * {@link List} object containing the flat data of the {@link RandomAccessibleInterval}. - * The list should contain either {@link Byte} objects or {@link Integer} objects + * The list should contain {@link Double} objects * @param shape * {@link List} containing the shape of the {@link RandomAccessibleInterval} that wants to be created from the flat array * @return the reconstructed {@link RandomAccessibleInterval} - * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of {@link Byte}s or {@link Integer}s */ private static RandomAccessibleInterval buildFloat64FromDouble(List tensor, List tensorShape) { @@ -766,15 +750,14 @@ private static RandomAccessibleInterval buildFloat64FromDouble(List< } /** - * Creates a {@link ByteType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. + * Creates a {@link DoubleType} {@link RandomAccessibleInterval} from the information stored in a {@link List} given the shape of the RAI. * * @param array * {@link List} object containing the flat data of the {@link RandomAccessibleInterval}. - * The list should contain either {@link Byte} objects or {@link Integer} objects + * The list should contain {@link Float} objects * @param shape * {@link List} containing the shape of the {@link RandomAccessibleInterval} that wants to be created from the flat array * @return the reconstructed {@link RandomAccessibleInterval} - * @throws IllegalArgumentException if the input argument 'array' is not a {@link List} of {@link Byte}s or {@link Integer}s */ private static RandomAccessibleInterval buildFloat64FromFloat(List tensor, List tensorShape) { @@ -791,15 +774,14 @@ private static RandomAccessibleInterval buildFloat64FromFloat(List buildFloat64FromBigDecimal(List tensor, List tensorShape) {