[b4b313]: / Image Segmentation / region growing / regionGrowSegmentation.m

Download this file

40 lines (32 with data), 1.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function [ segmentedImage ] = regionGrowSegmentation( image , threshold)
%regionGrowSegmentation
% Summary: This function takes an image and converts it into its double
% representation.It then performs region growing on the new double
% image and returns a logical image highlighting the region grown.
% param image
% This can be any image, this is primarily written with dicom images
% in mind so beware.
% param threshold
% This is the threshold distance used to halt the region growing
% algorithm.
%
% return segmentedImage
% The segmented image will be returned as a logical
% 2-dimensional array.
%
% Author: Patrick Stein 7/2/2013
%TODO: Validate incoming params
%Change to a image double
imageDouble = im2double(image);
%Calculate center
%TODO: Replace this with some other data point (provided with
%the ROI rather than a calculation, add factory capabilities
center = size(image)/2+.5;
%run region growing
segmentedImage = regiongrowing(imageDouble,...
floor(center(1)),...
floor(center(2)),...
threshold);
%save the newly segmented image in a 2 dimensional array of
%images
end