# How to fullfill segmented region by using region growing?

6 views (last 30 days)
iza on 17 Jun 2016
Edited: iza on 21 Jun 2016
Can anyone help me on how to make the segmented purple region fulfilled the neighborhood 'empty' area with the same purple color?
The problem is, how to make the region of purple growing and fulfill all it's neighborhood region so that the region is larger.
Actually my intention is to perform region growing before k-means clustering, but it seems like it does not make any sense because both are segmentation. Any idea guys?...

iza on 17 Jun 2016
The image is actuall
y an overlapped of two brain images:

iza on 21 Jun 2016
I managed to solve the problem using this code:
% Find boundry of image
bw = im2bw(image, graythresh(image));
cc = bwconncomp(bw);
lblMatrix = labelmatrix(cc);
edgeMatrix=edge(lblMatrix,'roberts',0);
edgeMatrix1 = double(edgeMatrix);
edgeMatrix1(end, end, 3) = 0;
figure;
imshow(edgeMatrix1);
%fill inside the region of detected edge
edgeMatrix2=imfill (edgeMatrix1,'holes');
figure; imshow(edgeMatrix2); title('WM and WMH Boundary Extraction','FontSize', 12);
%overlay detected edge on segmented image
rgbImageX = imoverlay(hat, edgeMatrix1, [1 0 0]);
imshow(rgbImageX); title('Boundary overlay on segmented images','FontSize', 12);
iza on 21 Jun 2016
In order to crop the image by using the boundary, here is the code. By the way addImGMWM is RGB image.
%crop the image
% Create a binary image ("mask") from the ROI object.
figure;
imshow(bw);
title('Binary mask of the region', 'FontSize', fontSize);
% Display it.
figure;
title('Mask of the desired region only', 'FontSize', fontSize);