[Insight-users] Operator '++' not defined for iterator

Dominique Töpfer dominique at toepfer-web.de
Fri Feb 24 10:40:20 EST 2012


Hi Sylvain,

ImageConstIteratorWithIndex is just a base class and the doxygen 
documentation says:

"It does not provide mechanisms for moving the iterator. A subclass of 
ImageConstIteratorWithIndex 
<http://www.itk.org/Doxygen/html/classitk_1_1ImageConstIteratorWithIndex.html> 
must be used to move the iterator."

I think|| ImageRegionConstIteratorWithIndex is what you are looking for.

HTH
Dominique

On 24.02.2012 03:28, Sylvain Bernhardt wrote:
> Hi all,
> I encountered a little problem with my iterator in ITK4:
>
> typedef unsigned short PixelType;
> const unsigned int Dimension = 2;
> typedef itk::Image<PixelType, Dimension> ImageType;
> typedef itk::ImageConstIteratorWithIndex<ImageType> IteratorType;
>
> ImageType::Pointer imgL = ImageType::New();
> imgL = somereader->GetOutput();
>
> IteratorType it(imgL, imgL->GetLargestPossibleRegion());
>
> for(it = it.Begin(); !it.IsAtEnd(); ++it)
> {
>     ...
> }
>
> The compilation in VisualStudio 2008 gives me this error:
>
> error C2675: unary '++' : 'IteratorType' does not define this operator 
> or a conversion to a type acceptable to the predefined operator
>
> Any thoughts ?
>
> Regards,
> Sylvain
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users


-- 
Dominique Töpfer, Dipl.-Inform.
Institute of Medical Physics
University of Erlangen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120224/aad35ccd/attachment.htm>


More information about the Insight-users mailing list