<div dir="ltr">The most direct way of creating an image from an array is vtkImageImport:<div><br></div><div><a href="https://lorensen.github.io/VTKExamples/site/Cxx/Images/ImageImport/">https://lorensen.github.io/VTKExamples/site/Cxx/Images/ImageImport/</a><br></div><div><a href="https://www.vtk.org/doc/nightly/html/classvtkImageImport.html">https://www.vtk.org/doc/nightly/html/classvtkImageImport.html</a></div><div><br></div><div>The vtkImageImport class provides two methods for using your array as vtkImageData:</div><div><br></div><div>CopyImportVoidPointer(ptr) -> copy the array into the vtkImageData</div><div>SetImportVoidPointer(ptr) -> use your array directly (do not copy)</div><div><br></div><div> - David</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 1, 2018 at 8:32 AM, Aron Helser <span dir="ltr"><<a href="mailto:aron.helser@kitware.com" target="_blank">aron.helser@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">HI!<div>Check out this example:</div><div><a href="https://lorensen.github.io/VTKExamples/site/Cxx/ImageData/ImageIteratorDemo/" target="_blank">https://lorensen.github.io/<wbr>VTKExamples/site/Cxx/<wbr>ImageData/ImageIteratorDemo/</a><br></div><div><br></div><div>it shows how to iterate through image data and modify it's value. You can assign values from your float array.</div><div>HTH,</div><div>Aron</div></div><div class="gmail-HOEnZb"><div class="gmail-h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 1, 2018 at 4:20 AM, Gib Bogle <span dir="ltr"><<a href="mailto:g.bogle@auckland.ac.nz" target="_blank">g.bogle@auckland.ac.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">There is probably a better way, but one way is to create an ITK image then convert it to a VTK image:<br>
<br>
<a href="https://itk.org/ITKExamples/src/Bridge/VtkGlue/ConvertAnitkImageTovtkImageData/Documentation.html" rel="noreferrer" target="_blank">https://itk.org/ITKExamples/sr<wbr>c/Bridge/VtkGlue/ConvertAnitkI<wbr>mageTovtkImageData/<wbr>Documentation.html</a><br>
<br>
It is easy to create an ITK image, allocate the buffer then copy your data into the buffer.  Of course this requires you to have ITK installed.<br>
______________________________<wbr>__________<br>
From: vtkusers <<a href="mailto:vtkusers-bounces@vtk.org" target="_blank">vtkusers-bounces@vtk.org</a>> on behalf of VTKJunky <<a href="mailto:hadas.judah@gmail.com" target="_blank">hadas.judah@gmail.com</a>><br>
Sent: Monday, 1 January 2018 9:24 p.m.<br>
To: <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
Subject: [vtkusers] Setting vtkImageData from regular float array<br>
<div class="gmail-m_-3698065386950013100HOEnZb"><div class="gmail-m_-3698065386950013100h5"><br>
I have float array which represents a 2-D image. I'd like to set it into<br>
vtkImageData, but can't work out how to do this. The problem is, all the<br>
examples use a vtkReader to read in the data, I already have the data.<br>
<br>
<br>
Any help would be greatly appreciated,<br>
Thanks!<br></div></div></blockquote></div></div></div></div></blockquote></div></div></div>