|
lsst.afw
16.0-12-gf08c31002
|
Functions | |
| def | splitSliceArgs (sliceArgs) |
| def | handleNegativeIndex (index, size, origin, default) |
| def | makePointFromIndices (x, y, origin, bbox) |
| def | makeBoxFromSlices (x, y, origin, bbox) |
| def | interpretSliceArgs (sliceArgs, bboxGetter) |
| def | supportSlicing (cls) |
Variables | |
| Factory | |
| clone | |
| def lsst.afw.image.slicing.handleNegativeIndex | ( | index, | |
| size, | |||
| origin, | |||
| default | |||
| ) |
Handle negative indices passed to image accessors.
When negative indices are used in LOCAL coordinates, we interpret them as
relative to the upper bounds of the array, as in regular negative indexing
in Python.
Using negative indices in PARENT coordinates is not allowed unless passed
via a `Point2I` or `Box2I`; the potential for confusion between actual
negative indices (when ``xy0 < 0``) and offsets relative to the upper
bounds of the array is too great.
Parameters
----------
index : `int` or `None`
1-d pixel index to interpret, as given by a caller to an image-like
object's ``__getitem__`` or ``__setitem__``.
size : `int`
Size of the image in the dimension corresponding to ``index``.
origin : `ImageOrigin`
Enum value that sets whether or not to consider xy0 in positions.
default : `int`
Index to return if `index` is None.
Returns
-------
index : `int`
If ``origin==PARENT``, either the given ``index`` or ``default``.
If ``origin==LOCAL``, an equivalent index guaranteed to be nonnegative.
Intended primarily for internal use by `supportSlicing()`.
Definition at line 44 of file slicing.py.
| def lsst.afw.image.slicing.interpretSliceArgs | ( | sliceArgs, | |
| bboxGetter | |||
| ) |
Transform arguments to __getitem__ or __setitem__ to a standard form.
Parameters
----------
sliceArgs : `tuple`, `Box2I`, or `Point2I`
Slice arguments passed directly to `__getitem__` or `__setitem__`.
bboxGetter : callable
Callable that accepts an ImageOrigin enum value and returns the
appropriate image bounding box. Usually the bound getBBox method
of an Image, Mask, or MaskedImage object.
Returns
-------
box : `Box2I` or `None`
A box to use to create a subimage, or None if the slice refers to a
scalar.
index: `tuple` or `None`
An ``(x, y)`` tuple of integers, or None if the slice refers to a
box.
origin : `ImageOrigin`
Enum indicating whether to account for xy0.
Intended primarily for internal use by `supportSlicing()`.
Definition at line 153 of file slicing.py.
| def lsst.afw.image.slicing.makeBoxFromSlices | ( | x, | |
| y, | |||
| origin, | |||
| bbox | |||
| ) |
Transform a tuple of slice objects into a Box2I, correctly handling negative indices.
Parameters
----------
x : `slice`
Column index range. Step must be None.
y : `slice`
Row index range. Step must be None.
origin : `ImageOrigin`
Enum value that sets whether or not to consider xy0 in positions.
bbox : `Box2I`
Bounding box of the image being indexed, obtained using
``getBBox(origin)``.
Returns
-------
bbox : `Box2I`
A point corresponding to the given indices.
Intended primarily for internal use by `supportSlicing()`.
Definition at line 118 of file slicing.py.
| def lsst.afw.image.slicing.makePointFromIndices | ( | x, | |
| y, | |||
| origin, | |||
| bbox | |||
| ) |
Create a Point2I from an x, y pair, correctly handling negative indices.
Parameters
----------
x : `int`
Column index.
y : `int`
Row index.
origin : `ImageOrigin`
Enum value that sets whether or not to consider xy0 in positions.
bbox : `Box2I`
Bounding box of the image being indexed, obtained using
``getBBox(origin)``.
Returns
-------
point : `Point2I`
A point corresponding to the given indices.
Intended primarily for internal use by `supportSlicing()`.
Definition at line 90 of file slicing.py.
| def lsst.afw.image.slicing.splitSliceArgs | ( | sliceArgs | ) |
Separate the actual slice from origin arguments to __getitem__ or
__setitem__, using PARENT for the origin if it is not provided.
Parameter
---------
sliceArgs : `tuple`, `Box2I`, or `Point2I`
The first argument passed to an image-like object's
``__getitem__`` or ``__setitem__``.
Returns
-------
sliceArgs : `tuple`, `Box2I`, or `Point2I`
The original sliceArgs passed in, with any ImageOrigin argument
stripped off.
origin : `ImageOrigin`
Enum value that sets whether or not to consider xy0 in positions.
See interpretSliceArgs for more information.
Intended primarily for internal use by `supportSlicing()`.
Definition at line 7 of file slicing.py.
| def lsst.afw.image.slicing.supportSlicing | ( | cls | ) |
Support image slicing
Definition at line 201 of file slicing.py.
| lsst.afw.image.slicing.clone |
Definition at line 214 of file slicing.py.
| lsst.afw.image.slicing.Factory |
Definition at line 209 of file slicing.py.
1.8.13