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

Normalize (zero-mean) the point coordinates at each time point #122

Open
TeunHuijben opened this issue Oct 3, 2024 · 0 comments
Open

Normalize (zero-mean) the point coordinates at each time point #122

TeunHuijben opened this issue Oct 3, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@TeunHuijben
Copy link
Collaborator

TeunHuijben commented Oct 3, 2024

This would remove global drift of the sample from the tracks shape. Upside is that the point cloud will always be centered around the center of the viewer (allows for easy rotation). Downside could be that the possible movement of the sample in the microscope is no longer reflected in the viewer.

Connected to #118

This could be achieved by adding the following code to src/lib/TrackManager.ts:

let x_total = 0;
let y_total = 0;
let z_total = 0;
for (let i = 0; i < array.length; i += stride) {
    x_total += array[i];
    y_total += array[i + 1];
    z_total += array[i + 2];
}
const meanX = x_total / (array.length / stride);
const meanY = y_total / (array.length / stride);
const meanZ = z_total / (array.length / stride);

Only adjustment that is needed is to calculate the mean from the points, and apply these means for rescaling the fetched tracks (now points and tracks use the same applyScale function

@TeunHuijben TeunHuijben added the enhancement New feature or request label Oct 3, 2024
@TeunHuijben TeunHuijben self-assigned this Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant