[Insight-users] image region iterator
alex Dowson
alexdowson at hotmail.com
Fri Nov 2 05:42:48 EDT 2012
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
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/73fbd9f7/attachment.htm>
More information about the Insight-users
mailing list