diff --git a/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api030/tensor/TensorBuilder.java b/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api030/tensor/TensorBuilder.java index c2d757e..7f082e4 100644 --- a/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api030/tensor/TensorBuilder.java +++ b/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api030/tensor/TensorBuilder.java @@ -33,6 +33,7 @@ import net.imglib2.type.numeric.integer.UnsignedByteType; import net.imglib2.type.numeric.real.DoubleType; import net.imglib2.type.numeric.real.FloatType; +import net.imglib2.util.Cast; import net.imglib2.util.Util; import net.imglib2.view.Views; @@ -101,19 +102,19 @@ public static & NativeType> TType build( { // Create an Icy sequence of the same type of the tensor if (Util.getTypeFromInterval(array) instanceof UnsignedByteType) { - return buildUByte((RandomAccessibleInterval) array); + return buildUByte(Cast.unchecked(array)); } else if (Util.getTypeFromInterval(array) instanceof IntType) { - return buildInt((RandomAccessibleInterval) array); + return buildInt(Cast.unchecked(array)); } else if (Util.getTypeFromInterval(array) instanceof FloatType) { - return buildFloat((RandomAccessibleInterval) array); + return buildFloat(Cast.unchecked(array)); } else if (Util.getTypeFromInterval(array) instanceof DoubleType) { - return buildDouble((RandomAccessibleInterval) array); + return buildDouble(Cast.unchecked(array)); } else if (Util.getTypeFromInterval(array) instanceof LongType) { - return buildLong((RandomAccessibleInterval) array); + return buildLong(Cast.unchecked(array)); } else { throw new IllegalArgumentException("Unsupported tensor type: " + Util