Hi Demian,<br><br>Yeap, <br>strictly speaking, that buffer that you are providing to the method<br><br>                                           SetImportContainer() <br><br>should be a pointer to a VectorPixelType array.<br>
<br>However, <br>the itk::Vector class essentially contain just an array of T elements.<br><br>So, if you allocate an array of NPixels * 3 of doubles, and you <br>to the Import Container, things should go well...<br><br>image-&gt;GetPixelContainer()-&gt;<blockquote class="gmail_quote">
SetImportPointer( bufferVectorImage,</blockquote><div>            (VectorPixelType)bufferVectorImageSize, false );<br>
</div><br><br>or<br><br>image-&gt;GetPixelContainer()-&gt;
<blockquote class="gmail_quote">SetImportPointer( bufferVectorImage,</blockquote>
<div>            reinterpret_cast&lt;VectorPixelType&gt;(bufferVectorImageSize), false );<br>

</div><br>
<br>----<br><br>Note also, that some compilers &amp; some architectures may <br>decided to pad a type such as the itk::Vector, in which case,<br>the three doubles of one vector will not be just next to the<br>three doubles of the next vector...<br>
<br><br>    Luis<br><br><br>--------------------------------------------------------------------------------<br><div class="gmail_quote">On Tue, Oct 26, 2010 at 3:03 PM, Demian Wassermann <span dir="ltr">&lt;<a href="mailto:demian@bwh.harvard.edu">demian@bwh.harvard.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi to all,<br>
<br>
I have a small problem, I want to interface ITK with python, I&#39;ve used some of Steve Pieper&#39;s code ( <a href="http://www.slicer.org/slicerWiki/index.php/Slicer3:Python:pitky" target="_blank">http://www.slicer.org/slicerWiki/index.php/Slicer3:Python:pitky</a> ) and I&#39;ve been successful in the scalar case however I need to interface a vector field.<br>

<br>
More precisely:<br>
<br>
  typedef itk::Image&lt; double, Dimension &gt;     ImageType;<br>
  ImageType::Pointer fixedImage = ImageType::New();<br>
  image-&gt;GetPixelContainer()-&gt;SetImportPointer( bufferImage, bufferImageSize, false );<br>
<br>
works like a charm. However if the image type changes to:<br>
<br>
 typedef itk::Vector&lt; double, Dimension &gt;    VectorPixelType;<br>
 typedef itk::Image   &lt; VectorPixelType, Dimension &gt;              VectorFieldType;<br>
<br>
The line<br>
<br>
image-&gt;GetPixelContainer()-&gt;SetImportPointer( bufferVectorImage, bufferVectorImageSize, false );<br>
<br>
does not seem to work as the element on each of the voxels is a VectorPixelType and not a straight double.<br>
<br>
hence bufferVectorImage must be of type VectorPixelType* and not double*<br>
<br>
Any ideas?<br>
<br>
Thanks!<br>
<br>
Demian<br>
<br>
<br>
--<br>
Demian Wassermann, PhD<br>
<a href="mailto:demian@bwh.harvard.edu">demian@bwh.harvard.edu</a><br>
LMI / PNL / SPL Labs<br>
Harvard Medical School<br>
Brigham and Women&#39;s Hospital<br>
1249 Boylston, Boston, MA, USA<br>
<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>
</blockquote></div><br>