Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Region of Interest Object #164

Open
wafels opened this issue Jun 27, 2012 · 17 comments
Open

Region of Interest Object #164

wafels opened this issue Jun 27, 2012 · 17 comments
Labels
Effort High Requires a large time investment Feature Request New feature wanted! Package Intermediate Requires some knowledge of the internal structure of SunPy Priority Low Slow action required

Comments

@wafels
Copy link
Member

wafels commented Jun 27, 2012

It would be good to have a region of interest (ROI) object.

A ROI object would contain at least the following:

  • bounds in the x, y, (potentially z) and t dimensions. For example, for a simple rectangle it would have x0, y0, x1, y1, t_start and t_end. For free-form shapes, you have to draw the path using chain-code (c.f. HEK).
  • other flags indicating who/what generated the ROI and how.

Example use case:

User uses HEK module to get a list of events for some time range.
BBox info/chain-code from HEK results are automatically converted to SunPy RegionOfInterest instances.
Those instances can then be drawn as overlays on a Map instance, using something like "aiamap.show(overlays=hek_events)"

Here are some possible ways I could imagine creating a new RegionOfInterest:

 roi = RegionOfInterest(0, 0, 100, 100)                # x1, y1, x2, y2
 roi = RegionOfInterest(0, 0, 0, 100, 100, 100)   # x1, y1, z1, x2, y2, z2
 roi = RegionOfInterest([(79.500,-552.300),(80.100,-551.700),(94.500,-531.900), ...])  # chaincode (2d)
 roi = RegionOfInterest([(79.500,-552.300, 100.),(80.100,-551.700, 200.),(94.500,-531.900, 300.), ...])  # chaincode (3d)

# Shapes?
roi = RegionOfInterest(rect=[...])
roi = RegionOfInterest(circle=[...])
roi = RegionOfInterest(sphere=[...])
roi = RegionOfInterest(polygon=[...])

# Time support?
roi = RegionOfInterest(rect=[...], datetime = ...)
roi = RegionOfInterest(circle=[...], datetime = ...)
roi = RegionOfInterest(sphere=[...], datetime = ...)
roi = RegionOfInterest(polygon=[...], datetime = ...)
roi = RegionOfInterest(chaincode=[...], datetime = ...)

# Support for lots of them on plotting for Map
rois = [roi1, roi2, roi3,..., ]

aia.show(overlay = rois, useOverlayDateTime = True )
# only display ROIs that overlap with the map object datetime
useOverlayDateTime = True 
# ignore the ROIs map object datetimes and plot them all on the map
useOverlayDateTime = False 

See an older GSoC project: https://openastronomy.org/gsoc/gsoc2018/#/projects?project=region_of_interest

Extra

More generally it would be good to have an HEK event class that holds event
information. That could be an ROI or EOI factory, that understand HEK or other type of outputs.

WIP about extra methods

Could contain a number of functions (methods), such as 'GROW' or 'SHRINK' or 'ROTATE'.
There are many different ways to perform a "grow" and a "shrink" operation; scipy has a set of these operators under the "morphology" module

http://docs.scipy.org/doc/scipy/reference/ndimage.html#module-scipy.ndimage.morphology

I suppose you could pick one method and say "This is the default method", but you are not guaranteed to end up with something like you thought you were going to get.
For example, the "shrink" operation may end up splitting one ROI in to two unconnected ROIs.

How will we handle that? Is this what the user wants? On saying that, there are probably ways to ensure that you only ever return a single region after a "shrink" operation, but such considerations veer quickly in to the domain of image manipulation and away from a simple ROI object. I'm not saying it shouldn't be done, I'm just saying it requires some experimentation first.

@khughitt

This comment has been minimized.

@aringlis

This comment has been minimized.

@khughitt

This comment has been minimized.

@ghost ghost assigned aringlis Jun 27, 2012
@khughitt

This comment has been minimized.

@wafels

This comment has been minimized.

@khughitt

This comment has been minimized.

@wafels

This comment has been minimized.

@ehsteve

This comment has been minimized.

@wafels

This comment has been minimized.

@Cadair

This comment has been minimized.

@yudhik11

This comment has been minimized.

@nabobalis

This comment has been minimized.

@wafels

This comment has been minimized.

@yudhik11

This comment has been minimized.

@nabobalis nabobalis added Priority Low Slow action required Effort High Requires a large time investment Package Intermediate Requires some knowledge of the internal structure of SunPy labels Jan 22, 2019
@dstansby

This comment was marked as outdated.

@nabobalis

This comment was marked as outdated.

@nabobalis
Copy link
Contributor

Astropy have one now: https://astropy-regions.readthedocs.io/en/stable/index.html

We should investigate if this will work for us

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Effort High Requires a large time investment Feature Request New feature wanted! Package Intermediate Requires some knowledge of the internal structure of SunPy Priority Low Slow action required
Projects
None yet
Development

No branches or pull requests

9 participants