Skip to content

Commit

Permalink
Remove single-pixel tool from Imviz (#2710)
Browse files Browse the repository at this point in the history
* Remove single-pixel tool from Imviz
but it is still available in Cubeviz.

* Update doc and fix PEP 8
  • Loading branch information
pllim authored Feb 19, 2024
1 parent b58a5a4 commit b563ed3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 64 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ Imviz

- ``imviz.link_data()`` inputs and behaviors are now consistent with the Orientation plugin. [#2179]

- Single-pixel tool is no longer available. To mark a single-pixel area, use Markers plugin. [#2710]

Mosviz
^^^^^^

Expand Down
26 changes: 1 addition & 25 deletions docs/imviz/displayimages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,31 +204,7 @@ to make subsets visible or invisible, to change their color, and to change their
Single-Pixel Selection
----------------------

This tool allows the user to create a single-pixel spatial region
in an image viewer. Activate this tool and then left-click to create
the new region. Click again to move the region to a new location under
the cursor. Holding down the alt key (Alt key on Windows, Option key
on Mac) while clicking pixels creates a new region at each point instead
of moving the previously created region. You can also use the subset
modes that are explained in the
:ref:`Spatial Regions <imviz_defining_spatial_regions>`
section above in the same way you would with the other subset selection
tools.

When you have multiple images loaded and linked by WCS
(see :ref:`imviz-orientation`), the region defined is with respect to
the reference image, which might not be the image you are viewing.

.. warning::

Region created might not accurately represent area you think you are
clicking under the mouse if you click on an image that is zoomed out
too much. It is recommended that you zoom in sufficiently to see the
individual pixels to use this feature.

.. note::

Creating too many single-pixel regions may affect performance.
This tool is no longer available as of Jdaviz v3.9; use :ref:`markers-plugin` plugin instead.

Blinking
========
Expand Down
2 changes: 1 addition & 1 deletion jdaviz/configs/imviz/plugins/viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ImvizImageView(JdavizViewerMixin, BqplotImageView, AstrowidgetsImageViewer
['jdaviz:boxzoommatch', 'jdaviz:boxzoom'],
['jdaviz:panzoommatch', 'jdaviz:imagepanzoom'],
['bqplot:truecircle', 'bqplot:rectangle', 'bqplot:ellipse',
'bqplot:circannulus', 'jdaviz:singlepixelregion'],
'bqplot:circannulus'],
['jdaviz:blinkonce', 'jdaviz:contrastbias'],
['jdaviz:sidebar_plot', 'jdaviz:sidebar_export', 'jdaviz:sidebar_compass']
]
Expand Down
38 changes: 0 additions & 38 deletions jdaviz/configs/imviz/tests/test_tools.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import numpy as np
from numpy.testing import assert_allclose
from regions import RectanglePixelRegion

from jdaviz.configs.imviz.tests.utils import BaseImviz_WCS_WCS

Expand Down Expand Up @@ -65,43 +64,6 @@ def test_panzoom_tools(self):
t_linkedpan.deactivate()


# We use a new test class to avoid a dirty state from previous test.
class TestSinglePixelRegion(BaseImviz_WCS_WCS):
def test_singlepixelregion(self):
# NOTE: This only works in pixel linking now, not WCS linking.

t = self.imviz.default_viewer._obj.toolbar.tools['jdaviz:singlepixelregion']
t.activate()

# Create a region while viewing reference data.
t.on_mouse_event({'event': 'click', 'altKey': False, 'domain': {'x': 1, 'y': 2}})
regions = self.imviz.get_interactive_regions()
assert len(regions) == 1
reg = regions['Subset 1']
assert (isinstance(reg, RectanglePixelRegion) and reg.center.x == 1 and reg.center.y == 2
and reg.width == 1 and reg.height == 1)

# Clicking again will move the region, not creating a new one.
t.on_mouse_event({'event': 'click', 'altKey': False, 'domain': {'x': 2, 'y': 3}})
regions = self.imviz.get_interactive_regions()
assert len(regions) == 1
reg = regions['Subset 1']
assert (isinstance(reg, RectanglePixelRegion) and reg.center.x == 2 and reg.center.y == 3
and reg.width == 1 and reg.height == 1)

# Create a new region while viewing dithered data.
# Region will still be w.r.t. reference data, that is, x and y from domain stay the same.
self.imviz.default_viewer.blink_once()
t.on_mouse_event({'event': 'click', 'altKey': True, 'domain': {'x': 3, 'y': 4}})
regions = self.imviz.get_interactive_regions()
assert len(regions) == 2
reg = regions['Subset 2']
assert (isinstance(reg, RectanglePixelRegion) and reg.center.x == 3 and reg.center.y == 4
and reg.width == 1 and reg.height == 1)

t.deactivate()


def test_blink(imviz_helper):
viewer = imviz_helper.default_viewer._obj

Expand Down

0 comments on commit b563ed3

Please sign in to comment.