Skip to content
Snippets Groups Projects
Select Git revision
  • master
1 result

rpe_morph.m

Blame
  • rpe_morph.m 1.79 KiB
    %--------------------------------------------------------------------------
    % im_thin_clean_br
    % pre-processing helper function
    % (c) 2015-2016 Andrew R. Cohen and Rohini Joshi
    %
    %   license - for review evaluation only
    %       THIS IS UNRELEASED CODE - VIEWING AND DOWNLOAD ONLY BY MANUSCRIPT REVIEWERS
    %   the software will be released under the GPL concurrent with publication
    %
    %       This is the source code for the paper:
    
    %  R. Joshi, M. Winter, J. S. Saini, T. A. Blenkinsop, J. H. Stern, S. Temple and 
    %       A. R. Cohen, "Automated measurement of cobblestone morphology for 
    %       characterizing Stem cell-Derived Retinal Pigment Epithelial cell cultures".
    
    % EXCEPTION: as described in the paper, the source code for the steerable 
    %   wavelet filters must be downloaded separately from http://bigwww.epfl.ch/demo/circular-wavelets. 
    %   All use of that component is governed by the license agreement described there.
    % 
    % Andrew Cohen
    % acohen@coe.drexel.edu
    % http://bioimage.coe.drexel.ed
    %
    %--------------------------------------------------------------------------
    % img = imread('..\images\ZOI\Category 5\Category 5 ZO-1 20X B.JPG');
    function im_thin_clean_br = rpe_morph(img)
    level = graythresh(img);
    img_bw = im2bw(img, level);
    im_skel = bwmorph(img_bw, 'skel', Inf);
    
    im_thin = bwmorph(img_bw, 'thin', Inf);
    
    im_thin_clean = bwmorph(im_thin, 'clean');
    
    im_thin_clean_br = bwmorph(im_thin_clean,'branchpoints');
    imr = bwmorph(im_thin_clean,'endpoints');
    im_thin_clean_br = im_thin_clean_br | imr;
    
    loc = (bwmorph(im_thin_clean_br, 'thicken',  3));
    img_marked(:,:,1) = 127*im_thin_clean + 127*loc;
    img_marked(:,:,2) = 127*im_thin_clean + 127*loc;
    img_marked(:,:,3) = 127*im_thin_clean;
    
    figure,imshow(img_marked);
    imwrite(img_marked, 'PossibleJunctionPoints.tif', 'tif');