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

Introduce precise drawing algorithm using a boolean #84

Open
adl1995 opened this issue Jul 19, 2017 · 4 comments
Open

Introduce precise drawing algorithm using a boolean #84

adl1995 opened this issue Jul 19, 2017 · 4 comments
Assignees
Milestone

Comments

@adl1995
Copy link
Member

adl1995 commented Jul 19, 2017

The SimpleTilePainter class will take as a parameter reduce_deformations(?) boolean which will be used before the actual drawing begins. If this is set to True, it will traverse the tiles list and check if it falls under the criteria mentioned in Tile distortion issue, if it does, it will split this father tile into four children tiles (as outlined in #83) and will extend the current list to contain the new labels.

Drawing procedure will remain exactly the same.

@cdeil cdeil added this to the 0.2 milestone Jul 19, 2017
@cdeil
Copy link
Contributor

cdeil commented Jul 19, 2017

Actually, I noticed just now that we might need some larger changes to how the SimpleTilePainter works. The thing is that the criteria whether to split a tile in kids is based on the projected tile pixel corner coordinates. (Is that right? What do you think from the description?)

At the moment we compute the tile list and then only compute the tile corners in the output image for the tile transform later when drawing. Maybe it would be better to change the implementation to compute the tile corner positions in the output image at the start, so that it's available go compute this second tile list? So overall it would be more like:

  1. compute the full plan of how drawing will work, i.e. the complete tile and child tile lists and their corner coordinates
  2. execute the plan, i.e. fetch the tiles and draw them

I would suggest you do #83 first and when that's done either make a PR here with how you'd implement it, or we discuss some more before you start coding. Let me know if you have any questions.

@adl1995
Copy link
Member Author

adl1995 commented Jul 21, 2017

@cdeil So, basically this means to compute the corners at the beginning of draw_tiles function here and then pass the computed corners to warp_imagefunction here, which will then pass it to self.projection here?

Also, these corners will be modified (extended) when a certain tile passes a condition?

@cdeil
Copy link
Contributor

cdeil commented Jul 21, 2017

@adl1995 - I think this is the most complicated thing you've done so far in the hips package, and I fear that if you try to do it in one PR it will completely change the code organisation in draw.py and take a week and it will block me from touching the code in draw.py to do #79 . So I'm wondering if it's possible to go step by step here, and you and I make small pull requests that change / improve or add something to the existing code (each 1 day of coding / code review max), without touching many of the methods.

My preference / suggestion here would be that you start to implement this part as a first PR:

or tiles either too large (one edge is >300 pixels or diagonal is > 150 pixels when projected) or too distorted (ratio of smaller diagonal on larger diagonal is smaller than 0.7):

which I think can be done as a new, independent function in draw.py

def need_to_split_tile(tile_meta, wcs):
    corners = tile_meta.skycoord_corners.to_pixel(wcs)
    # implement the criterion from the text
    # return a bool

@adl1995 - Thoughts?

@adl1995
Copy link
Member Author

adl1995 commented Jul 21, 2017

@cdeil That sounds good to me, I will get started with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants