Skip to content

Commit bdf78e1

Browse files
committed
tile FtsZ rescale for bacteria
1 parent 7f4107a commit bdf78e1

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

NNfeeder.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from SmartMicro.ImageTiles import getTilePositionsV2
1313

1414

15-
def prepareNNImages(mitoFull, drpFull, model):
15+
def prepareNNImages(mitoFull, drpFull, model, bacteria = False):
1616
"""Preprocess raw iSIM images before running them throught the neural network.
1717
1818
Args:
@@ -74,13 +74,16 @@ def prepareNNImages(mitoFull, drpFull, model):
7474
i = 0
7575
inputData = np.zeros((positions['n']**2, nnImageSize, nnImageSize, 2), dtype=np.uint8())
7676
for position in positions['px']:
77+
7778
inputData[i, :, :, :] = inputDataFull[:,
7879
position[0]:position[2],
7980
position[1]:position[3],
8081
:]
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+
8487
inputData[i, :, :, 0] = exposure.rescale_intensity(
8588
inputData[i, :, :, 0], (0, np.max(inputData[i, :, :, 0])),
8689
out_range=(0, 255))

NetworkWatchdog.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class NetworkWatchdog(QWidget):
6060
def __init__(self):
6161
# Set if channels are used in Micromanager
6262
self.channels = True
63+
self.bacteria = True
6364

6465
# Read settings from the json file depending on which computer we are on
6566
with open('./ATS_settings.json') as file:
@@ -264,7 +265,7 @@ def onModified(self, event):
264265

265266
# Preprocess the data and make tiles if necessary
266267
inputData, positions = prepareNNImages(
267-
mitoFull, drpFull, self.model)
268+
mitoFull, drpFull, self.model, self.bacteria)
268269
# print(inputData.shape)
269270
# Calculate the prediction on the full batch of images
270271
outputPredict = self.model.predict_on_batch(inputData)

0 commit comments

Comments
 (0)