Skip to content

Commit

Permalink
do cast unchecked
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Dec 13, 2023
1 parent 70be74a commit 6754f70
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -101,19 +102,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<UnsignedByteType>) array);
return buildUByte(Cast.unchecked(array));
}
else if (Util.getTypeFromInterval(array) instanceof IntType) {
return buildInt((RandomAccessibleInterval<IntType>) array);
return buildInt(Cast.unchecked(array));
}
else if (Util.getTypeFromInterval(array) instanceof FloatType) {
return buildFloat((RandomAccessibleInterval<FloatType>) array);
return buildFloat(Cast.unchecked(array));
}
else if (Util.getTypeFromInterval(array) instanceof DoubleType) {
return buildDouble((RandomAccessibleInterval<DoubleType>) array);
return buildDouble(Cast.unchecked(array));
}
else if (Util.getTypeFromInterval(array) instanceof LongType) {
return buildLong((RandomAccessibleInterval<LongType>) array);
return buildLong(Cast.unchecked(array));
}
else {
throw new IllegalArgumentException("Unsupported tensor type: " + Util
Expand Down

0 comments on commit 6754f70

Please sign in to comment.