[Insight-users] Retrieving values from an histogram...
Jean-Philippe Guyon
jguyon at ils-inc.com
Wed, 11 Feb 2004 16:08:11 -0500
This is a multi-part message in MIME format.
------=_NextPart_000_0026_01C3F0B9.3F0F9E30
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hello,
I am having a hard time figuring out how to retrieve values from an
histogram that I generate using the itk::ListSampleToHistogramGenerator.The
measurement vector from a bin, which I obtain using the
GetMeasurementVector() function, always contains a single element. My
understanding is that a bin with a frequency of 10 should have a measurement
vector that contains 10 values. Is that correct ???
If that is correct, here is the code I am using to view the content of the
generated histogram:
--------------------------------------
unsigned int size = this->m_Histogram->Size();
for( unsigned int x=0; x<size; x++ )
{
std::cout<<"Bin: "<<x<<std::endl;
std::cout<<"Bin Frequency:
"<<this->m_Histogram->GetFrequency(x,0)<<std::endl;
std::cout<<"Measurement:
"<<this->m_Histogram->GetMeasurementVector(x)<<std::endl;
}
--------------------------------------
Am I missing anything ??? Is there any example that illustrates how to
retrieve values from an histogram. I could not find a specific paragraph
about this topic in the ITK software guide.
Thanks,
Jean-Philippe
------=_NextPart_000_0026_01C3F0B9.3F0F9E30
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D644264720-11022004><FONT face=3DArial color=3D#0000ff =
size=3D2>Hello,</FONT></SPAN></DIV>
<DIV><SPAN class=3D644264720-11022004><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D644264720-11022004><FONT face=3DArial color=3D#0000ff =
size=3D2>I am=20
having a hard time figuring out how to retrieve values from an histogram =
that I=20
generate using the =
itk::ListSampleToHistogramGenerator.</FONT></SPAN><SPAN=20
class=3D644264720-11022004><FONT face=3DArial color=3D#0000ff =
size=3D2>The measurement=20
vector from a bin, which I obtain using the =
GetMeasurementVector()=20
function, always contains a single element. My understanding =
is that a=20
bin with a frequency of 10 should have a measurement vector that =
contains 10=20
values. Is that correct ???</FONT></SPAN></DIV>
<DIV><SPAN class=3D644264720-11022004><FONT face=3DArial color=3D#0000ff =
size=3D2>If=20
that is correct, h</FONT></SPAN><SPAN class=3D644264720-11022004><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>ere is the code I am using to view the content =
of the=20
generated histogram:</FONT></SPAN></DIV>
<DIV><SPAN class=3D644264720-11022004><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><BR><SPAN class=3D644264720-11022004><FONT face=3DArial =
color=3D#0000ff=20
size=3D2>--------------------------------------<BR>unsigned int size =3D =
this<FONT=20
face=3DArial color=3D#0000ff=20
size=3D2>->m_Histogram->Size();</FONT><BR></FONT></SPAN><BR>for</FO=
NT><FONT=20
size=3D2>( </FONT><FONT size=3D2>unsigned</FONT><FONT size=3D2> =
</FONT><FONT=20
size=3D2>int</FONT><FONT size=3D2> x=3D0; =
x<size</FONT></FONT></FONT><FONT=20
face=3DArial color=3D#0000ff size=3D2>; x++ )<BR></FONT><FONT =
face=3DArial><FONT=20
color=3D#0000ff><FONT size=3D2><SPAN class=3D644264720-11022004> =20
</SPAN>{<BR></FONT></FONT></FONT><FONT face=3DArial><FONT =
color=3D#0000ff><FONT=20
size=3D2><SPAN class=3D644264720-11022004> =
</SPAN>std::cout<<"Bin:=20
"<<x<<std::endl;<BR><SPAN class=3D644264720-11022004> =20
</SPAN>std::cout<<"Bin Frequency: =
"<<this</FONT></FONT></FONT><FONT=20
face=3DArial color=3D#0000ff=20
size=3D2>->m_Histogram->GetFrequency(x,0)<<std::endl;<BR><SPA=
N=20
class=3D644264720-11022004> </SPAN>std::cout<<"Measurement:=20
"<<this</FONT><FONT color=3D#0000ff><FONT size=3D2><FONT=20
face=3DArial>->m_Histogram->GetMeasurementVector(x)<<std::end=
l;<BR></FONT><FONT=20
face=3DArial><SPAN class=3D644264720-11022004> =20
</SPAN>}<BR></FONT></FONT></FONT><SPAN class=3D644264720-11022004><FONT =
face=3DArial=20
color=3D#0000ff=20
size=3D2>--------------------------------------<BR><BR></FONT></SPAN></SP=
AN><SPAN=20
class=3D644264720-11022004><FONT face=3DArial color=3D#0000ff =
size=3D2>Am I missing=20
anything ??? Is there any example that illustrates how to retrieve =
values=20
from an histogram. I could not find a specific paragraph about this =
topic in the=20
ITK software guide. </FONT></SPAN></DIV>
<DIV><SPAN class=3D644264720-11022004><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D644264720-11022004><FONT face=3DArial color=3D#0000ff =
size=3D2>Thanks,</FONT></SPAN></DIV>
<DIV><SPAN class=3D644264720-11022004><FONT face=3DArial color=3D#0000ff =
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D644264720-11022004><FONT face=3DArial color=3D#0000ff =
size=3D2>Jean-Philippe</FONT></SPAN><SPAN=20
class=3D644264720-11022004></DIV></SPAN></BODY></HTML>
------=_NextPart_000_0026_01C3F0B9.3F0F9E30--