Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/navigate/_commit.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
17 changes: 15 additions & 2 deletions src/navigate/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,18 @@
from pathlib import Path
from os.path import isfile
from multiprocessing.managers import ListProxy, DictProxy
import logging

# Third Party Imports
import yaml

# Local Imports
from navigate.tools.common_functions import build_ref_name

# Logger Setup
p = __name__.split(".")[1]
logger = logging.getLogger(p)


def get_navigate_path():
"""Establish a program home directory in AppData/Local/.navigate for Windows
Expand Down Expand Up @@ -944,6 +949,10 @@ def verify_configuration(manager, configuration):
continue
parent_microscope_name = inherited_microscope_dict[microscope_name]
if parent_microscope_name not in device_config.keys():
logger.error(
f"Microscope {parent_microscope_name} is not defined in "
f"configuration.yaml"
)
raise Exception(
f"Microscope {parent_microscope_name} is not "
f"defined in configuration.yaml"
Expand Down Expand Up @@ -981,11 +990,15 @@ def verify_configuration(manager, configuration):
for device_name in required_devices:
if device_name not in device_config[microscope_name]:
print(
f"*** Please make sure you have {device_name} "
f"Please make sure you have {device_name} "
f"in the configuration for microscope {microscope_name}, or "
f"{microscope_name} is inherited from another valid microscope!"
)
raise Exception()
logger.error(
f"{device_name} is not defined in configuration.yaml for "
f"microscope {microscope_name}"
)
raise Exception(f"No {device_name} defined for microscope {microscope_name}")
camera_config = device_config[microscope_name]["camera"]
if "delay" not in camera_config.keys():
camera_config["delay"] = camera_config.get("delay_percent", 2)
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/controller/configuration_controller.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
23 changes: 14 additions & 9 deletions src/navigate/controller/configurator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted for academic and research use only
Expand Down Expand Up @@ -188,7 +188,7 @@ def set_value(temp_dict, key_list, value):
print(
f"Notice: {hardware_name} has an empty value {ref}! Please double check if it's okay!"
)

if k_idx in value_dict:
k = value_dict[k_idx][v]
v = variables[v_idx].get()
Expand Down Expand Up @@ -218,7 +218,7 @@ def set_value(temp_dict, key_list, value):
if warning_info:
messagebox.showwarning(
title="Configuration",
message=f"There are empty value(s) with {', '.join(warning_info.keys())}. Please double check!"
message=f"There are empty value(s) with {', '.join(warning_info.keys())}. Please double check!",
)

def write_to_yaml(self, config, filename):
Expand Down Expand Up @@ -305,15 +305,19 @@ def get_widgets_value(widgets, value_dict):
continue
value = get_widget_value(key, value_dict)
# widgets[key][3] is the value mapping dict
if widgets[key][1] != "Spinbox"and widgets[key][3]:
if widgets[key][1] != "Spinbox" and widgets[key][3]:
# if the value is not valid, return the last valid value
if type(widgets[key][3]) == list:
reverse_value_dict = dict(map(lambda v: (v, v), widgets[key][3]))
reverse_value_dict = dict(
map(lambda v: (v, v), widgets[key][3])
)
else:
reverse_value_dict = dict(
map(lambda v: (v[1], v[0]), widgets[key][3].items())
)
temp[key] = reverse_value_dict.get(value, list(reverse_value_dict.values())[-1])
temp[key] = reverse_value_dict.get(
value, list(reverse_value_dict.values())[-1]
)
else:
temp[key] = value
return temp
Expand Down Expand Up @@ -358,6 +362,7 @@ def build_widgets_value(widgets, value_dict):
result.append(get_widgets_value(widgets, value_dict))

return result

# ask file name
file_name = filedialog.askopenfilename(
defaultextension=".yml", filetypes=[("Yaml file", "*.yml *.yaml")]
Expand All @@ -370,10 +375,10 @@ def build_widgets_value(widgets, value_dict):
if config_dict is None or "microscopes" not in config_dict:
messagebox.showerror(
title="Configuration",
message="It's not a valid configuration.yaml file!"
message="It's not a valid configuration.yaml file!",
)
return

self.delete_microscopes()

for i, microscope_name in enumerate(config_dict["microscopes"].keys()):
Expand All @@ -387,7 +392,7 @@ def build_widgets_value(widgets, value_dict):
sticky=tk.NSEW,
)
self.view.microscope_window.tab_list.append(microscope_name)

for hardware_type, widgets in hardwares_dict.items():
hardware_ref_name = hardwares_config_name_dict[hardware_type]
# build dictionary values for widgets
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/controller/sub_controllers/adaptive_optics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/controller/sub_controllers/autofocus.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/controller/sub_controllers/camera_map.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
3 changes: 1 addition & 2 deletions src/navigate/controller/sub_controllers/camera_settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -256,7 +256,6 @@ def populate_experiment_values(self):
self.camera_setting_dict["frames_to_average"]
)


# after initialization
self.in_initialization = False

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/controller/sub_controllers/channels_tab.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/controller/sub_controllers/features_popup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/controller/sub_controllers/gui.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/controller/sub_controllers/ilastik.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/controller/sub_controllers/keystrokes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/controller/sub_controllers/menus.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
6 changes: 4 additions & 2 deletions src/navigate/controller/sub_controllers/microscope_popup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -237,7 +237,9 @@ def confirm_microscope_setting(self):
)
controller_name = f"{microscope_name.lower()}_camera_setting_controller"
if hasattr(self.parent_controller, controller_name):
camera_setting_controller = getattr(self.parent_controller, controller_name)
camera_setting_controller = getattr(
self.parent_controller, controller_name
)
camera_setting_controller.popup.popup.dismiss()
delattr(self.parent_controller, controller_name)
else:
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/controller/sub_controllers/multiposition.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/controller/sub_controllers/stages.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/controller/sub_controllers/tiling.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/controller/sub_controllers/waveform_popup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/controller/sub_controllers/waveform_tab.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/controller/thread_pool.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/log_files/filters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/log_files/log_functions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
4 changes: 4 additions & 0 deletions src/navigate/log_files/logging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ loggers:
level: DEBUG
handlers: [console, vc_info, vc_debug, performance]
propagate: no
config:
level: DEBUG
handlers: [console, vc_info, vc_debug, performance]
propagate: no


# https://docs.python.org/3/library/logging.html#logrecord-objects
2 changes: 1 addition & 1 deletion src/navigate/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/model/analysis/boundary_detect.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2023 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/model/analysis/camera.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/navigate/model/analysis/image_contrast.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 The University of Texas Southwestern Medical Center.
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
Expand Down
51 changes: 45 additions & 6 deletions src/navigate/model/data_sources/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,52 @@
# Copyright (c) 2021-2024 The University of Texas Southwestern Medical Center.
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
# modification, are permitted for academic and research use only (subject to the
# limitations in the disclaimer below) provided that the following conditions are met:

# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.

# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.

# * Neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.

# NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
# THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.


# Standard Imports
import logging

# Third Party Imports

# Local Imports

# Logger Setup
p = __name__.split(".")[1]
logger = logging.getLogger(p)

""" File type specific data sources. """

FILE_TYPES = ["TIFF", "OME-TIFF", "H5", "N5", "OME-Zarr"]


def get_data_source(file_type):
def get_data_source(file_type: str):
"""Get the data source class for the given file type.

Parameters
Expand All @@ -15,11 +58,6 @@ def get_data_source(file_type):
-------
DataSource
Data source class for the given file type.

Examples
--------
>>> get_data_source('tif')
<class 'navigate.model.data_sources.tif.TifDataSource'>
"""

if (file_type == "TIFF") or (file_type == "OME-TIFF"):
Expand All @@ -38,4 +76,5 @@ def get_data_source(file_type):
return OMEZarrDataSource

else:
logger.error(f"Unknown file type {file_type}. Cannot open.")
raise NotImplementedError(f"Unknown file type {file_type}. Cannot open.")
Loading
Loading