% Author: Dr. Joshua Morgan and Isabella Bagdasarian, TIME lab, UCR % Sometimes phalloidin/f-actin show up on the nuclei channel. This function % identifies artifacts with an unusual shape (i.e long and thin) for nuclei % and rejects them based off of this assesment. %PARAMETERS % D1 - 2D image % Db4et- 2D logical function [Ld] = CancelCytArt(D1, Db4et) %Reject artifacts from the phalloidan channel CC = bwconncomp(Db4et); Ld = labelmatrix(CC); Sr = regionprops(CC,D1,'Solidity','Perimeter'); for si = 1:length(Sr) x = ((Sr(si).Solidity < 0.65) && (Sr(si).Perimeter > 1200)); if x Ld(Ld == si) = 0; end end end