I just noticed that you don't call &quot;Initialize&quot; for your vtkImageData anywhere.&nbsp; Could that have something to do with it?<br><br><div><span class="gmail_quote">On 6/9/05, <b class="gmail_sendername">Sebastian Schuberth
</b> &lt;<a href="mailto:s.schuberth@tu-bs.de">s.schuberth@tu-bs.de</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi all,
<br><br>I'm having some strange issues with the following code:<br><br>----(begin)----<br><br>float *pImageData; // Pointer to a floating-point grayscale image.<br>int nWidth=512,nHeight=721; // Width and height of the image.
<br><br>vtkImageReslice&nbsp;&nbsp;*pImageReslice = vtkImageReslice::New();<br><br>vtkImageData *pvtkImageData = vtkImageData::New();<br>pvtkImageData-&gt;SetDimensions(nWidth,nHeight,1);<br>pvtkImageData-&gt;SetScalarType(VTK_FLOAT);
<br>pvtkImageData-&gt;SetNumberOfScalarComponents(1);<br>memcpy(pvtkImageData-&gt;GetScalarPointer(),pImageData,nWidth*nHeight*sizeof(float));<br><br>pImageReslice-&gt;SetInput(pvtkImageData);<br>// Some image transformations were omitted here for simplicity.
<br>pImageReslice-&gt;Update();<br>float *pfData = (float*)pImageReslice-&gt;GetOutput()-&gt;GetScalarPointer();<br>memcpy(pImageData,pfData,sizeof(float)*nWidth*nHeight);<br><br>pvtkImageData-&gt;Delete();<br>pvtkImageData= NULL;
<br>pImageReslice-&gt;Delete();<br>pImageReslice = NULL;<br><br>----(end)----<br><br>Because I've omitted some transformation operations, the code above just<br>copies the image from and back to pImageData. It works just fine until I
<br>create a DirectX device *before* the code above:<br><br>----(begin)----<br><br>HWND m_window_handle=::GetDesktopWindow();<br><br>IDirect3D9 *m_d3d9_object=Direct3DCreate9(D3D_SDK_VERSION);<br>if (!m_d3d9_object)<br>&nbsp;&nbsp;&nbsp;&nbsp; return;
<br><br>D3DPRESENT_PARAMETERS d3dpp;<br>ZeroMemory(&amp;d3dpp,sizeof(d3dpp));<br>d3dpp.Windowed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = TRUE;<br>d3dpp.SwapEffect&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = D3DSWAPEFFECT_DISCARD,<br>d3dpp.BackBufferFormat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = D3DFMT_UNKNOWN;
<br>d3dpp.Flags&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;<br>d3dpp.PresentationInterval&nbsp;&nbsp; = D3DPRESENT_INTERVAL_IMMEDIATE;<br>d3dpp.EnableAutoDepthStencil = FALSE;<br><br>IDirect3DDevice9 *m_d3d9_device;<br>if<br>(FAILED(m_d3d9_object-&gt;CreateDevice(0,D3DDEVTYPE_HAL,m_window_handle,D3DCREATE_HARDWARE_VERTEXPROCESSING,&amp;d3dpp,
<br>&amp;m_d3d9_device))) return;<br><br>----(end)----<br><br>If I comment out the line which contains the call to CreateDevice all<br>works fine again. Any ideas what happening? Does vtkImageReslice<br>internally even use DirectX in any way?
<br><br>Thanks for any hints.<br><br>--<br>Sebastian Schuberth<br>_______________________________________________<br>This is the private VTK discussion list.<br>Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br></blockquote></div><br><br><br>
-- <br>Randall Hand<br><a href="http://www.yeraze.com">http://www.yeraze.com</a>