Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scale bar #129

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions sashimi/gui/camera_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def __init__(self, state: State, timer: QTimer, style: str):
),
blending="translucent",
name="frame_layer",
scale=self.voxel_size,
)

# Add square ROI of size max image size:
Expand Down Expand Up @@ -131,12 +132,14 @@ def __init__(self, state: State, timer: QTimer, style: str):
self.bottom_layout.addWidget(self.viewer.window.qt_viewer.viewerButtons)

self.auto_contrast_chk = QCheckBox("Autoadjust contrast")
self.toggle_scalebar_btn = QPushButton("Show/hide scalebar")

self.contrast_range = ContrastSettings()
self.wid_contrast_range = ParameterGui(self.contrast_range)

self.bottom_layout.addWidget(self.auto_contrast_chk)
self.bottom_layout.addWidget(self.wid_contrast_range)
self.bottom_layout.addWidget(self.toggle_scalebar_btn)

self.bottom_layout.addStretch()

Expand All @@ -147,6 +150,7 @@ def __init__(self, state: State, timer: QTimer, style: str):
# Connect changes of camera and laser to contrast reset:
self.auto_contrast_chk.stateChanged.connect(self.update_auto_contrast)
self.contrast_range.sig_param_changed.connect(self.set_manual_contrast)
self.toggle_scalebar_btn.pressed.connect(self.toggle_scalebar)

self.auto_contrast_chk.setChecked(True)

Expand Down Expand Up @@ -254,6 +258,12 @@ def update_auto_contrast(self, is_checked):
def set_manual_contrast(self):
self.frame_layer.contrast_limits = self.contrast_range.contrast_range

def toggle_scalebar(self):
if self.viewer.scale_bar.visible:
self.viewer.scale_bar.visible = False
else:
self.viewer.scale_bar.visible = True


class CameraSettingsWidget(QWidget):
"""Widget to modify parameters for the camera.
Expand Down