def squish_rgb(fname):
    '''
    take in rgb image and just give us the first channel
    '''
    return skimage.io.imread(fname)[0,:,:]

# we want to create an roi
# if we pick one it will stay the same for all the frames
# we select vertices of the bottom frame second from the left
verts = [(496.91606404958685, 406.69266528925613),
 (499.2249483471075, 249.68853305785117),
 (345.68414256198355, 245.64798553719001),
 (341.64359504132238, 396.87990702479328)]

# use justin's roi utility
roi, roi_bbox, roi_box = bebi103.verts_to_roi(verts, 480, 640)

# define a function roi
def load_roi(fname, roi_bbox = None):
    '''
    define a roi area
    '''
    return squish_rgb(fname)[roi_bbox]


# we can load the stack of images
ic = skimage.io.ImageCollection(im_glob, conserve_memory = True, load_func = load_roi, roi_bbox = roi_bbox)

# when we look at this image we want to constrast the sand from the jelly fish as much as possible
# with sns.axes_style('white'):
#     skimage.io.imshow(ic[0])

fname = './data/goehring_FRAP_data/PH_138_A.tif'

vert = (16.435483870967744, 10.274193548387103)
b = (vert[0], vert[1] + 40)
c = (vert[0] + 40, vert[1])
d = (vert[0] + 40, vert[1] + 40)

verts = np.array([vert, b, c, d])




# use justin's roi utility
roi, roi_bbox, roi_box = bebi103.verts_to_roi(verts, 128, 128)


img_num = 149

# define a function roi
def load_roi(fname, img_num=0, roi_bbox = None):
    '''
    define a roi area
    '''
    out = np.empty(149)
    print ("running function")
   # print (out)

   # for i in range(img_num):