ImageLayerState

class glue.viewers.image.state.ImageLayerState(layer=None, viewer_state=None, **kwargs)[source]

Bases: glue.viewers.image.state.BaseImageLayerState

A state class that includes all the attributes for data layers in an image plot.

Attributes Summary

alpha

The transparency used to display the data

attribute

The attribute shown in the layer

bias

A constant value that is added to the layer before rendering

cmap

The colormap used to render the layer

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

layer

The Data or Subset represented by the layer

percentile

The percentile value used to automatically calculate levels

stretch

The stretch used to render the layer, which should be one of linear, sqrt, log, or arcsinh

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 Summary

add_callback(self, name, callback[, …])

Add a callback that gets triggered when a callback property of the class changes.

add_global_callback(self, callback)

Add a global callback function, which is a callback that gets triggered when any callback properties on the class change.

as_dict(self)

Return the current state as a dictionary of attribute/value pairs.

callback_properties(self)

clear_callbacks(self)

Remove all global and property-specific callbacks.

flip_limits(self)

Flip the image levels.

get_sliced_data(self[, view])

get_sliced_data_shape(self[, view])

is_callback_property(self, name)

Whether a property (identified by name) is a callback property.

iter_callback_properties(self)

Iterator to loop over all callback properties.

remove_callback(self, name, callback)

Remove a previously-added callback

remove_global_callback(self, callback)

Remove a global callback function.

reset_cache(self, \*event)

reset_cache_from_slices(self, slice_before, …)

reset_contrast_bias(self)

update_from_dict(self, properties)

Update this state using the values from a dictionary of attributes.

update_from_state(self, 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

bias

A constant value that is added to the layer before rendering

cmap

The colormap used to render the layer

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

layer

The Data or Subset represented by the layer

percentile

The percentile value used to automatically calculate levels

stretch

The stretch used to render the layer, which should be one of linear, sqrt, log, or arcsinh

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(self, name, callback, echo_old=False, priority=0)

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 as callback(new)

priorityint, optional

This can optionally be used to force a certain order of execution of callbacks (larger values indicate a higher priority).

add_global_callback(self, 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(self)

Return the current state as a dictionary of attribute/value pairs.

callback_properties(self)
clear_callbacks(self)

Remove all global and property-specific callbacks.

flip_limits(self)[source]

Flip the image levels.

get_sliced_data(self, view=None)
get_sliced_data_shape(self, view=None)
is_callback_property(self, name)

Whether a property (identified by name) is a callback property.

Parameters
namestr

The name of the property to check

iter_callback_properties(self)

Iterator to loop over all callback properties.

remove_callback(self, 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(self, callback)

Remove a global callback function.

Parameters
callbackfunc

The callback function to remove

reset_cache(self, *event)
reset_cache_from_slices(self, slice_before, slice_after)
reset_contrast_bias(self)[source]
update_from_dict(self, properties)

Update this state using the values from a dictionary of attributes.

Parameters
propertiesdict

The dictionary containing attribute/value pairs.

update_from_state(self, state)

Update this state using the values from another state.

Parameters
state~glue.core.state_objects.State

The state to use the values from