Thread Subject:
getting subimages

Subject: getting subimages

From: subrajeet Mohapatra

Date: 10 May, 2010 13:09:21

Message: 1 of 4

I want to create subimages from a single image which contains many WBC cells. I am using regionprop and bounding box it is creating many unwanted subimages also. I have tried convexhull also same problem persists. Any way to reduce small unwanted subimages.

the below link contains the image
http://www.healthsystem.virginia.edu/internet/hematology/images/Acute-lymphoblastic-leukemia-L1-subtype-100x-website.jpg

Subject: getting subimages

From: Jan

Date: 10 May, 2010 16:46:39

Message: 2 of 4

On 5/10/2010 3:09 PM, subrajeet Mohapatra wrote:
> I want to create subimages from a single image which contains many WBC
> cells. I am using regionprop and bounding box it is creating many
> unwanted subimages also. I have tried convexhull also same problem
> persists. Any way to reduce small unwanted subimages.
>
> the below link contains the image
> http://www.healthsystem.virginia.edu/internet/hematology/images/Acute-lymphoblastic-leukemia-L1-subtype-100x-website.jpg
>

you could get rid of small areas by smoothing the image before. however
than also adjacent cells would be melted and could be differentiated
enough. a mixture of smoothing, adaptive thresholds (including the
laplacian, etc. ) and a threshold on number of pixels in resulting area
can help. however under different conditions the parameters of the
algorithm like the thresholds will have to be adapted.

I crafted an example for you, that might act as an inspiration. However
this is a whole search area with many possible approaches. This is only
the easiest one.

Jan

function [subs] = SimpleRegionSelection()
% Divides images of many cells in single images of cells using some simple
% smoothing and threshold criteria. Works only on good-enough pictures and
% may require tweaking.
%
% Jan Keller (jkeller1@gwdg.de)

[image, colmap] =
imread('Acute-lymphoblastic-leukemia-L1-subtype-100x-website.jpg'); %
three frames (r,g,b) I believe

% parameters
smoothing_size = 10; % smoothing gaussian diameter in pixel
threshold = .18; % intensity treshold relative to maximum
numpixel_threshold = 5000; % number of pixel threshold in each area

img = double(image);
img = sqrt(img); % this is a trick to reduce the influence of image
noise on the whole algorithm

% first step some smoothing (3 pixels wide)
l = round(2 * smoothing_size);
[x, y] = ndgrid(-l:l, -l:l);
smoothing_kernel = power(2., -(x.^2+y.^2) / (smoothing_size/2)^2);

smoothed = zeros(size(img));
for ki = 1 : size(img, 3)
     smoothed(:, :, ki) = imfilter(img(:, :, ki), smoothing_kernel, 'same');
end

% add all three color channels up and normalize and make negative because
% original image is white outside of cells
smoothed = sum(smoothed, 3);
smoothed = 1. - smoothed ./ max(smoothed(:));

% thresholding and get regions
bw = smoothed > threshold;
[label, n] = bwlabel(bw);

% separate to subs
subs = {};
for ki = 2 : n % ignoring the first, its the background
     % get values of coordinates in regions
     maskpos = find(label == ki);
     [x, y] = ind2sub(size(label), maskpos);
     % obtain bounding box with some border
     border = 5;
     xmin = max(min(x) - border, 1);
     xmax = min(max(x) + border, size(label, 1));
     ymin = max(min(y) - border, 1);
     ymax = min(max(y) + border, size(label, 2));
     chunk = image(xmin:xmax,ymin:ymax,:);
     numpixel = size(chunk, 1) * size(chunk, 2);
     fprintf('%d\n', numpixel);
     if numpixel > numpixel_threshold
         % write to cell array
         subs = [subs, {}];
     end
end

% this is just for visualisztion
figure;
imagesc(label);
title('image mask');
for ki = 1 : length(subs)
     figure;
     imagesc(subs{ki});
     colormap(colmap);
     s = sprintf('subimage %d', ki);
     title(s);
end

end

Subject: getting subimages

From: ImageAnalyst

Date: 10 May, 2010 17:39:01

Message: 3 of 4

On May 10, 9:09 am, "subrajeet Mohapatra" <subraje...@gmail.com>
wrote:
> I want to create subimages from a single image which contains many WBC cells. I am using regionprop and bounding box  it is creating many unwanted subimages also. I have tried convexhull also same problem persists. Any way to reduce small unwanted subimages.
>
> the below link contains the imagehttp://www.healthsystem.virginia.edu/internet/hematology/images/Acute...

----------------------------------------
You could use ismember after regionprops if you want to filter on
size, or any combination of other measurements (such as color, shape,
etc.). See this image segmentation demo for an example:
http://www.mathworks.com/matlabcentral/fileexchange/25157

Or you could use bwareaopen on the binary image (before labeling and
regionprops) if you want to filter on just area alone.

Subject: getting subimages

From: Jan

Date: 11 May, 2010 08:07:25

Message: 4 of 4

actually some simple watershed segmentation algorithm could probably
also do the trick
http://www.mathworks.com/company/newsletters/news_notes/win02/watershed.html

or this http://www.diplib.org/ is also a nice library and does many of
these things automatically however I have no example for it...

regards jan

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
cell subimaging subrajeet Mohapatra 10 May, 2010 09:09:29
rssFeed for this Thread

Contact us