ndv.controllers #
Controllers are the primary public interfaces that wrap models & views.
Classes:
-
ArrayViewer–Viewer dedicated to displaying a single n-dimensional array.
-
ImageStats–Result of computing image statistics.
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 view 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.
-
refresh_stats–Force re-emit stats for all channels with existing data.
-
show–Show the viewer.
-
widget–Return the native front-end widget.
Attributes:
-
data(Any) –Return data being displayed (the actual data, not the wrapper).
-
data_wrapper(Any) –Return the data wrapper object being used to interface with the data.
-
display_model(ArrayDisplayModel) –Return the current ArrayDisplayModel.
-
roi(RectangularROIModel | None) –Return ROI being displayed.
Source code in src/ndv/controllers/_array_viewer.py
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 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
data_wrapper property #
data_wrapper: Any
Return the data wrapper object being used to interface with the data.
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
246 247 248 249 250 251 252 253 | |
close #
close() -> None
Close the viewer.
Source code in src/ndv/controllers/_array_viewer.py
241 242 243 244 | |
hide #
hide() -> None
Hide the viewer.
Source code in src/ndv/controllers/_array_viewer.py
237 238 239 | |
refresh_stats #
refresh_stats() -> None
Force re-emit stats for all channels with existing data.
This will mostly be used by external listeners that want the initial data, before any interaction has occurred.
Source code in src/ndv/controllers/_array_viewer.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | |
show #
show() -> None
Show the viewer.
Source code in src/ndv/controllers/_array_viewer.py
233 234 235 | |
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
160 161 162 163 164 165 166 167 168 169 170 171 | |