[Insight-users] image region iterator

Wyke Huizinga wykehuizinga at gmail.com
Fri Nov 2 05:56:27 EDT 2012


Thank you for your quick answer.
but the problem is not solved, because still the iterator won't start. It
is still saying that it is at the end before even starting the while loop.

*Wyke Huizinga*

M: 06 40524703
E: wykehuizinga at gmail.com



2012/11/2 alex Dowson <alexdowson at hotmail.com>

>   Hi
>
> I think iterator code is wrong. It should be output iterator also. Try
> this way.
>
>
>
> typedef ImageRegionConstIterator<TInputImage> InputRegionIterator;
> InputRegionIterator itIn(this->GetInput(), outputRegionForThread);
> typedef ImageRegionIteratorWithIndex<TOutputImage> OutputRegionIterator;
> OutputRegionIterator itOut(this->GetOutput(), outputRegionForThread);
>
>
> // Go over each voxel
> itIn.GoToBegin();
> itOut.GoToBegin();
> while(!itIn.IsAtEnd() )
>   {
>
>         itOut.Set( itOut.Get() * Calculated_Value );
>
>        ++itIn;
>     ++itOut;
> }
>
>
>
>
>
>
>  *From:* Wyke Huizinga <wykehuizinga at gmail.com>
> *Sent:* Friday, November 02, 2012 3:01 PM
> *To:* insight-users at itk.org
> *Subject:* Re: [Insight-users] image region iterator
>
> Hi,
>
>>
>> I'm having a problem with the image iterator.
>> I want to iterate over a specific volume in a 4D image.
>> What I do is the following:
>>
>> I loop over the volumes in the 4D image. Each new loop the region for the
>> image iterator changes.
>> The region is put into a function which should iterate then over the
>> specific volume.
>>
>> The region size is set to the size of a volume and the size of the 4th
>> dimension is set to 0 (in this case: [79 107 60 0])
>> The region index is set to [0 0 0 loopindex].
>>
>> Both the region and the image are passed in correctly into the function.
>>
>> However, the iterator says it is at its end before even starting the loop.
>> The code can be found here: http://pastebin.com/PArvffSq
>> It goes wrong at line 55.
>>
>> I'm a bit of a newby in both ITK and C++, so forgive me if the code looks
>> bad.
>>
>> Thanks for your help,
>>
>>
>> *Wyke Huizinga*
>>
>>
>>
>
>  ------------------------------
> _____________________________________
> 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.php
>
> 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/20121102/2950a14c/attachment.htm>


More information about the Insight-users mailing list