<!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> </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> </DIV>
<DIV><FONT face=Arial size=2>I have written code as follows.<BR>{</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> LPBITMAPINFO lpbi;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> // Fill in the BITMAPINFOHEADER<BR> lpbi
= (LPBITMAPINFO) new BYTE[sizeof(BITMAPINFOHEADER) + (256 *
sizeof(RGBQUAD))];<BR> lpbi->bmiHeader.biSize =
sizeof(BITMAPINFOHEADER);<BR> lpbi->bmiHeader.biWidth =
512;//size.cx;<BR> lpbi->bmiHeader.biHeight =
512;//size.cy;<BR> lpbi->bmiHeader.biPlanes =
1;<BR> lpbi->bmiHeader.biBitCount =
8;<BR> lpbi->bmiHeader.biCompression =
BI_RGB;<BR> lpbi->bmiHeader.biSizeImage =
512*512*8;//WIDTHBYTES((DWORD)size.cx * 8) *
size.cy;<BR> lpbi->bmiHeader.biXPelsPerMeter =
0;<BR> lpbi->bmiHeader.biYPelsPerMeter =
0;<BR> lpbi->bmiHeader.biClrUsed =
0;<BR> lpbi->bmiHeader.biClrImportant = 0;<BR> for(int
col=0;col<256;col++)<BR> {<BR> //int
color=rand()%255;<BR> lpbi->bmiColors[col].rgbBlue=(BYTE)(col);<BR> lpbi->bmiColors[col].rgbGreen=(BYTE)(col);<BR> lpbi->bmiColors[col].rgbRed
=(BYTE)(col);<BR> lpbi->bmiColors[col].rgbReserved=0;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> }<BR> <BR> HDC
hMemDC;<BR> hMemDC = CreateCompatibleDC(dc.m_hDC);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> <BR> BYTE *pBits;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> HBITMAP oldbmp=NULL;<BR> unsigned char
*data;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> vtkImageReader *Reader =
vtkImageReader::New();<BR> Reader->SetDataByteOrderToLittleEndian();<BR> Reader->SetDataExtent(0,511,0,511,1,1);<BR> Reader->SetFileName(filepath);//"g:\\1.2.840.113713.10001.1.20076558.428.1013450393.36");<BR> Reader->SetDataSpacing(1.0,
1.0,
1.0);<BR> Reader->SetDataMask(0x7fff);<BR> Reader->SetDataScalarTypeToUnsignedShort();
</FONT></DIV>
<DIV> </DIV><FONT face=Arial size=2>
<DIV><BR> vtkWin32ImageMapper
*bb=vtkWin32ImageMapper::New();<BR> HBITMAP
hBitmap1=bb->CreateBitmapObject(oldbmp,*lpbi,dc.m_hDC,data,Reader->GetOutput(),512,512);<BR>}</DIV>
<DIV> </DIV>
<DIV><BR>Thanking
you,<BR>regards,<BR>Satyanarayana<BR></FONT></DIV></BODY></HTML>