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,
/,
*,
viewer_options: ArrayViewerModel
| ArrayViewerModelKwargs
| None = 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_modelmust be an array orDataWrapper... and kwargs will be ignored. -
(**kwargs#Unpack[ArrayDisplayModelKwargs], default:{}) –Keyword arguments to pass to the
ArrayDisplayModelconstructor. Ifdisplay_modelis 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
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 122 123 124 125 126 127 128 129 130 131 | |
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
229 230 231 232 233 234 235 236 237 238 | |
close #
close() -> None
Close the viewer.
Source code in src/ndv/controllers/_array_viewer.py
225 226 227 | |
hide #
hide() -> None
Hide the viewer.
Source code in src/ndv/controllers/_array_viewer.py
221 222 223 | |
show #
show() -> None
Show the viewer.
Source code in src/ndv/controllers/_array_viewer.py
217 218 219 | |
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
135 136 137 138 139 140 141 142 143 144 145 146 | |