mask#
- class arte.types.mask.AnnularMask(frameShape, maskRadius=None, maskCenter=None, inRadius=0)#
Bases:
CircularMaskInheritance of CircularMask class to provide an annular mask
Added inRadius parameter, radius of central obstruction. Default inRadius values is 0 with AnnularMask converging to CircularMask
Methods
asTransmissionValue()Mask as a transmission mask: 1 for non-masked elements, 0 for masked elements.
center()Y, X coordinates of the mask center
fromMaskedArray(maskedArray)Creates a
CircularMaskroughly corresponding to the mask of a masked arraymask()Boolean mask of the mask
radius()Radius of the mask
shape()Array shape
as_masked_array
from_masked_array
inRadius
in_mask_indices
regionOfInterest
- static fromMaskedArray(maskedArray)#
Creates a
CircularMaskroughly corresponding to the mask of a masked arrayReturns a
CircularMaskobject having radius and center guessed from the passed mask usingImageMomentscentroid and semiAxes as default.Important note: the created
CircularMaskobject using “ImageMoments” is not guaranteed to have the same set of valid points of the passed mask, but it is included in the passed mask, i.e. all the valid points of the created mask are also valid points of the passed masked array. For the other methods this last property is not guaranteed.Other valid circle estimation methods are: - “RANSAC” : circle fitting using RANSAC algorithm on Canny edge detection - “COG” : circle fitting using Center of gravity of the mask - “correlation” : circle fitting using correlation of the mask with a disk template
- Parameters:
maskedArray (
MaskedArray) – a masked array with a circular maskmethod (string) – method for circle estimation. Default is “ImageMoments”
- Returns:
circular_mask – a circular mask included in the mask of
maskedArray- Return type:
- inRadius()#
- class arte.types.mask.BaseMask(mask_array)#
Bases:
objectMethods
as_masked_array
from_masked_array
- as_masked_array()#
- static from_masked_array(numpy_masked_array)#
- mask()#
Boolean mask of the mask
- Returns:
mask – mask of the pupil. Array is True outside the pupil, and False inside the pupil
- Return type:
boolean
array
- shape()#
Array shape
- Returns:
shape – shape of the mask array
- Return type:
list (2,)
- class arte.types.mask.CircularMask(frameShape, maskRadius=None, maskCenter=None)#
Bases:
BaseMaskRepresent a circular mask
A
arrayrepresenting a circular pupil. Frame shape, pupil radius and center can be specified.Use
maskmethod to access the mask as boolean mask (e.g. to be used in amasked_arrayobject) with False values where the frame is not masked (i.e. within the pupil) and True values outsideUse
asTransmissionValuemethod to acces the mask as transmission mask, i.e. 1 within the pupil and 0 outside. Fractional transmission for edge pixels is not implementedIf a
masked_arrayhaving a circular mask is available, the static methodfromMaskedArraycan be used to create aCircularMaskobject having the same shape of the masked array and the same pupil center and radius- Parameters:
frameShape (tuple (2,)) – shape of the returned array
maskRadius (real) – pupil radius in pixel
maskCenter (list (2,) or
array) – Y-X coordinates of the pupil center in pixel
Methods
Mask as a transmission mask: 1 for non-masked elements, 0 for masked elements.
center()Y, X coordinates of the mask center
fromMaskedArray(maskedArray[, method])Creates a
CircularMaskroughly corresponding to the mask of a masked arraymask()Boolean mask of the mask
radius()Radius of the mask
shape()Array shape
as_masked_array
from_masked_array
in_mask_indices
regionOfInterest
- FITTING_METHOD_CENTER_OF_GRAVITY = 'COG'#
- FITTING_METHOD_CORRELATION = 'correlation'#
- FITTING_METHOD_IMAGE_MOMENTS = 'ImageMoments'#
- FITTING_METHOD_RANSAC = 'RANSAC'#
- asTransmissionValue()#
Mask as a transmission mask: 1 for non-masked elements, 0 for masked elements.
- Returns:
transmission_value – transmission mask as a numpy array with dtype int
- Return type:
ndarray[int]
- center()#
Y, X coordinates of the mask center
- Returns:
center – Y, X coordinate of the mask center in the array reference system
- Return type:
arrayof shape (2,)
- static fromMaskedArray(maskedArray, method='ImageMoments', **keywords)#
Creates a
CircularMaskroughly corresponding to the mask of a masked arrayReturns a
CircularMaskobject having radius and center guessed from the passed mask usingImageMomentscentroid and semiAxes as default.Important note: the created
CircularMaskobject using “ImageMoments” is not guaranteed to have the same set of valid points of the passed mask, but it is included in the passed mask, i.e. all the valid points of the created mask are also valid points of the passed masked array. For the other methods this last property is not guaranteed.Other valid circle estimation methods are: - “RANSAC” : circle fitting using RANSAC algorithm on Canny edge detection - “COG” : circle fitting using Center of gravity of the mask - “correlation” : circle fitting using correlation of the mask with a disk template
- Parameters:
maskedArray (
MaskedArray) – a masked array with a circular maskmethod (string) – method for circle estimation. Default is “ImageMoments”
- Returns:
circular_mask – a circular mask included in the mask of
maskedArray- Return type:
- in_mask_indices()#
- radius()#
Radius of the mask
- Returns:
radius – mask radius in pixel
- Return type:
real
- regionOfInterest()#