Skip to content

Commit

Permalink
Merge pull request #32 from javerbukh/add_ellipse_roi
Browse files Browse the repository at this point in the history
Add support for elliptical ROI
  • Loading branch information
eteq authored Jul 2, 2021
2 parents 930fd84 + 5376944 commit 40aae09
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions glue_astronomy/translators/regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
from glue.core.subset import RoiSubsetState, RangeSubsetState, OrState, AndState,\
XorState, MultiOrState, Subset, MultiRangeSubsetState
from glue.core.roi import RectangularROI, PolygonalROI, CircularROI, PointROI,\
RangeROI, AbstractMplRoi
RangeROI, AbstractMplRoi, EllipticalROI
from glue.viewers.image.pixel_selection_subset_state import PixelSubsetState

from regions import RectanglePixelRegion, PolygonPixelRegion, CirclePixelRegion,\
PointPixelRegion, PixCoord
PointPixelRegion, PixCoord, EllipsePixelRegion


def range_to_rect(data, ori, low, high):
Expand Down Expand Up @@ -57,7 +57,6 @@ def to_object(self, subset):
subset : `glue.core.subset.Subset`
The subset to convert to a Region object
"""

data = subset.data

if data.pixel_component_ids[0].axis == 0:
Expand All @@ -82,6 +81,8 @@ def to_object(self, subset):
return PolygonPixelRegion(PixCoord(roi.vx, roi.vy))
elif isinstance(roi, CircularROI):
return CirclePixelRegion(PixCoord(*roi.get_center()), roi.get_radius())
elif isinstance(roi, EllipticalROI):
return EllipsePixelRegion(PixCoord(roi.xc, roi.yc), roi.radius_x, roi.radius_y)
elif isinstance(roi, PointROI):
return PointPixelRegion(PixCoord(*roi.center()))
elif isinstance(roi, RangeROI):
Expand Down

0 comments on commit 40aae09

Please sign in to comment.