ndv.controllers #
Controllers are the primary public interfaces that wrap models & views.
Classes:
-
ArrayViewer
–Viewer dedicated to displaying a single n-dimensional array.
ArrayViewer #
ArrayViewer(
data: Any | DataWrapper = None,
/,
display_model: ArrayDisplayModel | None = None,
**kwargs: Unpack[ArrayDisplayModelKwargs],
)
Viewer dedicated to displaying a single n-dimensional array.
This wraps a model and sview into a single object, and defines the public API.
See also
ndv.imshow
- a convenience function that constructs and shows an ArrayViewer
.
Future plans
In the future, ndv
would like to support multiple, layered data sources with coordinate transforms. We reserve the name Viewer
for a more fully featured viewer. ArrayViewer
assumes you're viewing a single array.
Parameters:
-
data
#DataWrapper | Any
, default:None
) –Data to be displayed.
-
display_model
#ArrayDisplayModel
, default:None
) –Just the display model to use. If provided,
data_or_model
must be an array orDataWrapper
... and kwargs will be ignored. -
**kwargs
#Unpack[ArrayDisplayModelKwargs]
, default:{}
) –Keyword arguments to pass to the
ArrayDisplayModel
constructor. Ifdisplay_model
is provided, these will be ignored.
Methods:
-
clone
–Return a new ArrayViewer instance with the same data and display model.
-
close
–Close the viewer.
-
hide
–Hide the viewer.
-
show
–Show the viewer.
-
widget
–Return the native front-end widget.
Attributes:
-
data
(Any
) –Return data being displayed.
-
data_wrapper
(Any
) –Return data being displayed.
-
display_model
(ArrayDisplayModel
) –Return the current ArrayDisplayModel.
-
roi
(RectangularROIModel | None
) –Return ROI being displayed.
Source code in src/ndv/controllers/_array_viewer.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|
display_model property
writable
#
display_model: ArrayDisplayModel
Return the current ArrayDisplayModel.
clone #
clone() -> ArrayViewer
Return a new ArrayViewer instance with the same data and display model.
Currently, this is a shallow copy. Modifying one viewer will affect the state of the other.
Source code in src/ndv/controllers/_array_viewer.py
212 213 214 215 216 217 218 219 220 221 |
|
close #
close() -> None
Close the viewer.
Source code in src/ndv/controllers/_array_viewer.py
208 209 210 |
|
hide #
hide() -> None
Hide the viewer.
Source code in src/ndv/controllers/_array_viewer.py
204 205 206 |
|
show #
show() -> None
Show the viewer.
Source code in src/ndv/controllers/_array_viewer.py
200 201 202 |
|
widget #
widget() -> Any
Return the native front-end widget.
Warning
If you directly manipulate the frontend widget, you're on your own . No guarantees can be made about synchronization with the model. It is exposed for embedding in an application, and for experimentation and custom use cases. Please open an issue if you have questions.
Source code in src/ndv/controllers/_array_viewer.py
129 130 131 132 133 134 135 136 137 138 139 140 |
|