ImageLayerState#
- class glue.viewers.image.state.ImageLayerState(layer=None, viewer_state=None, **kwargs)#
Bases:
BaseImageLayerState,StretchStateMixinA state class that includes all the attributes for data layers in an image plot.
Attributes Summary
The transparency used to display the data
The attribute shown in the layer
The units to use to define the levels
A constant value that is added to the layer before rendering
The colormap used to render the layer
Length four tuple of RGBA values to set as the "bad" color and alpha for cmap.
The color used to display the data
The contrast of the layer
Whether the color and transparency should be synced with the global color and transparency for the data
The percentile value used to automatically calculate levels; "Custom" for manually set levels
The stretch used to render the layer, which should be one of
linear,sqrt,log, orarcsinhCalculate automatic levels for rendering stretch from the full data cube or only the current layer (slice)
Keyword arguments to pass to the stretch
The upper level shown
The lower level shown
Whether the layer is currently visible
A value used to indicate which layers are shown in front of which (larger zorder values are on top of other layers)
Methods Summary
add_callback(name, callback[, echo_old, ...])Add a callback that gets triggered when a callback property of the class changes.
add_global_callback(callback)Add a global callback function, which is a callback that gets triggered when any callback properties on the class change.
as_dict()Return the current state as a dictionary of attribute/value pairs.
Return a list of all callback property names.
Remove all global and property-specific callbacks.
Flip the image levels.
get_sliced_data([view, bounds])get_sliced_data_shape([view])is_alias(name)Whether a property (identified by name) is a callback property alias.
is_callback_property(name)Whether a property (identified by name) is a callback property.
Iterator to loop over all callback properties.
remove_callback(name, callback)Remove a previously-added callback
remove_global_callback(callback)Remove a global callback function.
update_from_dict(properties)Update this state using the values from a dictionary of attributes.
update_from_state(state)Update this state using the values from another state.
Attributes Documentation
- alpha#
The transparency used to display the data
- attribute#
The attribute shown in the layer
- attribute_display_unit#
The units to use to define the levels
- bias#
A constant value that is added to the layer before rendering
- cmap#
The colormap used to render the layer
- cmap_bad#
Length four tuple of RGBA values to set as the “bad” color and alpha for cmap.
- color#
The color used to display the data
- contrast#
The contrast of the layer
- global_sync#
Whether the color and transparency should be synced with the global color and transparency for the data
- percentile#
The percentile value used to automatically calculate levels; “Custom” for manually set levels
- stretch#
The stretch used to render the layer, which should be one of
linear,sqrt,log, orarcsinh
- stretch_global#
Calculate automatic levels for rendering stretch from the full data cube or only the current layer (slice)
- stretch_object#
- stretch_parameters#
Keyword arguments to pass to the stretch
- v_max#
The upper level shown
- v_min#
The lower level shown
- visible#
Whether the layer is currently visible
- zorder#
A value used to indicate which layers are shown in front of which (larger zorder values are on top of other layers)
Methods Documentation
- add_callback(name, callback, echo_old=False, priority=0, validator=False)#
Add a callback that gets triggered when a callback property of the class changes.
- Parameters:
- namestr
The instance to add the callback to.
- callbackfunc
The callback function to add
- echo_oldbool, optional
If True, the callback function will be invoked with both the old and new values of the property, as
callback(old, new). If False (the default), will be invoked ascallback(new)- priorityint, optional
This can optionally be used to force a certain order of execution of callbacks (larger values indicate a higher priority).
- validatorbool, optional
Whether the callback is a validator, which is a special kind of callback that gets called before the property is set. The validator can return a modified value (for example it can be used to change the types of values or change properties in-place) or it can also raise an exception.
- add_global_callback(callback)#
Add a global callback function, which is a callback that gets triggered when any callback properties on the class change.
- Parameters:
- callbackfunc
The callback function to add
- as_dict()#
Return the current state as a dictionary of attribute/value pairs.
- callback_properties()#
Return a list of all callback property names.
Note: This does not include CallbackPropertyAlias instances, only actual CallbackProperty instances.
- clear_callbacks()#
Remove all global and property-specific callbacks.
- flip_limits()#
Flip the image levels.
- get_sliced_data(view=None, bounds=None)#
- get_sliced_data_shape(view=None)#
- is_alias(name)#
Whether a property (identified by name) is a callback property alias.
- Parameters:
- namestr
The name of the property to check
- is_callback_property(name)#
Whether a property (identified by name) is a callback property.
Returns True for both CallbackProperty and CallbackPropertyAlias.
- Parameters:
- namestr
The name of the property to check
- iter_callback_properties()#
Iterator to loop over all callback properties.
Note: This does not include CallbackPropertyAlias instances, only actual CallbackProperty instances.
- remove_callback(name, callback)#
Remove a previously-added callback
- Parameters:
- namestr
The instance to remove the callback from.
- funcfunc
The callback function to remove
- remove_global_callback(callback)#
Remove a global callback function.
- Parameters:
- callbackfunc
The callback function to remove
- reset_cmap_bad()#
- reset_contrast_bias()#
- setup_stretch_callback()#
- update_from_dict(properties)#
Update this state using the values from a dictionary of attributes.
- Parameters:
- propertiesdict
The dictionary containing attribute/value pairs.
- update_from_state(state)#
Update this state using the values from another state.
- Parameters:
- state~glue.core.state_objects.State
The state to use the values from