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

Sample coordinates from a Gaussian distribution instead of the SC centerline #1

Open
naga-karthik opened this issue Jan 23, 2024 · 1 comment

Comments

@naga-karthik
Copy link
Owner

Current approach randomly samples the coordinates from the centerline of the healthy SC mask to decide where to paste the lesion. The problem is that the distribution of the pasted lesions lies only along the center of the spinal cord, which is not how MS lesions manifest.

Consider sampling coordinates from a Gaussian distribution instead.

@naga-karthik
Copy link
Owner Author

Examples of coordinates sampled from a Gaussian distrubtion Screenshot 2024-02-06 at 5 37 57 PM
code snippet for gaussian sampling
healthy_sc_coords = np.argwhere(mask_healthy_sc > 0)
# sample a coordinate from the healthy SC mask Gaussian distribution
mean_coords, cov_coords = np.mean(healthy_sc_coords, axis=0), np.cov(healthy_sc_coords.T)
new_position_target = rng.multivariate_normal(mean_coords, cov=cov_coords).astype(int)
# ensure that new position coordinates are within the image dimensions
new_position_target = np.clip(
    new_position_target, 
    a_min=healthy_sc_coords.min(axis=0)+5, 
    a_max=healthy_sc_coords.max(axis=0)-5
)
Examples of coordinates sampled from the SC centerline centerline_sampling

It does seem that sampling from a Gaussian gives a good (and unbiased) coverage of the SC coordinates. Hence, proceeding with Gaussian sampling (instead of the biased centerline sampling).

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

No branches or pull requests

1 participant