From 499a369ddd78edce7ff5ec60ecde2667a0e55aba Mon Sep 17 00:00:00 2001 From: Kevin Yamauchi Date: Mon, 2 Dec 2019 10:40:15 -0800 Subject: [PATCH 1/4] add axis labels to display() --- starfish/core/_display.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/starfish/core/_display.py b/starfish/core/_display.py index 8569cfab7..6f43abb19 100644 --- a/starfish/core/_display.py +++ b/starfish/core/_display.py @@ -17,7 +17,7 @@ Viewer = None -NAPARI_VERSION = "0.2.0" # when changing this, update docs in display +NAPARI_VERSION = "0.2.6" # when changing this, update docs in display INTERACTIVE = not hasattr(__main__, "__file__") @@ -226,7 +226,15 @@ def display( from qtpy.QtWidgets import QApplication app = QApplication.instance() or QApplication([]) - viewer = Viewer() + viewer = Viewer( + axis_labels=[ + Axes.ROUND.value, + Axes.CH.value, + Axes.ZPLANE.value, + Axes.Y.value, + Axes.X.value + ] + ) new_viewer = True elif isinstance(viewer, Viewer): new_viewer = False From e37817b015e6f2c3aadb76a43b6411fb3c776be1 Mon Sep 17 00:00:00 2001 From: Kevin Yamauchi Date: Mon, 2 Dec 2019 11:07:44 -0800 Subject: [PATCH 2/4] update display() docstring --- starfish/core/_display.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/starfish/core/_display.py b/starfish/core/_display.py index 6f43abb19..77e54c933 100644 --- a/starfish/core/_display.py +++ b/starfish/core/_display.py @@ -196,9 +196,8 @@ def display( Notes ----- - To use in ipython, use the `%gui qt` magic. - - napari axes currently cannot be labeled. Until such a time that they can, this function will - order them by Round, Channel, and Z. - - Requires at least napari 0.2.0: use `pip install starfish[napari]` + - napari axes are labeled with the ImageStack axis names + - Requires napari 0.2.6: use `pip install starfish[napari]` to install all necessary requirements """ if stack is None and spots is None and masks is None: From ff27195bb1add9da66d2b72c1f99a1de53552c51 Mon Sep 17 00:00:00 2001 From: Kevin Yamauchi Date: Mon, 2 Dec 2019 14:11:42 -0800 Subject: [PATCH 3/4] get axis order from starfish.core.imagestack.dataorder --- starfish/core/_display.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/starfish/core/_display.py b/starfish/core/_display.py index 77e54c933..5359b616c 100644 --- a/starfish/core/_display.py +++ b/starfish/core/_display.py @@ -6,6 +6,7 @@ import numpy as np from packaging.version import parse as parse_version +from starfish.core.imagestack.dataorder import AXES_DATA, N_AXES from starfish.core.imagestack.imagestack import ImageStack from starfish.core.intensity_table.intensity_table import IntensityTable from starfish.core.morphology.binary_mask import BinaryMaskCollection @@ -225,15 +226,17 @@ def display( from qtpy.QtWidgets import QApplication app = QApplication.instance() or QApplication([]) - viewer = Viewer( - axis_labels=[ - Axes.ROUND.value, - Axes.CH.value, - Axes.ZPLANE.value, - Axes.Y.value, - Axes.X.value - ] - ) + # Get the list of axis labels + axis_labels = [] + for ix in range(N_AXES): + for axis_name, axis_data in AXES_DATA.items(): + if ix == axis_data.order: + axis_labels.append(axis_name.value) + break + axis_labels.append(Axes.Y.value) + axis_labels.append(Axes.X.value) + + viewer = Viewer(axis_labels=axis_labels) new_viewer = True elif isinstance(viewer, Viewer): new_viewer = False From 7aba7a7f207da6cfcaf7139114d2253aed39dca3 Mon Sep 17 00:00:00 2001 From: Tony Tung Date: Mon, 2 Dec 2019 18:13:57 -0800 Subject: [PATCH 4/4] rais error when AXES_DATA is missing an entry --- starfish/core/_display.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/starfish/core/_display.py b/starfish/core/_display.py index 5359b616c..2e84cfbb3 100644 --- a/starfish/core/_display.py +++ b/starfish/core/_display.py @@ -233,6 +233,8 @@ def display( if ix == axis_data.order: axis_labels.append(axis_name.value) break + else: + raise Exception(f"No AXES_DATA entry for the {ix}th axis") axis_labels.append(Axes.Y.value) axis_labels.append(Axes.X.value)