huangziwei / tracepy Goto Github PK
View Code? Open in Web Editor NEWA script for processing .trace file from ImageJ / Simple Neurite Tracer.
A script for processing .trace file from ImageJ / Simple Neurite Tracer.
def get_df_paths2(df_trace, soma_info):
all_paths = get_all_paths(df_trace)
df_paths = pd.DataFrame(list(all_paths.items()), columns=['path_id', 'path'])
# df_paths['path2'] = ''
connect_to_all = []
connect_to_at_all = []
for i, key in enumerate(all_paths.keys()):
if connected_with_soma(all_paths, key, soma_info, threshold=5):
connect_to = -1
connect_to_at = []
else:
connect_to, connect_to_at = get_connect_to(all_paths, key)
connect_to_all.append(connect_to)
connect_to_at_all.append(connect_to_at)
df_paths['connect_to'] = connect_to_all
df_paths['connect_to_at'] = connect_to_at_all
df_paths.sort_values(['path_id'], ascending=[True], inplace=True)
df_paths.index = df_paths.path_id.as_matrix()
connected_by_all = []
connected_by_at_all = []
for i, key in enumerate(df_paths.path_id):
connected_by = df_paths[df_paths.connect_to == key].path_id.tolist()
connected_by_at = df_paths[df_paths.connect_to == key].connect_to_at.tolist()
connected_by_all.append(connected_by)
connected_by_at_all.append(connected_by_at)
df_paths['connected_by'] = connected_by_all
df_paths['connected_by_at'] = connected_by_at_all
path2 = {}
for path_id in df_paths.path_id:
connect_to = df_paths.loc[path_id].connect_to
path = df_paths.loc[path_id].path
connect_to_at = df_paths.loc[path_id].connect_to_at
if connect_to == -1:
path2[path_id] = path
else:
if (connect_to_at == path).all(1).any():
path2[path_id] = path
else:
path = np.vstack([connect_to_at, path]) # the bug is here
path2[path_id] = path
df_paths['path'] = path2.values()
return df_paths
I am just opening this to mention that this is really great! SNT Users would definitely profit from this.
I was planning to write an IPython Notebook exemplifying how to analyze SNT traces (see fiji/SNT#10), but now that I came across your project, I was simply thinking to:
@huangziwei, what do you think?
Also relevant (in case you have not seen it) is https://github.com/hadim/scijava-jupyter-kernel
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.