<DIV>how to show a histogram?</DIV>
<DIV>I' a new vtkuser,and&nbsp; now I'm try to show a histogram of an image(dicom).</DIV>
<DIV>I tried in this way.But the histogram looks ugly.</DIV>
<DIV>if i want to show it&nbsp;with vtk,what should i do?</DIV>
<DIV>help me,please.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>/////////////////////////////////</DIV>
<DIV>void HISTOGRAM::OnPaint()<BR>{<BR>&nbsp;CPaintDC dc(this);<BR><BR>&nbsp;CWnd* pWnd=GetDlgItem(IDC_DLG_HIST_SHOW);<BR>&nbsp;<BR><BR>&nbsp;CDC *pDC=pWnd-&gt;GetDC();<BR>&nbsp;pWnd-&gt;Invalidate();<BR>&nbsp;pWnd-&gt;UpdateWindow();</DIV>
<DIV>&nbsp;CPen *pPenRed=new CPen;</DIV>
<DIV>&nbsp;&nbsp;pPenRed-&gt;CreatePen(PS_SOLID,1,RGB(255,0,0));</DIV>
<DIV>&nbsp;&nbsp;CPen* pOldPen=pDC-&gt;SelectObject(pPenRed);</DIV>
<DIV>&nbsp;&nbsp;pDC-&gt;MoveTo(10,10);</DIV>
<DIV>&nbsp;&nbsp;pDC-&gt;LineTo(10,280);</DIV>
<DIV>&nbsp;&nbsp;pDC-&gt;LineTo(320,280);</DIV>
<DIV>&nbsp;&nbsp;long MaxCount=0;<BR>&nbsp;for(int i=0;i&lt;65536;i++)<BR>&nbsp;{<BR>&nbsp;&nbsp;if(Hist[i]&gt;MaxCount)<BR>&nbsp;&nbsp;&nbsp;MaxCount=Hist[i];<BR>&nbsp;}</DIV>
<DIV><BR>&nbsp;CString strTemp;<BR>&nbsp;strTemp.Format("%d",MaxCount);<BR>&nbsp;pDC-&gt;TextOut(25,25,strTemp);</DIV>
<DIV><BR>&nbsp;CPen *pPenBlue=new CPen;<BR>&nbsp;<BR>&nbsp;&nbsp;pPenBlue-&gt;CreatePen(PS_SOLID,1,RGB(0,0,255));</DIV>
<DIV><BR>&nbsp;pDC-&gt;SelectObject(pPenBlue);</DIV>
<DIV>&nbsp;if(MaxCount&gt;0)<BR>&nbsp;&nbsp;for(int i=0;i&lt;65536;i=i+1)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;pDC-&gt;MoveTo(i+10,280);<BR>&nbsp;&nbsp;&nbsp;pDC-&gt;LineTo(i+10,281-(int)(Hist[i]*10000/MaxCount));<BR>&nbsp;&nbsp;}<BR>&nbsp;</DIV>
<DIV><BR>&nbsp;pDC-&gt;SelectObject(pOldPen);<BR>&nbsp;<BR><BR>&nbsp;delete pPenRed;<BR>&nbsp;delete pPenBlue;</DIV><br><!-- footer --><br><hr>
<a style="font-size:14px;line-height:15px; color:#000; text-decoration:none" href="http://event.mail.163.com/chanel/xyq.htm?from=163" target="_blank"><span style="text-decoration:underline; color:blue">免费试玩2006中国最佳网络游戏--梦幻西游 </span> </a>