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

Heatmap Indexing #1136

Draft
wants to merge 3 commits into
base: ig/heatmap_model_matrix
Choose a base branch
from
Draft

Conversation

ilan-gold
Copy link
Collaborator

@ilan-gold ilan-gold commented Jan 21, 2022

Background

Again for #656 this would in theory fix the issue

Here are the steps roughly I am aiming for

  1. Reshape the data matrix to 4096 x 4096. The reason for this is that we cannot bind an arbitrary n x m matrix to the GPU as we are limited in both dimensions by the max texture size, which is usually 4096. Luckily 4096 x 4096 = 16777216 which is probably more than enough for most use cases (Even a 100,000 cells could have 160 features each).
  2. Pass this new padded-matrix along with the dimensions of the original matrix down to the layers and the GPU - in theory we could bind this to the GPU once ahead of time but it doesn't really matter at this stage.
  3. On the shaders, each tile represents a 512x512 view of the original, unpadded matrix. It is aware of its size (512 x 512), the size of the backing texture (4096 x 4096), and the size of the original data (n x m).
  4. This is enough information (in theory) to be able to index into the original matrix, a process I have tried to implement. In other words, given a texture's fragment coordinate we should in theory be able to recover the correct sampling coordinate of the backing matrix. A few things seem to came up:
    a. Each tile's coordinate system on the fragment shader is in a normalized unit square. I have read that 0 corresponds to the top and left and 1 to the bottom and right but in practice I found the top to be 1 and the bottom to be 0. This is resolvable but surprising
    b. There is some scaling business going on that I do not fully understand - something about the way that the tiles are rescaled on zoom events (so that they remain "fixed" on the canvas as we want them to) is causing all the indexing to go off the rails. This is why I tried implementing some sort of model matrix via Model Matrix for Heatmap #1135 to keep track of this better but it doesn't solve the problem. There are other things at play here I don't fully understand.
    c. I think the tiles kind of "go off the screen" even at fully zoomed out resolution which, again, seems to be a flaw in my plan.

This is just a draft to display the (commented out) shader code but in theory this should work. In practice, given the constraints of how the heatmap should display and be interacted with, I'm not so sure it's possible.

Change List

Checklist

  • Ensure PR works with all demos on the dev.vitessce.io homepage
  • Open (draft) PR's into vitessce-python and vitessce-r if this is a release PR
  • Documentation added or updated

@ilan-gold ilan-gold changed the title Ig/make heatmap faster Heatmap Indexing Jan 21, 2022
@keller-mark keller-mark mentioned this pull request Feb 4, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant