31
31
32
32
import net .imglib2 .Cursor ;
33
33
import net .imglib2 .RandomAccessibleInterval ;
34
- import net .imglib2 .blocks .PrimitiveBlocks ;
35
34
import net .imglib2 .img .Img ;
36
35
import net .imglib2 .type .NativeType ;
37
36
import net .imglib2 .type .numeric .RealType ;
38
- import net .imglib2 .type .numeric .integer .ByteType ;
39
37
import net .imglib2 .type .numeric .integer .IntType ;
40
38
import net .imglib2 .type .numeric .integer .UnsignedByteType ;
41
39
import net .imglib2 .type .numeric .real .DoubleType ;
@@ -82,6 +80,7 @@ Tensor<?> build(io.bioimage.modelrunner.tensor.Tensor<T> tensor) {
82
80
* @return The tensor created from the sequence.
83
81
* @throws IllegalArgumentException If the {@link RandomAccessibleInterval} dtype is not supported.
84
82
*/
83
+ @ SuppressWarnings ("unchecked" )
85
84
public static Tensor <?> build (RandomAccessibleInterval <?> rai )
86
85
{
87
86
if (Util .getTypeFromInterval (rai ) instanceof UnsignedByteType ) {
@@ -102,14 +101,6 @@ else if (Util.getTypeFromInterval(rai) instanceof DoubleType) {
102
101
}
103
102
}
104
103
105
- /**
106
- * Creates a unsigned byte-typed {@link Tensor} based on the provided
107
- * {@link RandomAccessibleInterval} and the desired dimension order for the
108
- * resulting tensor.
109
- *
110
- * @param tensor The {@link RandomAccessibleInterval} to be converted.
111
- * @return The {@link Tensor} created from the sequence.
112
- */
113
104
private static Tensor <UInt8 > buildUByte (
114
105
RandomAccessibleInterval <UnsignedByteType > tensor )
115
106
{
@@ -137,14 +128,6 @@ private static Tensor<UInt8> buildUByte(
137
128
return ndarray ;
138
129
}
139
130
140
- /**
141
- * Creates a integer-typed {@link Tensor} based on the provided
142
- * {@link RandomAccessibleInterval} and the desired dimension order for the
143
- * resulting tensor.
144
- *
145
- * @param tensor The {@link RandomAccessibleInterval} to be converted.
146
- * @return The {@link Tensor} created from the sequence.
147
- */
148
131
private static Tensor <Integer > buildInt (
149
132
RandomAccessibleInterval <IntType > tensor )
150
133
{
@@ -172,14 +155,6 @@ private static Tensor<Integer> buildInt(
172
155
return ndarray ;
173
156
}
174
157
175
- /**
176
- * Creates a float-typed {@link Tensor} based on the provided
177
- * {@link RandomAccessibleInterval} and the desired dimension order for the
178
- * resulting tensor.
179
- *
180
- * @param tensor The {@link RandomAccessibleInterval} to be converted.
181
- * @return The {@link Tensor} created from the sequence.
182
- */
183
158
private static Tensor <Float > buildFloat (
184
159
RandomAccessibleInterval <FloatType > tensor )
185
160
{
@@ -207,14 +182,6 @@ private static Tensor<Float> buildFloat(
207
182
return ndarray ;
208
183
}
209
184
210
- /**
211
- * Creates a double-typed {@link Tensor} based on the provided
212
- * {@link RandomAccessibleInterval} and the desired dimension order for the
213
- * resulting tensor.
214
- *
215
- * @param tensor The {@link RandomAccessibleInterval} to be converted.
216
- * @return The {@link Tensor} created from the sequence.
217
- */
218
185
private static Tensor <Double > buildDouble (
219
186
RandomAccessibleInterval <DoubleType > tensor )
220
187
{
0 commit comments