Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Extracting Pixel information from ROI
Replies: 1   Last Post: Jul 13, 2013 4:06 PM

 Messages: [ Previous | Next ]
 Rosi Posts: 1 Registered: 7/11/13
Extracting Pixel information from ROI
Posted: Jul 11, 2013 2:21 PM

I am a very new self-taught MATLAB user (so bear with me) trying to write code for some research I am doing for my undergraduate thesis to expedite my analysis. I have fluorescent microscopy images which i am trying to trace with an outline (my ROI's) and then quantify pixel information inside the ROI

-Differentiate ovalish [or tubular] structures outlined from round structures
- first of actual number of pixels only within my outline
- eventually, with a tiff file, find # of green, red, and yellow pixels within outline.

Using the Image Processing Toolbox I have come up with a reasonable (i think) outline program with the final output being a binary outline based of the grayscale image of the original tiff. But how do I extract information from the original image, just from these outlined regions? I assume regionprops somehow but this is where I am having trouble????

Current Code:
function [I,BWoutline,s] = Tloutline2()
%Trace the TL outline for any cell
% Based on conversion to grayscale first

imshow(I)

%convert to grayscale binary image
J = rgb2gray(I);
imshow(J);

K = J>8;
imshow(K);

% call edge to trace borders
[~, threshold] = edge(K, 'sobel');
fudgeFactor = .5;
BWs = edge(K,'sobel', threshold * fudgeFactor);

% horizontal and vertical stretch called
se90 = strel('line', 3, 90);
se0 = strel('line', 3, 0);

% dilate and fill outline
BWsdil = imdilate(BWs, [se90 se0]);
BWdfill = imfill(BWsdil, 'holes');

% smooth border
BWnobord = imclearborder(BWdfill, 4);

seD = strel('diamond',1);
BWfinal = imerode(BWnobord,seD);
BWfinal = imerode(BWfinal,seD);

% Final Output of outline
BWoutline = bwperim(BWfinal);

s = regionprops (J, BWoutline, {'PixelValues'});

Date Subject Author
7/11/13 Rosi
7/13/13 ejs@seniejitrakai.net