Last active
October 7, 2016 12:44
-
-
Save will-moore/585f454439ceee94dffdfda284ef090f to your computer and use it in GitHub Desktop.
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
# Pearson coefficient described at https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3074624/ | |
# Start with | |
# $ omero shell --login | |
conn = omero.gateway.BlitzGateway(client_obj=client) | |
i = conn.getObject("Image", 62137) | |
p = i.getPrimaryPixels() | |
# get 2D planes and reshape to 1D array | |
r = p.getPlane(0,0,0) | |
red = r.reshape(r.size) | |
g = p.getPlane(0,1,0) | |
green = g.reshape(g.size) | |
# pearson colocalistion coefficient | |
from scipy.stats import pearsonr | |
pearsonr(red, green) | |
# (0.73771152645247484, 0.0) | |
# scatter plot | |
import matplotlib.pyplot as plt | |
plt.scatter(red, green) | |
# <matplotlib.collections.PathCollection at 0x117779d50> | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment