fishdist.spot_data_utils
compute_and_plot_points_for_all_dims(measured_points, corrected_spots, reference_points, rescaling_factor=[0.1037832, 0.1037832, 0.25])
Compute and display statistics of 3D spot positions before and after correction.
This function calculates the vectors from measured to reference points, computes pairwise distances, medians, and interquartile ranges (IQRs), and prints mean vectors before and after correction. Intended for quality assessment of chromatic aberration correction.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Example
>>> import numpy as np
>>> measured = np.array([[0,0,0],[1,1,1],[2,2,2]])
>>> corrected = np.array([[0,0,0],[1,1,0.9],[2,2,1.9]])
>>> reference = np.array([[0,0,0],[1,1,1],[2,2,2]])
>>> compute_and_plot_points_for_all_dims(measured, corrected, reference)
Mean vector before correction: [0. 0. 0.]
Mean vector after correction: [ 0. 0. -0.06666667]
Original distances (median * 1000 nm): 0.0 IQR: [0. 0.]
Corrected distances (median * 1000 nm): 24.999999999999993 IQR: [0.0125 0.025 ]
compute_pairwise_distance(coord_set1, coord_set2, rescaling_factor=None)
Compute pairwise distances between two sets of coordinates.
For each index i, calculates the distance between coord_set1[i] and coord_set2[i].
If the sets have different lengths, computes distances up to the length of the shorter set
and prints a warning.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Example
>>> import numpy as np
>>> set1 = np.array([[0,0],[1,1],[2,2]])
>>> set2 = np.array([[1,0],[1,2],[2,3]])
>>> compute_pairwise_distance(set1, set2)
[1.0, 1.0, 1.0]
>>> compute_pairwise_distance(set1, set2, rescaling_factor=2)
[2.0, 2.0, 2.0]
get_green_and_blue_dots(src='coloc', order=['x', 'y', 'z'], TAG=False, check_voxel_size=True, atol=1e-06, table_name='points_n_distances3D_only_in_nuclei')
Load measured (blue) and reference (green) 3D spot coordinates from FISH datasets, optionally returning tags.
This function extracts 3D spot coordinates from database files or a list of file paths, checks for consistent voxel sizes, and optionally returns the source tag for each point.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Example
blue, green, tags = get_green_and_blue_dots(src='coloc', TAG=True)
blue, green = get_green_and_blue_dots(src=['file1.czi', 'file2.czi'])
blue, green = get_green_and_blue_dots(src='coloc', table_name='points_n_distances3D_ch1_ch2_only_in_nuclei')
plot_each_dim(blue_spots, corrected_spots, green_spots, axes_names=['X', 'Y', 'Z'], center_on_zero=True)
Plot displacement along each dimension before and after correction, with linear regression slopes.
This function visualizes the per-dimension displacements of 3D spots relative to reference positions, comparing measured (blue) and corrected (red) spots. It optionally centers displacements on zero, fits linear regressions, and prints slope values.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Example
import numpy as np
measured = np.array([[0,0,0],[1,1,1],[2,2,2]])
corrected = np.array([[0,0,0],[1,0.9,1],[2,1.9,2]])
reference = np.array([[0,0,0],[1,1,1],[2,2,2]])
plot_each_dim(measured, corrected, reference)
plot_points_3D(blue_spots, corrected_spots, green_spots)
Create a 3D scatter plot of blue, green, and corrected spot coordinates.
This function visualizes three sets of 3D points: the original measured (blue), reference (green), and corrected (red) spots, allowing visual assessment of chromatic aberration correction.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Example
>>> import numpy as np
>>> measured = np.array([[0,0,0],[1,1,1],[2,2,2]])
>>> corrected = np.array([[0,0,0],[1,1,0.9],[2,2,1.9]])
>>> reference = np.array([[0,0,0],[1,1,1],[2,2,2]])
>>> plot_points_3D(measured, corrected, reference)