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"><<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>></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<float, 2> VectorImageType;</div><div><br></div><div> VectorImageType::Pointer image = VectorImageType::New();</div>
<div> ... Create image ... </div><div><br></div><div> typedef itk::VectorImageToImageAdaptor<float, 2> ImageAdaptorType;</div><div> ImageAdaptorType::Pointer adaptor = ImageAdaptorType::New();</div><div> adaptor->SetExtractComponentIndex(0);</div>
<div> adaptor->SetImage(image);</div><div><br></div><div>And then try to create an iterator:</div><div><br></div><div> itk::ImageRegionIterator<ImageAdaptorType> imageIterator(adaptor, adaptor->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<float, 2u>::InternalPixelType* {aka float*}’ to ‘const InternalPixelType* {aka const itk::VariableLengthVector<float>*}’ 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<float, 2> ScalarImageType;</div><div>itk::ImageRegionIterator<ScalarImageType> imageIterator(adaptor, adaptor->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<itk::Image<float, 2u> >::ImageRegionIterator(itk::VectorImageToImageAdaptor<float, 2u>::Pointer&, const RegionType&)’</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>