Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from skimage import io
- from math import sqrt
- from skimage.feature import blob_log
- import numpy as np
- from pandas import DataFrame
- def start():
- while True:
- us_input = input(
- "Please enter the name of the file you'd like to analyze.n> "
- )
- try:
- im = io.imread(us_input)
- break
- except FileNotFoundError:
- print(
- "That file doesn't seem to exist or has been entered incorrectly."
- )
- neur_detect(im)
- def neur_detect(im):
- neurons = blob_log(im, min_sigma=1, max_sigma=30, threshold=.02, overlap=.1)
- neur_props(neurons)
- def neur_props(blobs):
- num_neurons = len(blobs)
- print("nNumber of potential neurons detected: {}n".format(num_neurons))
- results = []
- for blob in blobs:
- y_row, x_col, r = blob
- properties = []
- properties.append(x_col / .769230769230769) # convert pixels to um
- properties.append(y_row / .769230769230769) # convert pixels to um
- properties.append(r * sqrt(2)) # compute radii in 3rd column of DataFrame
- mean_intensity = ????
- properties.append(mean_intensity)
- results.append(properties)
- results = DataFrame(results, columns = ['x_coor', 'y_coor', 'radius', 'mean_intensity'])
- results.index = results.index + 1
- print(results)
- start()
Add Comment
Please, Sign In to add comment