Skip to content

Instantly share code, notes, and snippets.

View jeanpat's full-sized avatar
🙂

Pommier jeanpat

🙂
View GitHub Profile
@jeanpat
jeanpat / FromSkeletonToGraph.ipynb
Last active August 29, 2015 14:02
A ipython notebook showing how to convert the skeleton of a binary image into a networkw graph
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jeanpat
jeanpat / SkeletonTo graph.ipynb
Created June 1, 2014 16:48
Ipython notebook: generate some model images (uppercase letters) and build a graph from their skeleton
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jeanpat
jeanpat / Skeleton_to_Graph.ipynb
Last active August 29, 2015 14:02
Converting skeleton to graph. A rough ipython notebook. More explanations here: http://dip4fish.blogspot.fr/2014/05/construct-graph-from-skeleton-image-of.html
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jeanpat
jeanpat / C8Skeleton_to_graph-01.ipynb
Created June 12, 2014 08:19
Converting skeleton to graph. A rough ipython notebook. More explanations here: http://dip4fish.blogspot.fr/2014/05/construct-graph-from-skeleton-image-of.html
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jeanpat
jeanpat / Blob detection.ipynb
Created September 2, 2015 23:30
Blobs detection with mahotas
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jeanpat
jeanpat / graph-tool toy model.ipynb
Created October 6, 2015 22:16
Getting the vertices of degree 1 and reading the weight of the bound edge using graph-tool (ipython notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jeanpat
jeanpat / Toy-graph.py
Created November 5, 2015 23:35
Making a weighted graph with graph-tool
def make_toy_graph():
T = gt.Graph(directed = False)
edge_weights = T.new_edge_property('double')
T.properties[("e","weight")] = edge_weights
T.add_vertex(n=4)
e_1 = T.add_edge(0,1)
e_2 = T.add_edge(1,2)
e_3 = T.add_edge(0,0)
@jeanpat
jeanpat / pruning.py
Created November 5, 2015 23:55
mainly a fonction pruning an un-directed multigraph
def at_least_one_vertex_of_degree_above_one(graph):
''' check if there's at least one vertex of degree above 1 in the graph.
'''
graph = gt.GraphView(graph, vfilt= lambda v : v.out_degree() > 1)
try:
first = next(graph.vertices())
except StopIteration:
return False
return True
@jeanpat
jeanpat / response_to_pruning.py
Created November 6, 2015 00:27
Apply iterative prunings to a graph until no more vertice of degree 1 remains.
def total_length_graph(graph):
v_ew, _ =vertex_degree1_edge_weight(T)
return np.sum(v_ew.values())
def response_to_iterative_pruning(graph):
'''return the number of vertices of degree 1 as a function of the number of pruning
'''
response = []
response.append((0,number_of_degree1_vertices(graph)))
#print number_of_degree1_vertices(graph)
@jeanpat
jeanpat / graph-tool toy model- Response to pruning-DIP4FISH.ipynb
Created November 6, 2015 02:01
A python notebook proposing a way to compare two graphs with a distance computed from the response of the graphs to the pruning of their leaves
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.