Channel
- class ginga.rv.Channel.Channel(name, fv, settings, datasrc=None)[source]
Bases:
Callbacks
Class to manage a channel.
- Parameters:
- namestr
Name of the channel.
- fv
GingaShell
The reference viewer shell. This is the central control object for the Ginga Reference Viewer.
- settings
SettingGroup
Channel settings.
- datasrc
Datasrc
Data cache.
Methods Summary
add_history
(imname, path[, idx, ...])Add metadata about a data object to this channel.
add_image
(image[, silent, bulk_add])Add a data object to this channel.
add_image_info
(info)Add a data object's metadata to this channel.
add_image_update
(image, info[, update_viewer])Update metadata about a data object in this channel.
connect_viewer
(viewer)Add a viewer to the set of viewers for this channel.
copy_image_to
(imname, channel[, silent])Copy a data object named
imname
from this channel to another channel.Return the data object being viewed in this channel.
get_image_info
(imname)Return metadata about a data object in this channel.
Return the list of data items in this channel.
get_image_profile
(image)Get the image profile for data object
image
.get_loaded_image
(imname)Get an data object from this channel's memory cache.
get_viewer
(vname)Return the channel viewer with the specified name.
move_image_to
(imname, channel)Move a data object named
imname
from this channel to another channel.next_image
([loop])Move the channel cursor to the next data object in this channel.
open_with_viewer
(vinfo, dataobj)prev_image
([loop])Move the channel cursor to the previous data object in this channel.
Refresh the channel viewer to the current item pointed to by the channel cursor.
remove_history
(imname)Remove metadata about a data object in this channel.
remove_image
(imname)Remove a data object named
imname
from this channel.switch_image
(image)Switch to data object (
image
) in this channel.switch_name
(imname)Switch to data object named by
imname
in this channel.update_image_info
(image, info)Update metadata about a data object in this channel.
view_object
(dataobj)View the data object (
dataobj
) in an appropriate channel viewer.Methods Documentation
- add_history(imname, path, idx=None, image_loader=None, image_future=None, nothumb=False)[source]
Add metadata about a data object to this channel.
See add_image_info() for use and additional information.
- Parameters:
- imnamestr
Unique name (to this channel) of a data object to be added.
- pathstr
Path to the data object in storage.
- idxint or str (optional, defaults to None)
An optional index into the file, indicating an HDU or logical subunit of the file to load.
- image_loaderfunction (optional, defaults to None)
An optional loader for this data item. If
None
is passed, then defaults to the default loader.- image_future
Future
(optional, default: None) An optional image future used to reload the image if it is unloaded from memory. If
None
is passed, then defaults to a future using the default loader.- nothumbbool (optional, default: False)
True if no thumbnail should be generated for this object.
- Returns:
- info
Bunch
A record of the metadata about the data object.
- info
- add_image(image, silent=False, bulk_add=False)[source]
Add a data object to this channel.
- Parameters:
- imagesubclass of
ViewerObjectBase
Data object to be added.
- silentbool (optional, defaults to
False
) Indicates a “silent add”, in which case the callback is suppressed.
- bulk_addbool (optional, defaults to
False
) Indicates a “bulk add”, in which the callback is not suppressed, but the channel viewer will not be updated.
- imagesubclass of
- add_image_info(info)[source]
Add a data object’s metadata to this channel.
This function is used to add enough metadata about a data object to the channel so that the object can be later loaded and viewed from the channel on demand. To do so, the bunch passed as
info
should include as a minimum:name: name of object
path: file path to object
Optionally, an image loader or image future can be specified. If ommitted, the default loader is used and a future is created using that loader.
- Parameters:
- info
Bunch
Metadata about a data object to be added.
- info
- add_image_update(image, info, update_viewer=False)[source]
Update metadata about a data object in this channel.
- copy_image_to(imname, channel, silent=False)[source]
Copy a data object named
imname
from this channel to another channel.- Parameters:
- imnamestr
Name of the data in this channel (names are unique per-channel)
- channel
Channel
Channel to which we will copy the data
- get_current_image()[source]
Return the data object being viewed in this channel.
- Returns:
- imagesubclass of
ViewerObjectBase
Data object.
- imagesubclass of
- get_image_info(imname)[source]
Return metadata about a data object in this channel.
- Parameters:
- imnamestr
Name of the data in this channel (names are unique per-channel)
- Returns:
- info
Bunch
Metadata about a data object to be added.
- info
- get_image_profile(image)[source]
Get the image profile for data object
image
.The image profile is not an ICC profile, but rather a set of settings that the image was last viewed with. The settings can be saved and restored when an image is viewed according to the channel preferences under Reset (Viewer) and Rememeber (Image).
- get_loaded_image(imname)[source]
Get an data object from this channel’s memory cache.
- Parameters:
- imnamestr
Key, usually image name and extension.
- Returns:
- imagesubclass of
ViewerObjectBase
Data object.
- imagesubclass of
- Raises:
- KeyError
If the named data item is not in the memory cache.
- get_viewer(vname)[source]
Return the channel viewer with the specified name.
- Parameters:
- vnamestr
Name of the type of viewer.
- Returns:
- viewera ginga channel viewer of the specified type
- move_image_to(imname, channel)[source]
Move a data object named
imname
from this channel to another channel.- Parameters:
- imnamestr
Name of the data in this channel (names are unique per-channel)
- channel
Channel
Channel to which we will move the data
- refresh_cursor_image()[source]
Refresh the channel viewer to the current item pointed to by the channel cursor.
Mostly internal routine used when the channel cursor is changed.
- remove_history(imname)[source]
Remove metadata about a data object in this channel.
- Parameters:
- imnamestr
Unique name (to this channel) of a data object.
- remove_image(imname)[source]
Remove a data object named
imname
from this channel.- Parameters:
- imnamestr
Name of the data in this channel (names are unique per-channel)
- switch_image(image)[source]
Switch to data object (
image
) in this channel.- Parameters:
- imagesubclass of
ViewerObjectBase
Data object in this channel to be viewed in an appropriate channel viewer.
- imagesubclass of
- switch_name(imname)[source]
Switch to data object named by
imname
in this channel.- Parameters:
- imnamestr
Unique name of a data object in this channel.