Filter löschen
Filter löschen

Value only extraction of ROI data?

3 Ansichten (letzte 30 Tage)
Robert
Robert am 11 Apr. 2013
Hi,
I have a matrix of numeric intensity data (data) and a binary mask (BW). I would like to make histograms of intensity under each mask.
for some context: Currently I have the mean of the region of interest (ROI).
meanvalue=mean2(data(BW));
What I would like is a 1D histogram but I cannot collapse the ROI of data(BW) without a lengthy code.
any ideas on how to collapse this ROI into a single column vector, or just plot an ROI histogram? Thanks in advance.
regards, Rob

Akzeptierte Antwort

Image Analyst
Image Analyst am 12 Apr. 2013
data(BW) is a 1d vector - just save it to a variable and do "whos" on it and you'll see. So that means you can use mean() and don't need mean2()., though mean2 will also work on 1D matrices.
I don't know what this means "I cannot collapse the ROI of data(BW) without a lengthy code." Like I said, that is a 1D vector already and there will be no problem calling imhist() or hist() or histc() on it. So you just do
[pixelCounts, grayLevels] = imhist(data(BW), 256);
bar(grayLevels, pixelcounts, 'BarWidth', 1);
title('Histogram of Masked Region(s)', 'FontSize', 24);
grid on;
  2 Kommentare
Robert
Robert am 12 Apr. 2013
Ah thanks. My problem was the resulting vector was not a double value, which I found out through 'whos'. Thanks again!
Image Analyst
Image Analyst am 12 Apr. 2013
What resulting vector? And why should it be a double value?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by