필터 지우기
필터 지우기

Value only extraction of ROI data?

조회 수: 3 (최근 30일)
Robert
Robert 2013년 4월 11일
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

채택된 답변

Image Analyst
Image Analyst 2013년 4월 12일
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
Robert
Robert 2013년 4월 12일
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 2013년 4월 12일
What resulting vector? And why should it be a double value?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by