Last modified: December 2013

URL: https://cxc.cfa.harvard.edu/chips/ahelp/get_image.html
AHELP for CIAO 4.11 ChIPS v1

get_image

Context: images

Synopsis

Retrieves the attribute value(s) of the image.

Syntax

get_image()
get_image(id)
get_image(id, attribute)

Description

The function arguments.

Argument Description
id A ChipsId structure identifying the item, or a string containing the name of the object.
attribute The name of the attribute to retrieve, such as 'threshold' or 'colormap'.

The get_image command returns a structure containing all the attribute values of the image. To retrieve the value of a specific attribute, provide the attribute name and the id or ChipsId of the object.

Some values are set to "None" in the returned structure. These entries generally correspond to attributes which may only be modified at creation time, such as the object id.

Please see the "Image Preferences and Attributes" section below the examples for a list of the image preferences.

Data Range

The get_image_range command returns the X and Y ranges of the current image. The values are returned as [xmin, xmax, ymin, ymax]. There are also individual commands for retrieving just the x and y range: get_image_xrange and get_image_yrange.

To see if a image is hidden or visible, use the get_image_visible command.

Advanced Functions

The module of advanced ChIPS functions contains other commands for retrieving attribute values (refer to "ahelp chips" for information on loading the module):

get_image_alpha
get_image_colormap
get_image_colormap_interpolated
get_image_colormap_size
get_image_depth
get_image_interpolation
get_image_invert_colormap
get_image_range
get_image_scale_channels
get_image_threshold
get_image_visible
get_image_xrange
get_image_yrange


Examples

Example 1

chips> add_image("img.fits")
chips> get_image()

A image is created and becomes current. Calling get_image with no argument returns all the attributes of the object with the following output:

alpha = [1.0, 1.0]
colormap = 3
colormap_interpolate = True
colormap_size = 256
depth = 100
id = None
interpolation = 0
invert_colormap = False
scale_channels = True
stem = None
threshold = [0.0, 29.0]

The remaining calls show how get_image can be used to access individual attributes of the image. Similarly, a get_image().attribute call accesses the individual attribute of the image.

Example 2

chips> add_image('img.fits')
chips> add_image('img2.fits')
chips> get_image('image1')

Two images are created. get_image is called with the id of the first image, returning all attributes.

Example 3

chips> add_image('img.fits')
chips> get_image_colormap()
chips> get_image().colormap

An image is created and the 'colormap' attribute is accessed using get_image_colormap, and equivalently get_image().colormap.

Example 4

chips> imgatt = get_image()
chips> print(imgatt)

Retrieve a structure containing the attribute values of the current image and store the results in "imgatt". Print the contents of "imgatt".


Image Preferences and Attributes

The attributes associated with images are given in the following table, where the "Set?" column refers to whether the attribute can be changed using the set_image() command. To change the image preference settings prepend "image." to the attribute name.

Attribute Description Options Default Set?
alpha A two-element array of the minimum and maximum values to use for the alpha channel. The values are normalized to the data range, so should be in the range 0 to 1, inclusive. A setting of [1,1] is fully opaque whereas [0.5,0.5] makes every pixel 50 per cent transparent, and [0,1] makes the minimum value fully transparent and the maximum value fully opaque. [-1, -1] Yes
colormap the color map used to display the image red|green|blue|grayscale| rainbow|hsv|heat|cool| usercmap1|usercmap2|usercmap3; see the colormap section of "ahelp chipsopt" grayscale Yes
colormap_interpolate should the colormap be interpolated over the size of the colormap see the Booleans section of "ahelp chipsopt" true Yes
colormap_size number of entries to use from the color map 256 Yes
depth Value indicating the depth of the image see the Depth section of "ahelp chipsopt" default Yes
interpolation the interpolation method used to display the image pixels neighbor|bilinear|bicubic neighbor Yes
invert_colormap should the colormap be inverted? see the Booleans section of "ahelp chipsopt" false Yes
scale_channels when displaying true-color images, should each channel (other than alpha) be normalized to its own range (true) or the range of all the channels (false). see the Booleans section of "ahelp chipsopt" true Yes
stem stem to use for image ids An alpha-numeric character sequence that does not contain a space image No
threshold A two-element array of the minimum and maximum values to use for thresholding the image. The values are normalized to the data range, so should be in the range 0 to 1, inclusive. A setting of [0,1] means use the whole pixel range whilst [0.05,0.95] would only use the central 90% of the pixel range. [-1, -1] Yes
wcs The name of the coordinate system to use "logical", "physical", "world". You can also use the names of the transforms, such as "sky" and "EQPOS". "world", if available and supported (WCS-TAN). No

Bugs

See the bugs pages on the ChIPS website for an up-to-date listing of known bugs.

See Also

concepts
setget
contrib
chips_helix, imextent
images
add_image, current_image, delete_image, display_image, hide_image, load_colormap, print_image, remove_image_channel, set_image, shuffle_image
utilities
set_current