[Insight-developers] Smart Pointer (continue)

Luis Ibanez luis.ibanez@kitware.com
Thu, 25 Apr 2002 11:49:26 -0400


Yinpeng,


You have to replace the current iterator
with a const iterator.

Replace:

    ImageRegionIteratorWithIndex

with:

     ImageRegionConstIteratorWithIndex


For that, you will also have to add a:

#include "itkImageRegionConstIteratorWithIndex.h"


The constructors of const iterators accept :

        "const Image *"

as argument.




Luis

==================================

Yinpeng Jin wrote:
> Luis:
> that was my first thought, too, I tried
> const InputImageType*
> and InputImageConstPointer input
> both give me similar error.
> 
> I think the reason is that
> this->GetInput() returns a InputImageConstPointer (from ImageToImageFilter)
> but the iterator need a "TImage *" as the first par.
> maybe something needs to change in ImageToImageFilter or
> ImageRegionIteratorWithIndex
> I am not sure if my understanding is correct.
> But if we don't want to change ImageToImageFilter or
> ImageRegionIteratorWithIndex,
> is there anything I can do? static cast?
> yinpeng.
> 
> 
> ----- Original Message -----