Skip to content

Commit

Permalink
Fixing Gui in Lightsheet
Browse files Browse the repository at this point in the history
  • Loading branch information
beniroquai committed Aug 8, 2023
1 parent f7d51b4 commit 26bb80e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

# scaler
self.scaler = 10
self.scaler = 100

# initialize the positioner
self.positioner_name = self._master.positionersManager.getAllDeviceNames()[0]
Expand All @@ -30,7 +30,6 @@ def moveXY(self, x, y):
return x, y

def moveZA(self, a, z):
print(z)
if abs(a)>0 or abs(z) >0:
self.positioner.moveForever(speed=(a*self.scaler, 0, 0, z*self.scaler), is_stop=False)
else:
Expand Down
14 changes: 11 additions & 3 deletions imswitch/imcontrol/controller/controllers/LightsheetController.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class LightsheetController(ImConWidgetController):
"""Linked to LightsheetWidget."""
sigImageReceived = Signal()

sigSliderIlluValueChanged = Signal(float)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._logger = initLogger(self)
Expand All @@ -29,7 +29,6 @@ def __init__(self, *args, **kwargs):
self._widget.startButton.clicked.connect(self.startLightsheet)
self._widget.stopButton.clicked.connect(self.stopLightsheet)
#self._widget.mctShowLastButton.clicked.connect(self.showLast)
#self._widget.sigSliderIlluValueChanged.connect(self.valueIlluChanged)

# select detectors
allDetectorNames = self._master.detectorsManager.getAllDeviceNames()
Expand All @@ -44,14 +43,23 @@ def __init__(self, *args, **kwargs):
self._widget.setAvailableStageAxes(self.stages.axes)
self.isLightsheetRunning = False


self._widget.sigSliderIlluValueChanged.connect(self.valueIlluChanged)
self.sigImageReceived.connect(self.displayImage)

def displayImage(self):
# a bit weird, but we cannot update outside the main thread
name = "Lightsheet Stack"
self._widget.setImage(np.uint16(self.lightsheetStack ), colormap="gray", name=name, pixelsize=(1,1), translation=(0,0))

def valueIlluChanged(self):
illuSource = self._widget.getIlluminationSource()
illuValue = self._widget.illuminationSlider.value()
self._master.lasersManager
if not self._master.lasersManager[illuSource].enabled:
self._master.lasersManager[illuSource].setEnabled(1)

illuValue = illuValue/100*self._master.lasersManager[illuSource].valueRangeMax
self._master.lasersManager[illuSource].setValue(illuValue)

def startLightsheet(self):
minPos = self._widget.getMinPosition()
Expand Down
8 changes: 6 additions & 2 deletions imswitch/imcontrol/view/widgets/LightsheetWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

class LightsheetWidget(NapariHybridWidget):
""" Widget containing mct interface. """


sigSliderIlluValueChanged = QtCore.Signal(float) # (value)
def __post_init__(self):
#super().__init__(*args, **kwargs)

Expand All @@ -26,6 +26,10 @@ def __post_init__(self):
self.illuminationSlider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
self.illuminationSlider.setMinimum(0)
self.illuminationSlider.setMaximum(100)
self.illuminationSlider.valueChanged.connect(
lambda value: self.sigSliderIlluValueChanged.emit(value)
)

self.grid.addWidget(self.illuminationSlider, 3, 1, 1, 1)

# Pull-down menu for the stage axis
Expand Down

0 comments on commit 26bb80e

Please sign in to comment.