<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4134.600" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>dear friends,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I am working on vtkWin32ImageMapper class to create 
hbitmap.But in that createBitmapObject function getting abort.Please give me 
suggestion where I am going wrong.What i need is HBITMAP for displaying on 
window.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I have written code as follows.<BR>{</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;LPBITMAPINFO lpbi;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;// Fill in the BITMAPINFOHEADER<BR>&nbsp;lpbi 
= (LPBITMAPINFO) new BYTE[sizeof(BITMAPINFOHEADER) + (256 * 
sizeof(RGBQUAD))];<BR>&nbsp;lpbi-&gt;bmiHeader.biSize = 
sizeof(BITMAPINFOHEADER);<BR>&nbsp;lpbi-&gt;bmiHeader.biWidth = 
512;//size.cx;<BR>&nbsp;lpbi-&gt;bmiHeader.biHeight = 
512;//size.cy;<BR>&nbsp;lpbi-&gt;bmiHeader.biPlanes = 
1;<BR>&nbsp;lpbi-&gt;bmiHeader.biBitCount = 
8;<BR>&nbsp;lpbi-&gt;bmiHeader.biCompression = 
BI_RGB;<BR>&nbsp;lpbi-&gt;bmiHeader.biSizeImage = 
512*512*8;//WIDTHBYTES((DWORD)size.cx * 8) * 
size.cy;<BR>&nbsp;lpbi-&gt;bmiHeader.biXPelsPerMeter = 
0;<BR>&nbsp;lpbi-&gt;bmiHeader.biYPelsPerMeter = 
0;<BR>&nbsp;lpbi-&gt;bmiHeader.biClrUsed = 
0;<BR>&nbsp;lpbi-&gt;bmiHeader.biClrImportant = 0;<BR>&nbsp;for(int 
col=0;col&lt;256;col++)<BR>&nbsp;{<BR>&nbsp;&nbsp;//int 
color=rand()%255;<BR>&nbsp;&nbsp;lpbi-&gt;bmiColors[col].rgbBlue=(BYTE)(col);<BR>&nbsp;&nbsp;lpbi-&gt;bmiColors[col].rgbGreen=(BYTE)(col);<BR>&nbsp;&nbsp;lpbi-&gt;bmiColors[col].rgbRed 
=(BYTE)(col);<BR>&nbsp;&nbsp;lpbi-&gt;bmiColors[col].rgbReserved=0;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;}<BR>&nbsp;<BR>&nbsp;HDC 
hMemDC;<BR>&nbsp;hMemDC = CreateCompatibleDC(dc.m_hDC);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;<BR>&nbsp;BYTE *pBits;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;HBITMAP oldbmp=NULL;<BR>&nbsp;unsigned char 
*data;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;vtkImageReader *Reader = 
vtkImageReader::New();<BR>&nbsp;Reader-&gt;SetDataByteOrderToLittleEndian();<BR>&nbsp;Reader-&gt;SetDataExtent(0,511,0,511,1,1);<BR>&nbsp;&nbsp;&nbsp;Reader-&gt;SetFileName(filepath);//"g:\\1.2.840.113713.10001.1.20076558.428.1013450393.36");<BR>&nbsp;Reader-&gt;SetDataSpacing(1.0, 
1.0, 
1.0);<BR>&nbsp;Reader-&gt;SetDataMask(0x7fff);<BR>&nbsp;Reader-&gt;SetDataScalarTypeToUnsignedShort(); 
</FONT></DIV>
<DIV>&nbsp;</DIV><FONT face=Arial size=2>
<DIV><BR>&nbsp;vtkWin32ImageMapper 
*bb=vtkWin32ImageMapper::New();<BR>&nbsp;HBITMAP 
&nbsp;hBitmap1=bb-&gt;CreateBitmapObject(oldbmp,*lpbi,dc.m_hDC,data,Reader-&gt;GetOutput(),512,512);<BR>}</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>Thanking 
you,<BR>regards,<BR>Satyanarayana<BR></FONT></DIV></BODY></HTML>