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.
Source code in ndv/controllers/_array_viewer.py
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 |
|
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 ndv/controllers/_array_viewer.py
178 179 180 181 182 183 184 185 186 187 |
|
close #
close() -> None
Close the viewer.
Source code in ndv/controllers/_array_viewer.py
174 175 176 |
|
hide #
hide() -> None
Hide the viewer.
Source code in ndv/controllers/_array_viewer.py
170 171 172 |
|
show #
show() -> None
Show the viewer.
Source code in ndv/controllers/_array_viewer.py
166 167 168 |
|
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 ndv/controllers/_array_viewer.py
116 117 118 119 120 121 122 123 124 125 126 127 |
|