|
57 | 57 | import io.bioimage.modelrunner.tensor.Tensor; |
58 | 58 | import io.bioimage.modelrunner.tensor.shm.SharedMemoryArray; |
59 | 59 | import io.bioimage.modelrunner.utils.CommonUtils; |
| 60 | +import net.imglib2.Cursor; |
60 | 61 | import net.imglib2.RandomAccessibleInterval; |
| 62 | +import net.imglib2.loops.LoopBuilder; |
61 | 63 | import net.imglib2.type.NativeType; |
62 | 64 | import net.imglib2.type.numeric.RealType; |
63 | 65 | import net.imglib2.util.Cast; |
64 | 66 | import net.imglib2.util.Util; |
| 67 | +import net.imglib2.view.Views; |
65 | 68 |
|
66 | 69 | /** |
67 | 70 | * This class implements an interface that allows the main plugin to interact in |
@@ -316,8 +319,30 @@ else if (task.status == TaskStatus.CRASHED) { |
316 | 319 | shm = SharedMemoryArray.read(name); |
317 | 320 | shmaOutputList.add(shm); |
318 | 321 | } |
319 | | - RandomAccessibleInterval<?> rai = shm.getSharedRAI(); |
| 322 | + RandomAccessibleInterval<T> rai = shm.getSharedRAI(); |
| 323 | + // TODO remove |
| 324 | + double max0 = 0; |
| 325 | + Cursor<T> iter0 = Views.iterable(rai).cursor(); |
| 326 | + while (iter0.hasNext()) { |
| 327 | + iter0.next(); |
| 328 | + double doub = iter0.get().getRealDouble(); |
| 329 | + if (doub > max0) |
| 330 | + max0 = doub; |
| 331 | + } |
| 332 | + System.out.println("Output SHM " + i + " max value: " + max0); |
| 333 | + // TODO remove |
320 | 334 | outputTensors.get(i).setData(Tensor.createCopyOfRaiInWantedDataType(Cast.unchecked(rai), Util.getTypeFromInterval(Cast.unchecked(rai)))); |
| 335 | + // TODO remove |
| 336 | + double max = 0; |
| 337 | + Cursor<R> iter = Views.iterable(outputTensors.get(i).getData()).cursor(); |
| 338 | + while (iter.hasNext()) { |
| 339 | + iter.next(); |
| 340 | + double doub = iter.get().getRealDouble(); |
| 341 | + if (doub > max) |
| 342 | + max = doub; |
| 343 | + } |
| 344 | + System.out.println("Copied ouput " + i + " max value: " + max); |
| 345 | + // TODO remove |
321 | 346 | } |
322 | 347 | } catch (Exception e) { |
323 | 348 | closeShmas(); |
|
0 commit comments