Skip to content

Instantly share code, notes, and snippets.

@bennihepp
Created January 19, 2012 10:00
Show Gist options
  • Save bennihepp/1639142 to your computer and use it in GitHub Desktop.
Save bennihepp/1639142 to your computer and use it in GitHub Desktop.
Example script for CellProfiler RunScript module
from scipy import ndimage
labels = Cells.segmented
background_labels = np.array(labels == 0, dtype=int)
dt_labels = ndimage.distance_transform_edt(background_labels)
imVSVG_pixels = imVSVG.pixel_data
imVSVG_dt_pixels = imVSVG_pixels * dt_labels
imVSVG_dr_pixels = imVSVG_pixels / dt_labels
imVSVG_dr_pixels[dt_labels == 0] = imVSVG_pixels[dt_labels == 0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment