Skip to content

Instantly share code, notes, and snippets.

View jeanpat's full-sized avatar
🙂

Pommier jeanpat

🙂
View GitHub Profile
@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 / 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 / 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 / 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 / C8skel_to_Graph.py
Created May 30, 2014 21:29
Cell of an ipython notebook containing a function to convert the image of a skeleton defined on a neighborhood of 8 pixels, into a graph (networkx). Depends on numpy, mahotas, networkx
import mahotas as mh
import networkx as nx
import numpy as np
def C8skeleton_to_graph(skeletonC8):
#images processing: extraction of branchedpoints, end-points, edges
ep = endPoints(skeletonC8)
bp = branchedPoints(skeletonC8, showSE = False)
## Label branched-points
l_bp,_ = mh.label(bp)
@jeanpat
jeanpat / DrawLetters.py
Created May 30, 2014 14:48
Draw letters with Pillow using the verdana true type font
from PIL import Image, ImageDraw, ImageFont
import mahotas as mh
def makeLetterImage(character, size):
image = Image.new("RGBA", (600,150), (255,255,255))
draw = ImageDraw.Draw(image)
font = ImageFont.truetype("verdana.ttf", size)
draw.text((5, 0), character, (0,0,0), font=font)
img_resized = np.array(image.resize((300,75), Image.ANTIALIAS))
@jeanpat
jeanpat / MaximalQuadrilateralFromNecklaces.ipynb
Created April 10, 2014 12:27
Here 4-tuples of points are considered. A necklace is a set of 4-tuples which can be deduced from one to an other one by circular permutations. With four points, when a maximal area quadrilateral is searched it is faster to search it in the set of the six possible necklaces than in the set of the 4!=24 possible permutations of a 4-tuple.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jeanpat
jeanpat / MFISH_colorCombination.ipynb
Created March 20, 2014 14:41
An ipython notebook showing how to combine five greyscaled images into one RGB MFISH image using scikit-image
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jeanpat
jeanpat / resizeImages.py
Created February 21, 2014 15:20
Given a list of monochrome images or multispectral images (example rgb, or also a z-stack of images) build a list of images of the same size by adding borders.
def ResizeImages(ImList):
'''Find the largest width and height of images belonging to a list.
Return a list of images of same width/height
'''
maxwidth=0
maxheight=0
if len(np.shape(ImList[0]))==3:
components = np.shape(ImList[0])[2]
imtype = ImList[0].dtype
for i in range(len(ImList)):
@jeanpat
jeanpat / chromosomes extraction from mfish image.ipynb
Last active August 29, 2015 13:56
This ipython notebook shows how to extract, with scipy.ndimage, chromosomes from a set of mfish images.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.