Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Rosi

Posts: 1
Registered: 7/11/13
Extracting Pixel information from ROI
Posted: Jul 11, 2013 2:21 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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

disp('Load your image:');
I = imread(uigetfile('filename'));
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'});



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.