Skip to content

Commit

Permalink
added bg logo to avoid drag and drop loading
Browse files Browse the repository at this point in the history
  • Loading branch information
ayeshanaikodi committed Nov 5, 2024
1 parent 2011f0f commit 3d2dca8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
16 changes: 10 additions & 6 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,23 @@
from app.ui import CustomWidget
import os



def main():

root = Tk()
root.withdraw()

# Initialize the viewer
viewer = napari.Viewer()

project_root = os.path.dirname(os.path.dirname(__file__))

logo_path = os.path.join(project_root, 'assets', 'logo2.png')
bg_logo_path = os.path.join(project_root, 'assets', 'logo.png')


if os.path.exists(bg_logo_path):
viewer.open(bg_logo_path, rgb=True, name='Logo')
else:
# print("Logo image not found at:", bg_logo_path)
viewer.add_text("Welcome to GSense", position=(0, 0), color='white', size=24)

# Add Save Selected Layer button to the layer list dock widget
layer_list_dock = viewer.window._qt_window.findChild(QDockWidget, "layer list")
Expand All @@ -27,7 +31,7 @@ def main():
layer_list_dock.setVisible(False)
layer_controls_dock.setVisible(False)

viewer.window._qt_window.setWindowTitle("Hyperspectral Image Analysis")
viewer.window._qt_window.setWindowTitle("GSense")
viewer.window._qt_window.setWindowIcon(QtGui.QIcon(logo_path))

# Add custom widget for batch image loading, spectral mixing, and segmentation
Expand All @@ -37,4 +41,4 @@ def main():
napari.run()

if __name__ == "__main__":
main()
main()
10 changes: 5 additions & 5 deletions app/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,15 @@ def update_button_highlight(self, rgb_idx):
for button in self.pseudo_rgb_buttons:
button.setStyleSheet("") # Reset to default style

# Highlight the Image button if `rgb_idx` is None (indicating the base image)
# Highlight the Image button if `rgb_idx` is None
if rgb_idx is None:
self.hsi_button.setStyleSheet("background-color: orange;") # Highlight style
self.hsi_button.setStyleSheet("background-color: darkgray;") # Highlight style
else:
self.hsi_button.setStyleSheet("") # Reset the style if not displaying the base image

# Highlight the specific pseudo-RGB button if `rgb_idx` is not None
if rgb_idx is not None and rgb_idx < len(self.pseudo_rgb_buttons):
self.pseudo_rgb_buttons[rgb_idx].setStyleSheet("background-color: orange;") # Highlight style
self.pseudo_rgb_buttons[rgb_idx].setStyleSheet("background-color: darkgray;") # Highlight style


def show_context_menu(self, button, pos, img_idx, rgb_idx):
Expand Down Expand Up @@ -452,8 +452,8 @@ def show_image_and_mask(self, img_idx, rgb_idx):
#########################

## Functionality based methods
### Image loading

### Image loading
def load_images(self):
''' Load images from file dialog '''
logger.info("User initiated image loading.")
Expand Down

0 comments on commit 3d2dca8

Please sign in to comment.