I have some code that treats images as arrays. Using GetBufferPointer() works perfectly. You can in fact set the value using the normal notation:<div><br></div><div>PixelType * imgArray = img-&gt;GetBufferPointer();</div><div>

<br></div><div>imgArray[100] = 1;</div><div><br></div><div>I don&#39;t think there is any padding. I&#39;m unfamiliar with the ImportImageFilter.</div><div><br></div><div>- Neil</div><div><br><div class="gmail_quote">On Sun, Apr 17, 2011 at 5:06 AM, Francis Girard <span dir="ltr">&lt;<a href="mailto:francis.girard07@gmail.com">francis.girard07@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;">Hi,<div><br></div><div>Can we iterate safely using this raw buffer pointer?</div><div><br></div><div>Maybe there is some padding to ensure some byte alignment property?</div>

<div><br></div><div>Also if there is a GetBufferPointer notice that there is no SetBufferPointer. So I don&#39;t think you can just set some buffer pointer as is the case with some C++ STL containers. With that API, you will at least need to make a copy of the contents, and even then we must make sure that there is enough allocated memory.</div>


<div><br></div><div>After all, what would be the usefulness of the &quot;ImportImageFilter&quot; if we could simply and safely set a raw buffer pointer?</div><div><br></div><div>And finally what precisely the  &quot;ImportImageFilter&quot; does under the hood? Apprently it does _NOT_ make a copy of your buffer pointer. So maybe that is fast. But I am not sure of what I am saying.</div>


<div><br></div><div>Thanks</div><div><br></div><font color="#888888"><div>Francis</div></font><div><div></div><div class="h5"><div><br></div><div><br></div><div><br><br><div class="gmail_quote">2011/4/17 Neil Panjwani <span dir="ltr">&lt;<a href="mailto:paniwani@gmail.com" target="_blank">paniwani@gmail.com</a>&gt;</span><br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You can access the image in 1D C++ array form using the GetBuferPointer() function.<div><br></div><div>- Neil<br><div>


<br><div><div><br><div class="gmail_quote"><div><div></div><div>On Sat, Apr 16, 2011 at 8:53 PM, Dongfeng Han <span dir="ltr">&lt;<a href="mailto:handongfeng@gmail.com" target="_blank">handongfeng@gmail.com</a>&gt;</span> wrote:<br>




</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div>Hello everyone,<br>Anyone know how to fast assign ITK image data to an c++ array?<br>


The common approach is to use the iterator of  the ITK image and assign the c++ array.<br>

Any other fast way?<br>Best<br>df<br><br>
<br></div></div>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br></div></div></div></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<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>