astropy / astropy/regions

Implementing to_mask for composite regions

Open
#73 0 comments 0 reactions 0 assignees View on GitHub
feature-request help wanted
Dominant language
Python
Stars
65
Forks
64
Avg merge
2d 13h
Merged PRs (30d)
4

Description

PR #71 adds to_mask for some of the single regions, but in future we'll need to implement it on Compound regions. This will have varying degrees of difficulty depending on the mode:

* ``mode='center'`` - should be easy to implement using boolean operations

* ``mode='subpixel'`` and ``mode='exact'`` - this is more complex because if you get two mask pixels that have values of 0.5 for example, it's not clear whether that 0.5 fraction is the same for the two regions in a compound region. If the compound region is a union, the final result could be anywhere from 0.5 to 1.0. There are different possible solutions here. One of them would be to simply convert the compound region to a polygon region (which would need to support multiple disjointed polygons) and then use to_mask on the polygon region class.

This issue is meant to be a space for brainstorming about this, so just add a comment if you have other ideas on how to do this properly.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing PR #71 and the existing single-region to_mask behavior, then inspect how Compound regions represent unions and other combinations. Define consistent results for center, subpixel, and exact modes, including overlapping fractional mask pixels; the work is done when the behavior is agreed and implemented for Compound regions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.