|
33 | 33 | import net.imglib2.type.numeric.integer.UnsignedByteType;
|
34 | 34 | import net.imglib2.type.numeric.real.DoubleType;
|
35 | 35 | import net.imglib2.type.numeric.real.FloatType;
|
| 36 | +import net.imglib2.util.Cast; |
36 | 37 | import net.imglib2.util.Util;
|
37 | 38 | import net.imglib2.view.Views;
|
38 | 39 |
|
@@ -104,19 +105,19 @@ public static < T extends RealType< T > & NativeType< T > > TType build(
|
104 | 105 | {
|
105 | 106 | // Create an Icy sequence of the same type of the tensor
|
106 | 107 | if (Util.getTypeFromInterval(array) instanceof UnsignedByteType) {
|
107 |
| - return buildUByte((RandomAccessibleInterval<UnsignedByteType>) array); |
| 108 | + return buildUByte(Cast.unchecked(array)); |
108 | 109 | }
|
109 | 110 | else if (Util.getTypeFromInterval(array) instanceof IntType) {
|
110 |
| - return buildInt((RandomAccessibleInterval<IntType>) array); |
| 111 | + return buildInt(Cast.unchecked(array)); |
111 | 112 | }
|
112 | 113 | else if (Util.getTypeFromInterval(array) instanceof FloatType) {
|
113 |
| - return buildFloat((RandomAccessibleInterval<FloatType>) array); |
| 114 | + return buildFloat(Cast.unchecked(array)); |
114 | 115 | }
|
115 | 116 | else if (Util.getTypeFromInterval(array) instanceof DoubleType) {
|
116 |
| - return buildDouble((RandomAccessibleInterval<DoubleType>) array); |
| 117 | + return buildDouble(Cast.unchecked(array)); |
117 | 118 | }
|
118 | 119 | else if (Util.getTypeFromInterval(array) instanceof LongType) {
|
119 |
| - return buildLong((RandomAccessibleInterval<LongType>) array); |
| 120 | + return buildLong(Cast.unchecked(array)); |
120 | 121 | }
|
121 | 122 | else {
|
122 | 123 | throw new IllegalArgumentException("Unsupported tensor type: " + Util
|
|
0 commit comments