next up previous contents
Next: mb_imgconvhull.m Up: HeLa Data Previous: mb_imgcommonpixel.m

mb_threshcrop.m

 function mask = mb_threshcrop(image, cropimage)
% MB_THRESHCROP generates a cropped, thresholded, cleaned  image
% MB_THRESHCROP(IMAGE, CROPIMAGE), where iamge is the IMAGE 
%    to be processed and CROPIMAGE is a binary mask defining
%    a region of interest.  Use CROPIMAGE=[] to process the 
%    entirity of IMAGE.  Thresholding is done BEFORE applying
%    the region of interest.  The image is cleaned using the 
%    majority operation of bwmorph.
%
% 06 Aug 98
%   - 10 Jan 1999 : renamed to reflect the order of operations
%

% $Id: mb_threshcrop.m,v 1.2 1999/02/17 14:19:57 boland Exp $

Iscaled = mb_nihscale(image) ;
Timage = mb_nihthreshold(Iscaled) ;
Ithresh = im2bw(Iscaled, Timage) ;
mask = bwmorph(Ithresh, 'majority') ;

%
% If the crop image exists, make all pixels outside the masked area
%   equal to 0.
%
if (~isempty(cropimage))
        mask = roifilt2(0, mask, ~cropimage) ;
end



 



Copyright ©1999 Michael V. Boland
1999-09-18