ImageViewerState

class glue.viewers.image.state.ImageViewerState(**kwargs)[source]

Bases: glue.viewers.matplotlib.state.MatplotlibDataViewerState

A state class that includes all the attributes for an image viewer.

Attributes Summary

aspect

Whether to enforce square pixels (equal) or fill the axes (auto)

color_mode

Whether each layer can have its own colormap (Colormaps) or whether each layer is assigned a single color (One color per layer)

dpi

The resolution (in dots per inch) of density maps, if present

layers

A collection of all layers in the viewer

layers_data

numpy_slice_aggregation_transpose

Returns slicing information usable by Numpy.

reference_data

The dataset that is used to define the available pixel/world components, and which defines the coordinate frame in which the images are shown

show_axes

Whether the axes are shown

slices

The current slice along all dimensions

wcsaxes_slice

Returns slicing information usable by WCSAxes.

x_att

The component ID giving the pixel component shown on the x axis

x_att_world

The component ID giving the world component shown on the x axis

x_axislabel

Label for the x-axis

x_axislabel_size

Size of the x-axis label

x_axislabel_weight

Weight of the x-axis label

x_log

Whether the x axis is logarithmic

x_max

Upper limit of the visible x range

x_min

Lower limit of the visible x range

x_ticklabel_size

Size of the x-axis tick labels

y_att

The component ID giving the pixel component shown on the y axis

y_att_world

The component ID giving the world component shown on the y axis

y_axislabel

Label for the y-axis

y_axislabel_size

Size of the y-axis label

y_axislabel_weight

Weight of the y-axis label

y_log

Whether the y axis is logarithmic

y_max

Upper limit of the visible y range

y_min

Lower limit of the visible y range

y_ticklabel_size

Size of the y-axis tick labels

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_x(self)

Flip the x_min/x_max limits.

flip_y(self)

Flip the y_min/y_max limits.

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_limits(self)

update_axes_settings_from(self, state)

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

aspect

Whether to enforce square pixels (equal) or fill the axes (auto)

color_mode

Whether each layer can have its own colormap (Colormaps) or whether each layer is assigned a single color (One color per layer)

dpi

The resolution (in dots per inch) of density maps, if present

layers

A collection of all layers in the viewer

layers_data
numpy_slice_aggregation_transpose

Returns slicing information usable by Numpy.

This returns two objects: the first is an object that can be used to slice Numpy arrays and return a 2D array, and the second object is a boolean indicating whether to transpose the result.

reference_data

The dataset that is used to define the available pixel/world components, and which defines the coordinate frame in which the images are shown

show_axes

Whether the axes are shown

slices

The current slice along all dimensions

wcsaxes_slice

Returns slicing information usable by WCSAxes.

This returns an iterable of slices, and including 'x' and 'y' for the dimensions along which we are not slicing.

x_att

The component ID giving the pixel component shown on the x axis

x_att_world

The component ID giving the world component shown on the x axis

x_axislabel

Label for the x-axis

x_axislabel_size

Size of the x-axis label

x_axislabel_weight

Weight of the x-axis label

x_log

Whether the x axis is logarithmic

x_max

Upper limit of the visible x range

x_min

Lower limit of the visible x range

x_ticklabel_size

Size of the x-axis tick labels

y_att

The component ID giving the pixel component shown on the y axis

y_att_world

The component ID giving the world component shown on the y axis

y_axislabel

Label for the y-axis

y_axislabel_size

Size of the y-axis label

y_axislabel_weight

Weight of the y-axis label

y_log

Whether the y axis is logarithmic

y_max

Upper limit of the visible y range

y_min

Lower limit of the visible y range

y_ticklabel_size

Size of the y-axis tick labels

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_x(self)[source]

Flip the x_min/x_max limits.

flip_y(self)[source]

Flip the y_min/y_max limits.

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_limits(self)[source]
update_axes_settings_from(self, state)
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