|
12 | 12 | from SmartMicro.ImageTiles import getTilePositionsV2
|
13 | 13 |
|
14 | 14 |
|
15 |
| -def prepareNNImages(mitoFull, drpFull, model): |
| 15 | +def prepareNNImages(mitoFull, drpFull, model, bacteria = False): |
16 | 16 | """Preprocess raw iSIM images before running them throught the neural network.
|
17 | 17 |
|
18 | 18 | Args:
|
@@ -74,13 +74,16 @@ def prepareNNImages(mitoFull, drpFull, model):
|
74 | 74 | i = 0
|
75 | 75 | inputData = np.zeros((positions['n']**2, nnImageSize, nnImageSize, 2), dtype=np.uint8())
|
76 | 76 | for position in positions['px']:
|
| 77 | + |
77 | 78 | inputData[i, :, :, :] = inputDataFull[:,
|
78 | 79 | position[0]:position[2],
|
79 | 80 | position[1]:position[3],
|
80 | 81 | :]
|
81 |
| - # inputData[i, :, :, 1] = exposure.rescale_intensity( |
82 |
| - # inputData[i, :, :, 1], (0, np.max(inputData[i, :, :, 1])), |
83 |
| - # out_range=(0, 255)) |
| 82 | + if bacteria: |
| 83 | + inputData[i, :, :, 1] = exposure.rescale_intensity( |
| 84 | + inputData[i, :, :, 1], (0, np.max(inputData[i, :, :, 1])), |
| 85 | + out_range=(0, 255)) |
| 86 | + |
84 | 87 | inputData[i, :, :, 0] = exposure.rescale_intensity(
|
85 | 88 | inputData[i, :, :, 0], (0, np.max(inputData[i, :, :, 0])),
|
86 | 89 | out_range=(0, 255))
|
|
0 commit comments