diff --git a/jdaviz/configs/imviz/plugins/orientation/orientation.py b/jdaviz/configs/imviz/plugins/orientation/orientation.py
index 13b66c5152..e24b9f1baa 100644
--- a/jdaviz/configs/imviz/plugins/orientation/orientation.py
+++ b/jdaviz/configs/imviz/plugins/orientation/orientation.py
@@ -28,7 +28,7 @@
__all__ = ['Orientation']
-base_wcs_layer_label = 'Default orientation'
+base_wcs_layer_label = 'Default Orientation'
align_by_msg_to_trait = {'pixels': 'Pixels', 'wcs': 'WCS'}
@@ -52,15 +52,20 @@ class Orientation(PluginTemplateMixin, ViewerSelectMixin):
* :meth:`~jdaviz.core.template_mixin.PluginTemplateMixin.close_in_tray`
* ``align_by`` (`~jdaviz.core.template_mixin.SelectPluginComponent`)
* ``wcs_fast_approximation``
- * ``delete_subsets``
+ * :meth:`delete_subsets``
* ``viewer``
* ``orientation``
* ``rotation_angle``
* ``east_left``
- * ``add_orientation``
+ * :meth:`add_orientation`
+ * :meth:`create_north_up_east_left`
+ * :meth:`create_north_up_east_right`
"""
template_file = __file__, "orientation.vue"
+ # defined as traitlet to allow access from UI - leave fixed
+ base_wcs_layer_label = Unicode(base_wcs_layer_label).tag(sync=True)
+
align_by_items = List().tag(sync=True)
align_by_selected = Unicode().tag(sync=True)
wcs_use_fallback = Bool(True).tag(sync=True)
@@ -146,7 +151,8 @@ def user_api(self):
expose=(
'align_by', 'link_type', 'wcs_fast_approximation', 'wcs_use_affine',
'delete_subsets', 'viewer', 'orientation',
- 'rotation_angle', 'east_left', 'add_orientation'
+ 'rotation_angle', 'east_left', 'add_orientation',
+ 'create_north_up_east_left', 'create_north_up_east_right',
)
)
@@ -526,12 +532,8 @@ def _on_viewer_change(self, msg={}):
if ref_data.label in self.orientation.choices:
self.orientation.selected = ref_data.label
- def create_north_up_east_left(self, label="North-up, East-left", set_on_create=False,
+ def _create_north_up_east_left(self, label="North-up, East-left", set_on_create=False,
from_ui=False):
- """
- Set the rotation angle and flip to achieve North up and East left
- according to the reference image WCS.
- """
if label not in self.orientation.choices:
degn = self._get_wcs_angles()[-3]
self._add_orientation(rotation_angle=degn, east_left=True,
@@ -540,12 +542,23 @@ def create_north_up_east_left(self, label="North-up, East-left", set_on_create=F
elif set_on_create:
self.orientation.selected = label
- def create_north_up_east_right(self, label="North-up, East-right", set_on_create=False,
- from_ui=False):
+ def create_north_up_east_left(self, label="North-up, East-left",
+ set_on_create=False):
"""
- Set the rotation angle and flip to achieve North up and East right
+ Set the rotation angle and flip to achieve North up and East left
according to the reference image WCS.
+
+ Parameters
+ ----------
+ label : str
+ Data label for this new orientation layer.
+ set_on_create : bool
+ Whether to set the created option as the current orientation.
"""
+ self._create_north_up_east_left(label=label, set_on_create=set_on_create)
+
+ def _create_north_up_east_right(self, label="North-up, East-right", set_on_create=False,
+ from_ui=False):
if label not in self.orientation.choices:
degn = self._get_wcs_angles()[-3]
self._add_orientation(rotation_angle=180 - degn, east_left=False,
@@ -554,11 +567,26 @@ def create_north_up_east_right(self, label="North-up, East-right", set_on_create
elif set_on_create:
self.orientation.selected = label
+ def create_north_up_east_right(self, label="North-up, East-right",
+ set_on_create=False):
+ """
+ Set the rotation angle and flip to achieve North up and East right
+ according to the reference image WCS.
+
+ Parameters
+ ----------
+ label : str
+ Data label for this new orientation layer.
+ set_on_create : bool
+ Whether to set the created option as the current orientation.
+ """
+ self._create_north_up_east_right(label=label, set_on_create=set_on_create)
+
def vue_select_north_up_east_left(self, *args, **kwargs):
- self.create_north_up_east_left(set_on_create=True, from_ui=True)
+ self._create_north_up_east_left(set_on_create=True, from_ui=True)
def vue_select_north_up_east_right(self, *args, **kwargs):
- self.create_north_up_east_right(set_on_create=True, from_ui=True)
+ self._create_north_up_east_right(set_on_create=True, from_ui=True)
def vue_select_default_orientation(self, *args, **kwargs):
self.orientation.selected = base_wcs_layer_label
diff --git a/jdaviz/configs/imviz/plugins/orientation/orientation.vue b/jdaviz/configs/imviz/plugins/orientation/orientation.vue
index d272d0d9fb..b68f5eecbd 100644
--- a/jdaviz/configs/imviz/plugins/orientation/orientation.vue
+++ b/jdaviz/configs/imviz/plugins/orientation/orientation.vue
@@ -128,18 +128,45 @@
Presets:
-
+
mdi-image-outline
+ {{ api_hints_enabled ?
+ 'plg.orientation = \''+base_wcs_layer_label+'\''
+ :
+ null
+ }}
-
+
+ {{ api_hints_enabled ?
+ 'plg.create_north_up_east_left()'
+ :
+ null
+ }}
-
+
+ {{ api_hints_enabled ?
+ 'plg.create_north_up_east_right()'
+ :
+ null
+ }}