Borrar filtros
Borrar filtros

Value only extraction of ROI data?

3 visualizaciones (últimos 30 días)
Robert
Robert el 11 de Abr. de 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

Respuesta aceptada

Image Analyst
Image Analyst el 12 de Abr. de 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 comentarios
Robert
Robert el 12 de Abr. de 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 el 12 de Abr. de 2013
What resulting vector? And why should it be a double value?

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by