Skip to content

ENH: allow multiple regions to calculate probability in photonizing. #132

@silkenelson

Description

@silkenelson

(from Yanwen:)
I am not sure whether we want it to be able to get probabilites for multiple ROIs

def getProb_img(photonlist, mask, Np=12):
nx,ny = mask.shape
#nroi as the number of rois
nroi = int(mask.max())
p = np.zeros((1,Np,nroi))
ave0, xedges, yedges = np.histogram2d(photonlist[:,1]+0.5, photonlist[:,2]+0.5, bins=[np.arange(nx+1),np.arange(ny+1)])
for roi_num in range(1,nroi+1):
npx = np.where(mask == roi_num)[0].size
p[0,:,roi_num-1] = np.bincount(np.int32(ave0[mask==roi_num].ravel()),minlength = Np)[:Np]
p[0,-1,roi_num-1] = ave0[mask == roi_num].sum()
p[0,:,roi_num-1] /=float(npx)
return p

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions