fishdist.point_correction_and_analysis
finalize_analysis_and_save_db(source_points, corrected_spots, target_points, tags, order=['x', 'y', 'z'], MASK=True, output_filename=None)
Compute distances between corrected points and a target set, save results, and generate plots.
This function performs a per-tag (or global) analysis of 3D points:
- Groups points by tags (if MASK=True).
- Computes 3D distances between corrected_spots and target_points.
- Saves per-tag results in a database with one row per point pair.
- Generates dimension-wise plots showing alignment before and after correction.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Example
import numpy as np
source = np.array([[1,2,3],[4,5,6]])
corrected = np.array([[1.1,2.0,2.9],[3.9,5.1,6.0]])
target = np.array([[1.0,2.0,3.0],[4.0,5.0,6.0]])
tags = np.array(['A','B'])
finalize_analysis_and_save_db(source, corrected, target, tags)
perform_correction(source_points, target_points, recenter=True)
Apply linear bias correction to 3D points by aligning one set of points to another.
This function performs a per-axis linear correction to reduce systematic
biases between two sets of corresponding 3D points obtained from the same image.
One set (source_points) is aligned to the other (target_points) using slope
correction and optional recentering.
The procedure is as follows:
1. Compute the difference between each point in source_points and the corresponding
point in target_points.
2. Subtract the mean difference to center the distribution at zero.
3. Fit a linear regression per axis to estimate scaling (slope) biases.
4. Adjust source_points using the per-axis slopes.
5. Optionally remove any residual global translation to recenter the corrected points.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Example
import numpy as np
source = np.array([[1.0, 2.0, 3.0],
[2.0, 3.0, 4.0]])
target = np.array([[0.9, 2.1, 2.9],
[2.1, 2.9, 4.1]])
corrected = perform_correction(source, target)
print(corrected)