% Author: Dr. Joshua Morgan and Isabella Bagdasarian, TIME lab, UCR % perform a greedy segmentation of the nuclear channel % uses a nuclei by nuclei threshold approach %PARAMETERS % Do - NxN image (normally already filtered) % threshold- threshold parameter, single value % areaopen- smallest size to preserve when performing bwareaopen, % single value function [Db2] = GreedyNucSeg(Do, threshold, areaopen) Dbi = Do>threshold; Db1 = bwareaopen(Dbi,areaopen); CC = bwconncomp(Db1); Sn = regionprops(CC,Do,'MaxIntensity','MeanIntensity','PixelValues'); L = labelmatrix(CC); Db2 = Db1; for si = 1:length(Sn) t1 = 0.05*Sn(si).MaxIntensity; Db2(L & Do