Skip to content
This repository has been archived by the owner on Nov 26, 2023. It is now read-only.

Commit

Permalink
add bigtiff .btf file association
Browse files Browse the repository at this point in the history
  • Loading branch information
kushalkolar committed Jun 22, 2021
1 parent 3df7bbd commit 266dd5b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
5 changes: 5 additions & 0 deletions mesmerize/viewer/core/organize_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,8 @@ def ome_tiff(path: str) -> dict:
def ome_tif(path: str) -> dict:
""".tif"""
return ome_tiff(path)


def ome_btf(path: str) -> dict:
""".btf"""
return ome_tiff(path)
16 changes: 11 additions & 5 deletions mesmerize/viewer/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@
)


file_associations =\
{
'.tif': tiff_io.ModuleGUI,
'.tiff': tiff_io.ModuleGUI,
'.btf': tiff_io.ModuleGUI,
}


class MainWindow(QtWidgets.QMainWindow):
standard_modules = {'tiff_io': tiff_io.ModuleGUI,
'mesfile': mesfile_io.ModuleGUI,
Expand Down Expand Up @@ -533,8 +541,6 @@ def dropEvent(self, ev):
else:
return

if file.endswith('.tiff') or file.endswith('.tif'):
tio = self.get_module('tiff_io')
assert isinstance(tio, tiff_io.ModuleGUI)
tio.tiff_file_path = file
tio.check_meta_path()
ext = os.path.splitext(file)[1]

self.get_module(file_associations[ext]).file_sink(file)
5 changes: 4 additions & 1 deletion mesmerize/viewer/modules/tiff_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def __init__(self, parent, viewer_reference):

self.meta_loader = None

def file_sink(self, path):
self.tiff_file_path = path

@property
def tiff_file_path(self) -> str:
return self._tiff_file_path
Expand Down Expand Up @@ -85,7 +88,7 @@ def set_load_method(self, method: str):
raise ValueError('Must set one of the following methods: imread, asarray, asarray-multi.')
self._load_method = method

@use_open_file_dialog('Choose tiff file', '', ['*.tiff', '*.tif'])
@use_open_file_dialog('Choose tiff file', '', ['*.tiff', '*.tif', '*.btf'])
def select_tiff_file(self, path, *args, **kwargs):
self.tiff_file_path = path
self.check_meta_path()
Expand Down

0 comments on commit 266dd5b

Please sign in to comment.