-
Notifications
You must be signed in to change notification settings - Fork 10
Fixed indexing error causing broken projections with MeshMapping #35
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
Open
NabbefeldG
wants to merge
1
commit into
bonvision:main
Choose a base branch
from
NabbefeldG:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NabbefeldG great find, thanks for the fix!
Just to clarify, does this mean we mixed up
uandvin the mesh mapping calibration files? Usually in texture mapping land,vis the vertical dimension, but looks like here the fix was to have the number of rows extracted from the number of distinct values ofu?Is everything else with
uandvcorrect? We should probably clarify the meaning of the different file columns in the source code comments (e.g. the comment immediately above the code refers todistinct values of 'v'but this seems to be no longer the case since we now point tou). Updating the comments would make it easier to think about any future changes and help readability.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure at first. The matrix that is generated in Bonsai has the structure (x, y, u, v). This is read in by the provided Matlab script, interpolated and then saved again in the same shape with the additional filed for intensity (x, y, u, v, i). However, there is one line in the Matlab script that reorders the entire matrix:
(Line 44) MeshMapping = sortrows(MeshMapping,3);This changes the ordering of the values. While the "MeshMapping_generate2023.bonsai" script generates and saves data represented along the horizontal and then moving through the columns (Row-Major), the Matlab script flips this and turns this matrix into Column-Major. There likely was a reason for this, as Matlab represents matrices as Col-Major instead.
So, the original version of "CreateVertexGrid.cs" with index 3 is correct after all, but the for-loops assume Row-Major, even though the Matlab script converted it to Col-Major.
I think there are two ways to solve this. Either the CreateVertexGrid() needs to sort its inputs to enforce the Row-Major assumption, or you allow for both represenations and give the CreateVertexGrid() the additional input to select "Row-Major" or "Column-Major" (and a possible third with: "Auto" that sorts the input). While the first feels like the more straight forward fix, the second would allow users to decide to keep there current stimuli. I can image that there are a number of experimentalists out there currently using this function with settings that are just very slighly off and we don't just want to break there stimuli with an update.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize it may not have been that clear what I meant earlier. This is the calibration data before running the line "sortrows()":

And this is it after that line:

This is what I meant with converting row-major to col-major. I hope that helps visualize the issue.