[Insight-users] ImageRegionIterator inside ImageToImageFilter

Michael Xanadu xanadu.michael at googlemail.com
Fri Oct 2 09:53:29 EDT 2009


Thank you, it works. Do you know how to put the input of the filter directly
to the filter's output? I don't need any other filters in GenerateData(),
only the iterator. I tryed something like that, but I get an error again:

template <class TImageType, class TOutputType>
void ContourArrayFilter<TImageType, TOutputType>::GenerateData()
{
    //after iterating through input, set input directly to output:
    this->Update();
    this->GraftOutput( this->GetInput() );
}

error C2664: 'itk::ImageSource<TOutputImage>::GraftOutput' : cannot convert
parameter 1 from 'const itk::Image<TPixel,VImageDimension> *' to
'itk::DataObject *'


Michael




2009/10/2 Frederic Perez <fredericpcx at gmail.com>

> Hi Michael,
>
> you might consider using itk::ImageRegionConstIterator instead.
>
> Cheers,
>
> Frederic Perez
>
> On Fri, Oct 2, 2009 at 3:05 PM, Michael Xanadu <
> xanadu.michael at googlemail.com> wrote:
>
>> Hi,
>>
>> i wanna write my own filter dereived from ImageToImageFilter. In
>> GenerateData() i want to use an ImageRegionIterator, which shall get the
>> Input of the filter:
>>
>> template <class TImageType, class TOutputType>
>> void ContourArrayFilter<TImageType, TOutputType>::GenerateData()
>> {
>>     typedef itk::ImageRegionIterator< TImageType > IteratorType;
>>     IteratorType iterator( this->GetInput(),
>> this->GetInput()->GetLargestPossibleRegion());
>>     //...
>> }
>>
>> But this->GetInput() delivers a const Pointer while the iterator needs a
>> normal one. So I get:
>>
>> cannot convert parameter 1 from 'const itk::Image<TPixel,VImageDimension>
>> *' to 'itk::Image<TPixel,VImageDimension> *'
>>
>> Does anybody know how to solve the problem? I just wanna iterate the
>> pixels of the input.
>>
>>
>> Refards, Michael
>>
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.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
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20091002/b6db3f78/attachment.htm>


More information about the Insight-users mailing list