ImageConfigHelper#
- class jdaviz.core.helpers.ImageConfigHelper(*args, **kwargs)[source]#
Bases:
ConfigHelper
ConfigHelper
that uses an image viewer as its primary viewer. For example, Imviz and Cubeviz.Attributes Summary
Default viewer instance.
Methods Summary
load_regions
(regions[, max_num_regions, ...])Load given region(s) into the viewer.
load_regions_from_file
(region_file[, ...])Load regions defined in the given file.
Attributes Documentation
- default_viewer#
Default viewer instance. This is typically the first viewer (e.g., “imviz-0” or “cubeviz-0”).
Methods Documentation
- get_interactive_regions()[source]#
Deprecated since version 4.1: The get_interactive_regions function is deprecated and may be removed in a future version. Use subset_tools.get_regions instead.
Return spatial regions that can be interacted with in the viewer. This does not return masked regions added via
load_regions()
.Unsupported region shapes will be skipped. When that happens, a yellow snackbar message will appear on display.
- Returns:
- regionsdict
Dictionary mapping interactive region names to respective Astropy
regions
objects.
- load_regions(regions, max_num_regions=None, refdata_label=None, return_bad_regions=False, **kwargs)[source]#
Load given region(s) into the viewer. WCS-to-pixel translation and mask creation, if needed, is relative to the image defined by
refdata_label
. Meanwhile, the rest of the Subset operations are based on reference image as defined by Glue.Note
Loading too many regions will affect performance.
A valid region can be loaded into one of the following categories:
An interactive Subset, as if it was drawn by hand. This is always done for supported shapes. Its label will be
'Subset N'
, whereN
is an integer.A masked Subset that will display on the image but cannot be modified once loaded. This is done if the shape cannot be made interactive. Its label will be
'MaskedSubset N'
, whereN
is an integer.
- Parameters:
- regionslist of obj
A list of region objects. A region object can be one of the following:
Astropy
regions
objectphotutils
apertures (limited support untilphotutils
fully supportsregions
)
- max_num_regionsint or
None
Maximum number of regions to load, starting from top of the list. Default is to load everything.
- refdata_labelstr or
None
Label of data to use for sky-to-pixel conversion for a region, or mask creation. Data must already be loaded into Jdaviz. If
None
, defaults to the reference data in the default viewer. Choice of this data is particularly important when sky region is involved.- return_bad_regionsbool
If
True
, return the regions that failed to load (seebad_regions
); This is useful for debugging. IfFalse
, do not return anything (None
).- kwargsdict
Extra keywords to be passed into the region’s
to_mask
method. This is ignored if the region can be made interactive.
- Returns:
- load_regions_from_file(region_file, region_format='ds9', max_num_regions=20, **kwargs)[source]#
Load regions defined in the given file. See Reading/Writing Region Files for supported file formats. See
load_regions()
for how regions are loaded.- Parameters:
- region_filestr
Path to region file.
- region_format{‘crtf’, ‘ds9’, ‘fits’}
- max_num_regionsint or
None
Maximum number of regions to read from the file, starting from top of the file. Default is first 20 regions that can be successfully loaded. If
None
, it will load everything.- kwargsdict
See
load_regions()
.
- Returns:
- bad_regionslist of (obj, str) or
None
See
load_regions()
.
- bad_regionslist of (obj, str) or