ptypy.core.classes.View#
- class ptypy.core.classes.View(container, ID=None, accessrule=None, **kwargs)#
Bases:
BaseA ‘window’ on a Container.
A view stores all the slicing information to extract a 2D piece of Container.
Note
The final structure of this class is yet up to debate and the constructor signature may change. Especially since ‘DEFAULT_ACCESSRULE’ is yet so small, its contents could be incorporated in the constructor call.
- __init__(container, ID=None, accessrule=None, **kwargs)#
- Parameters:
container (Container) – The Container instance this view applies to.
ID (str or int) – ID for this view. Automatically built from ID if None.
accessrule (dict) – All the information necessary to access the wanted slice. Maybe subject to change as code evolve. See keyword arguments Almost all keys of accessrule will be available as attributes in the constructed View instance.
- Keyword Arguments:
storageID (str) – ID of storage, If the Storage does not exist it will be created! (default is
None)shape (int or tuple of int) – Shape of the view in pixels (default is
None)coord (2-tuple of float,) – Physical coordinates (meter) of the center of the view.
psize (float or tuple of float) – Pixel size in (meter) . Required for storage initialization.
layer (int) – Index of the third dimension if applicable. (default is
0)active (bool) – Whether this view is active (default is
True)
Methods
__init__(container[, ID, accessrule])calc_mem_usage()copy([ID, update])Attributes
IDnumIDownerThe
Storageinstance that this view applies to by default.The storage ID that this view will be forward to if applied to a
Container.errorDEFAULT_ACCESSRULEActive state.
The View's physical coordinate (meters)
The view content in data buffer of associated storage.
Center coordinate (index) in data buffer.
High side of the View's data range.
The "layer" i.e. first axis index in Storage data buffer.
Low side of the View's data range.
layerndimThe physical coordinate in pixel space
Returns first
PODin theself.podsdict.Returns all
PODs still connected to this view as a dict.Pixel size of the View.
Two dimensional shape of View.
Returns a slice-tuple according to
self.layer,self.dlowandself.dhigh.The subpixel difference (meters) between physical coordinate and data coordinate.
- property active#
Active state. If False this view will be ignored when resizing the data buffer of the associated
Storage.
- property coord#
The View’s physical coordinate (meters)
- property data#
The view content in data buffer of associated storage.
- property dcoord#
Center coordinate (index) in data buffer.
- property dhigh#
High side of the View’s data range.
- property dlayer#
The “layer” i.e. first axis index in Storage data buffer
- property dlow#
Low side of the View’s data range.
- property pcoord#
The physical coordinate in pixel space
- property pod#
Returns first
PODin theself.podsdict. This is a common call in the code and has therefore found its way here. May returnNoneif there is no pod connected.
- property psize#
Pixel size of the View.
- property shape#
Two dimensional shape of View.
- property slice#
Returns a slice-tuple according to
self.layer,self.dlowandself.dhigh. Please note, that this may not always makes sense
- property sp#
The subpixel difference (meters) between physical coordinate and data coordinate.