Hi David, <br><br><div><div>The following snippet should do what you need:</div><div><br><div><div>    vtkImageData* cachedImage = ...;</div><div>    int width = cachedImage-&gt;GetDimensions()[0];</div><div>    int height = cachedImage-&gt;GetDimensions()[1];</div>

<div>    QImage qImage(width, height, QImage::Format_RGB32);</div><div>    QRgb* rgbPtr = reinterpret_cast&lt;QRgb*&gt;(qImage.bits());</div><div>    unsigned char* colorsPtr = reinterpret_cast&lt;unsigned char*&gt;(cachedImage-&gt;GetScalarPointer());</div>

<div>    for(int i = 0; i &lt; width * height; ++i)</div><div>      {</div><div>      *(rgbPtr++) = QColor(colorsPtr[0], colorsPtr[1], colorsPtr[2]).rgb();</div><div>      colorsPtr +=  3;</div><div>      }</div><div><br>

</div><div>Regards,</div><div>Julien.</div><div><br><div class="gmail_quote">On Fri, Sep 16, 2011 at 3:24 PM, David Doria <span dir="ltr">&lt;<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">This class convers a QImage to a vtkImageData. Has anyone see or written a class to do the inverse - convert a vtkImageData to a QImage?<div>

<br clear="all">Thanks,<br><font color="#888888"><br>David<br>
</font></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div></div></div></div>