Last active
August 21, 2019 13:29
-
-
Save mathieuboudreau/b5b2ca1c8eb9d660325f2122a336c023 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
| # Make sure to install openpyxl and pandas first using "pip install ..." | |
| import openpyxl | |
| import pandas as pd | |
| x = np.array([], dtype=[ | |
| ('x0', 'f4'), | |
| ('y0', 'f4'), | |
| ('gratio','f4'), | |
| ('axon_area','f4'), | |
| ('myelin_area','f4'), | |
| ('axon_diam','f4'), | |
| ('myelin_thickness','f4'), | |
| ('axonmyelin_area','f4'), | |
| ('solidity','f4'), | |
| ('eccentricity','f4'), | |
| ('orientation','f4') | |
| ] | |
| ) | |
| # Compute statistics | |
| stats_array = get_axon_morphometrics(pred_axon,path_folder,pred_myelin) | |
| for stats in stats_array: | |
| x = np.append(x, | |
| np.array( | |
| [( | |
| stats['x0'], | |
| stats['y0'], | |
| stats['gratio'], | |
| stats['axon_area'], | |
| stats['myelin_area'], | |
| stats['axon_diam'], | |
| stats['myelin_thickness'], | |
| stats['axonmyelin_area'], | |
| stats['solidity'], | |
| stats['eccentricity'], | |
| stats['orientation'] | |
| )], | |
| dtype=x.dtype) | |
| ) | |
| # Export to excel & csv file | |
| pd.DataFrame(x).to_excel("stats_samples.xlsx") | |
| pd.DataFrame(x).to_csv("stats_samples.csv") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment