David,<br><br>This test:<br><br>Modules/Core/ImageAdaptors/test/itkVectorImageTest.cxx uses iterators on vector adaptors.<br><br>Bill<br><br><div class="gmail_quote">On Tue, Nov 1, 2011 at 9:11 AM, 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: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div>If I create an adaptor to represent one channel of a vector image:</div><div><br></div>
<div>typedef itk::VectorImage&lt;float, 2&gt; VectorImageType;</div><div><br></div><div>  VectorImageType::Pointer image = VectorImageType::New();</div>
<div>  ... Create image ... </div><div><br></div><div>  typedef itk::VectorImageToImageAdaptor&lt;float, 2&gt; ImageAdaptorType;</div><div>  ImageAdaptorType::Pointer adaptor = ImageAdaptorType::New();</div><div>  adaptor-&gt;SetExtractComponentIndex(0);</div>

<div>  adaptor-&gt;SetImage(image);</div><div><br></div><div>And then try to create an iterator:</div><div><br></div><div>  itk::ImageRegionIterator&lt;ImageAdaptorType&gt; imageIterator(adaptor, adaptor-&gt;GetLargestPossibleRegion());</div>

<div><br></div><div>I get this error:</div><div><br></div><div><div>itkImageAdaptor.hxx:334:36: error: cannot convert ‘itk::VectorImage&lt;float, 2u&gt;::InternalPixelType* {aka float*}’ to ‘const InternalPixelType* {aka const itk::VariableLengthVector&lt;float&gt;*}’ in return</div>

</div><div><br></div><div>I also tried using the resulting scalar image type for the iterator:</div><div><br></div><div>typedef itk::Image&lt;float, 2&gt; ScalarImageType;</div><div>itk::ImageRegionIterator&lt;ScalarImageType&gt; imageIterator(adaptor, adaptor-&gt;GetLargestPossibleRegion());</div>

<div><br></div><div>but of course I get this error:</div><div><div>VectorImageToImageAdaptor.cxx:35:103: error: no matching function for call to ‘itk::ImageRegionIterator&lt;itk::Image&lt;float, 2u&gt; &gt;::ImageRegionIterator(itk::VectorImageToImageAdaptor&lt;float, 2u&gt;::Pointer&amp;, const RegionType&amp;)’</div>

</div><div><br></div><div>Is it not possible to iterate over an adaptor like this?</div><div><br></div>Thanks,<br><font color="#888888"><br>David<br>
</font><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><br clear="all"><br>-- <br>Unpaid intern in BillsBasement at noware dot com<br><br>