<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV><BR>&nbsp;</DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>Dear Luis</FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>Hi,</FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p><FONT face="Times New Roman" size=3>&nbsp;</FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>Thank you for your consideration. It seems that a mapping take place somewhere and convert data from uint16 to unit8.</FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>These are my parameters:</FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman" size=3>&nbsp;</FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>histogramGenerator-&gt;SetNumberOfBins( 4096 );<o:p></o:p></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>histogramGenerator-&gt;SetMarginalScale( 1 );<o:p></o:p></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>histogramGenerator-&gt;SetHistogramMin(<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>-0.5 );<o:p></o:p></SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>histogramGenerator-&gt;SetHistogramMax( 4096 );</SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman" size=3>&nbsp;</FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>I expect that I have frequency of nearly 1000 around bin no 1000 but its 0 and I expect that some of frequency match the total sum of pixels but its nearly half of the total sum.</FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>I need the real histogram (0-4096).</FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>And here is how I check the result for each bin (actually I use the examples I mentioned before):</FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman" size=3>&nbsp;</FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">std::cout &lt;&lt; histogram-&gt;GetFrequency( bin, 0 ) &lt;&lt; std::endl;</SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman" size=3>&nbsp;</FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>And the total number of pixels must be equal to:</FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman" size=3>&nbsp;</FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">s=s+histogram-&gt;GetFrequency( bin, 0 );</SPAN></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><o:p><FONT face="Times New Roman" size=3>&nbsp;</FONT></o:p></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>Yours truly,</FONT></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=3>Hossein</FONT></DIV>
<DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>--- On <B>Tue, 9/9/08, Luis Ibanez <I>&lt;luis.ibanez@kitware.com&gt;</I></B> wrote:<BR></DIV></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid">From: Luis Ibanez &lt;luis.ibanez@kitware.com&gt;<BR>Subject: Re: [Insight-users] need help image histogram<BR>To: hn_6112@yahoo.com<BR>Cc: insight-users@itk.org<BR>Date: Tuesday, September 9, 2008, 9:22 PM<BR><BR><PRE>Hi Hossein,


What values did you set up for the Max and Min of the Histogram ?


   min.Fill(   -0.5 );  ??
   max.Fill(  255.5 );  ??

   generator-&gt;SetHistogramMin( min );
   generator-&gt;SetHistogramMax( max );


If the total number of entries in the Histogram doesn't match the
number of pixels in the image, then it is likely that your Min and
Max setting in the histogram calculator are defining an intensity
range smaller than the actual dynamic range of your DICOM image.


Please let us know,


   Thanks


      Luis


-------------------
hossein nazem wrote:
&gt; Hi,
&gt; 
&gt; I¢m trying to extract the histogram of a dicom image. The result is 
&gt; different to what I achieve from MATLAB. There is something wrong in itk 
&gt; because total pixels are fix and 512*512=262144 but in my code it¢s 
&gt; variable when I change the bins,  and the shape of histogram is 
&gt; different comparing with MATLAB output. I work on a 512*512 dicom uint12 
&gt; image. I tried the Examples/Statistics/ImageHistogram1.cxx &amp; 
&gt; Examples/Statistics/ImageHistogram2.cxx.
&gt; 
&gt;  
&gt; 
&gt; Yours truly,
&gt; 
&gt; Hossein
&gt; 
&gt; 
&gt; 
&gt; ------------------------------------------------------------------------
&gt; 
&gt; _______________________________________________
&gt; Insight-users mailing list
&gt; Insight-users@itk.org
&gt; http://www.itk.org/mailman/listinfo/insight-users
</PRE></BLOCKQUOTE></td></tr></table><br>