ndv.views.bases #
Abstract base classes for views and viewable objects.
Classes:
-
ArrayCanvas
–ABC for canvases that show array data.
-
ArrayView
–ABC for ND Array viewers widget.
-
CanvasElement
–Protocol defining an interactive element on the Canvas.
-
HistogramCanvas
–A histogram-based view for LookUp Table (LUT) adjustment.
-
LutView
–Manages LUT properties (contrast, colormap, etc...) in a view object.
-
Mouseable
–Mixin class for objects that can be interacted with using the mouse.
-
Viewable
–ABC representing anything that can be viewed on screen.
ArrayCanvas #
Bases: GraphicsCanvas
ABC for canvases that show array data.
Methods:
-
canvas_to_world
–Map XY canvas position (pixels) to XYZ coordinate in world space.
-
close
–Close the view/widget.
-
frontend_widget
–Return the native object backing the viewable objects.
-
set_visible
–Sets the visibility of the view/widget itself.
canvas_to_world abstractmethod
#
Map XY canvas position (pixels) to XYZ coordinate in world space.
Source code in ndv/views/bases/_graphics/_canvas.py
35 36 37 38 39 |
|
close abstractmethod
#
close() -> None
Close the view/widget.
Source code in ndv/views/bases/_view_base.py
19 20 21 |
|
ArrayView #
Bases: Viewable
ABC for ND Array viewers widget.
Currently, this is the "main" widget that contains the array display and all the controls for interacting with the array, includings sliders, LUTs, and histograms.
Methods:
-
close
–Close the view/widget.
-
frontend_widget
–Return the native object backing the viewable objects.
-
set_visible
–Sets the visibility of the view/widget itself.
Source code in ndv/views/bases/_array_view.py
36 37 38 39 |
|
close abstractmethod
#
close() -> None
Close the view/widget.
Source code in ndv/views/bases/_view_base.py
19 20 21 |
|
CanvasElement #
Bases: Mouseable
Protocol defining an interactive element on the Canvas.
Methods:
-
can_select
–Defines whether the element can be selected.
-
cursor_at
–Returns the element's cursor preference at the provided position.
-
move
–Behavior executed throughout a "move" operation.
-
remove
–Removes the element from the canvas.
-
selected
–Returns element selection status.
-
set_selected
–Sets element selection status.
-
set_visible
–Sets element visibility.
-
start_move
–Behavior executed at the beginning of a "move" operation.
-
visible
–Defines whether the element is visible on the canvas.
can_select abstractmethod
#
can_select() -> bool
Defines whether the element can be selected.
Source code in ndv/views/bases/_graphics/_canvas_elements.py
28 29 30 |
|
cursor_at #
Returns the element's cursor preference at the provided position.
Source code in ndv/views/bases/_graphics/_canvas_elements.py
40 41 |
|
move #
Behavior executed throughout a "move" operation.
In layman's terms, this is the behavior executed during the "drag" of a "click-and-drag".
Source code in ndv/views/bases/_graphics/_canvas_elements.py
51 52 53 54 55 56 57 |
|
remove #
remove() -> None
Removes the element from the canvas.
Source code in ndv/views/bases/_graphics/_canvas_elements.py
59 60 |
|
selected abstractmethod
#
selected() -> bool
Returns element selection status.
Source code in ndv/views/bases/_graphics/_canvas_elements.py
32 33 34 |
|
set_selected abstractmethod
#
set_selected(selected: bool) -> None
Sets element selection status.
Source code in ndv/views/bases/_graphics/_canvas_elements.py
36 37 38 |
|
set_visible abstractmethod
#
set_visible(visible: bool) -> None
Sets element visibility.
Source code in ndv/views/bases/_graphics/_canvas_elements.py
24 25 26 |
|
start_move #
Behavior executed at the beginning of a "move" operation.
In layman's terms, this is the behavior executed during the the "click" of a "click-and-drag".
Source code in ndv/views/bases/_graphics/_canvas_elements.py
43 44 45 46 47 48 49 |
|
HistogramCanvas #
Bases: GraphicsCanvas
, LutView
A histogram-based view for LookUp Table (LUT) adjustment.
Methods:
-
canvas_to_world
–Map XY canvas position (pixels) to XYZ coordinate in world space.
-
close
–Close the view/widget.
-
frontend_widget
–Return the native object backing the viewable objects.
-
set_auto_scale
–Set the autoscale button to checked if
checked
is True. -
set_channel_name
–Set the name of the channel to
name
. -
set_channel_visible
–Check or uncheck the visibility indicator of the LUT.
-
set_clims
–Set the (low, high) contrast limits to
clims
. -
set_colormap
–Set the colormap to
cmap
. -
set_data
–Sets the histogram data.
-
set_gamma
–Set the gamma value of the LUT.
-
set_log_base
–Sets the axis scale of the range.
-
set_vertical
–If True, orient axes vertically (x-axis on left).
-
set_visible
–Sets the visibility of the view/widget itself.
canvas_to_world abstractmethod
#
Map XY canvas position (pixels) to XYZ coordinate in world space.
Source code in ndv/views/bases/_graphics/_canvas.py
35 36 37 38 39 |
|
close abstractmethod
#
close() -> None
Close the view/widget.
Source code in ndv/views/bases/_view_base.py
19 20 21 |
|
frontend_widget abstractmethod
#
frontend_widget() -> Any
Return the native object backing the viewable objects.
Source code in ndv/views/bases/_view_base.py
11 12 13 |
|
set_auto_scale abstractmethod
#
set_auto_scale(checked: bool) -> None
Set the autoscale button to checked if checked
is True.
Source code in ndv/views/bases/_lut_view.py
23 24 25 |
|
set_channel_name abstractmethod
#
set_channel_name(name: str) -> None
Set the name of the channel to name
.
Source code in ndv/views/bases/_lut_view.py
19 20 21 |
|
set_channel_visible abstractmethod
#
set_channel_visible(visible: bool) -> None
Check or uncheck the visibility indicator of the LUT.
Usually corresponds to a checkbox.
Source code in ndv/views/bases/_lut_view.py
41 42 43 44 45 46 |
|
set_clims abstractmethod
#
Set the (low, high) contrast limits to clims
.
Usually this will be a range slider or two text boxes.
Source code in ndv/views/bases/_lut_view.py
34 35 36 37 38 39 |
|
set_colormap abstractmethod
#
set_colormap(cmap: Colormap) -> None
Set the colormap to cmap
.
Usually corresponds to a dropdown menu.
Source code in ndv/views/bases/_lut_view.py
27 28 29 30 31 32 |
|
set_data #
Sets the histogram data.
Properties
values : np.ndarray The histogram values. bin_edges : np.ndarray The bin edges of the histogram.
Source code in ndv/views/bases/_graphics/_canvas.py
83 84 85 86 87 88 89 90 91 92 |
|
set_gamma #
set_gamma(gamma: float) -> None
Set the gamma value of the LUT.
Source code in ndv/views/bases/_lut_view.py
48 49 50 |
|
set_log_base #
set_log_base(base: float | None) -> None
Sets the axis scale of the range.
Properties
enabled : bool If true, the range will be displayed with a logarithmic (base 10) scale. If false, the range will be displayed with a linear scale.
Source code in ndv/views/bases/_graphics/_canvas.py
73 74 75 76 77 78 79 80 81 |
|
LutView #
Bases: Viewable
Manages LUT properties (contrast, colormap, etc...) in a view object.
Methods:
-
close
–Close the view/widget.
-
frontend_widget
–Return the native object backing the viewable objects.
-
set_auto_scale
–Set the autoscale button to checked if
checked
is True. -
set_channel_name
–Set the name of the channel to
name
. -
set_channel_visible
–Check or uncheck the visibility indicator of the LUT.
-
set_clims
–Set the (low, high) contrast limits to
clims
. -
set_colormap
–Set the colormap to
cmap
. -
set_gamma
–Set the gamma value of the LUT.
-
set_visible
–Sets the visibility of the view/widget itself.
close abstractmethod
#
close() -> None
Close the view/widget.
Source code in ndv/views/bases/_view_base.py
19 20 21 |
|
frontend_widget abstractmethod
#
frontend_widget() -> Any
Return the native object backing the viewable objects.
Source code in ndv/views/bases/_view_base.py
11 12 13 |
|
set_auto_scale abstractmethod
#
set_auto_scale(checked: bool) -> None
Set the autoscale button to checked if checked
is True.
Source code in ndv/views/bases/_lut_view.py
23 24 25 |
|
set_channel_name abstractmethod
#
set_channel_name(name: str) -> None
Set the name of the channel to name
.
Source code in ndv/views/bases/_lut_view.py
19 20 21 |
|
set_channel_visible abstractmethod
#
set_channel_visible(visible: bool) -> None
Check or uncheck the visibility indicator of the LUT.
Usually corresponds to a checkbox.
Source code in ndv/views/bases/_lut_view.py
41 42 43 44 45 46 |
|
set_clims abstractmethod
#
Set the (low, high) contrast limits to clims
.
Usually this will be a range slider or two text boxes.
Source code in ndv/views/bases/_lut_view.py
34 35 36 37 38 39 |
|
set_colormap abstractmethod
#
set_colormap(cmap: Colormap) -> None
Set the colormap to cmap
.
Usually corresponds to a dropdown menu.
Source code in ndv/views/bases/_lut_view.py
27 28 29 30 31 32 |
|
Mouseable #
Mixin class for objects that can be interacted with using the mouse.
The signals here are to be emitted by the view object that inherits this class; usually by intercepting native mouse events with filter_mouse_events
.
The methods allow the object to handle its own mouse events before emitting the signals. If the method returns True
, the event is considered handled and should not be passed to the next receiver in the chain.
Viewable #
Bases: ABC
ABC representing anything that can be viewed on screen.
For example, a widget, a window, a frame, canvas, etc.
Methods:
-
close
–Close the view/widget.
-
frontend_widget
–Return the native object backing the viewable objects.
-
set_visible
–Sets the visibility of the view/widget itself.
close abstractmethod
#
close() -> None
Close the view/widget.
Source code in ndv/views/bases/_view_base.py
19 20 21 |
|