diff --git a/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api050/tensor/TensorBuilder.java b/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api050/tensor/TensorBuilder.java index d5a9379..e1724e1 100644 --- a/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api050/tensor/TensorBuilder.java +++ b/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api050/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; @@ -104,19 +105,19 @@ public static < T extends RealType< T > & NativeType< T > > 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