This module defines a widget designed to display data using to most adapted view from available ones from silx.
Widget to display any kind of data
The method setData() allows to set any data to the widget. Mostly numpy.array and h5py.Dataset are supported with adapted views. Other data types are displayed using a text viewer.
A default view is automatically selected when a data is set. The method setDisplayMode() allows to change the view. To have a graphical tool to select the view, prefer using the widget DataViewerFrame.
The dimension of the input data and the expected dimension of the selected view can differ. For example you can display an image (2D) from 4D data. In this case a NumpyAxesSelector is displayed to allow the user to select the axis mapping and the slicing of other axes.
import numpy
data = numpy.random.rand(500,500)
viewer = DataViewer()
viewer.setData(data)
viewer.setVisible(True)
Emitted when the displayed view changes
Emitted when the data changes
Emitted when the current available views (which support the current data) change
Create and returns available views which can be displayed by default by the data viewer. It is called internally by the widget. It can be overwriten to provide a different set of viewers.
Parameters: | parent (QWidget) – QWidget parent of the views |
---|---|
Return type: | list[silx.gui.data.DataViews.DataView] |
Returns a normalized data if the embed a numpy or a dataset. Else returns the data.
Set the displayed view.
Change the displayed view according to the view itself.
Parameters: | view (silx.gui.data.DataViews.DataView) – The DataView to use to display the data |
---|
Returns the first available view which have the requested modeId.
Parameters: | modeId (int) – Requested mode id |
---|---|
Return type: | silx.gui.data.DataViews.DataView |
Set the displayed view using display mode.
Change the displayed view according to the requested mode.
Parameters: | modeId (int) – Display mode, one of
|
---|
Returns the current displayed view.
Return type: | silx.gui.data.DataViews.DataView |
---|
Allow to add a view to the dataview.
If the current data support this view, it will be displayed.
Parameters: | view (DataView) – A dataview |
---|
Allow to remove a view which was available from the dataview.
If the view was displayed, the widget will be updated.
Parameters: | view (DataView) – A dataview |
---|
Returns a view which is sure to display something without failing on rendering.
Parameters: |
|
---|---|
Return type: | DataView |
Returns the default view which will be used according to available views.
Parameters: |
|
---|---|
Return type: | DataView |
Returns the list of available views for the current data
Return type: | List[DataView] |
---|