Skip to content

Commit

Permalink
Fix showing registered images for multiple suffixes for a registered …
Browse files Browse the repository at this point in the history
…image type

Overlaying multiple registered images of a given type, such as the registered atlas volume and sample image, sets the registered suffixes for the atlas type to a sequence. This sequence causes an exception when extracting the extension from the suffix. Handle both sequences and non-sequences, simply taking the first value for sequences.
  • Loading branch information
yoda-vid committed Jul 23, 2020
1 parent f09e4ab commit d822149
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions magmap/gui/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1408,19 +1408,23 @@ def _setup_for_image(self):
self._main_img_names.selections)
self._labels_img_names.selections[0] = ""

# set registered names based on loaded images, defaulting to
# set any registered names based on loaded images, defaulting to
# image5d and no labels
main_suffix = self._main_img_names.selections[0]
labels_suffix = self._labels_img_names.selections[0]
if config.reg_suffixes:
# use registered suffixes without ext, using first suffix
# of each type
suffix = config.reg_suffixes[config.RegSuffixes.ATLAS]
if suffix:
suffix = os.path.splitext(suffix)[0]
suffix = os.path.splitext(
libmag.get_if_within(suffix, 0, ""))[0]
if suffix in self._main_img_names.selections:
main_suffix = suffix
suffix = config.reg_suffixes[config.RegSuffixes.ANNOTATION]
if suffix:
suffix = os.path.splitext(suffix)[0]
suffix = os.path.splitext(
libmag.get_if_within(suffix, 0, ""))[0]
if suffix in self._labels_img_names.selections:
labels_suffix = suffix
self._main_img_name = main_suffix
Expand Down

0 comments on commit d822149

Please sign in to comment.