[Insight-users] Simultaneous iterators

Dan Mueller dan.muel at gmail.com
Wed Dec 15 08:42:48 EST 2010


Hi David,

Perhaps you could store your four images as one vector image, and then
use one iterator...

HTH

Cheers, Dan

On 15 December 2010 13:48, David Doria <daviddoria at gmail.com> wrote:
> I have identified a bottleneck in my program to be a function
> (PatchDifference()). The callgraph is here:
> http://rpi.edu/~doriad/callgraph.jpg
>
> The function looks like this:
>
>  itk::ImageRegionConstIterator<TImage> queryPatchIterator(image, queryRegion);
>  itk::ImageRegionConstIterator<TMask> queryMaskIterator(mask, queryRegion);
>
>  itk::ImageRegionConstIterator<TImage> currentPatchIterator(image,
> currentRegion);
>  itk::ImageRegionConstIterator<TMask> currentMaskIterator(mask, currentRegion);
>
>  while(!queryPatchIterator.IsAtEnd())
>    {
>    // Do a small computation with the 4 pixels here
>
>    ++queryPatchIterator;
>    ++currentPatchIterator;
>    ++queryMaskIterator;
>    ++currentMaskIterator;
>    }
>
> You can see that almost 20% of the total program time is spent in each
> of these iterator ++ functions. Is there a faster way to do this?
>
> Thanks,
>
> David
> _____________________________________
> 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
>


More information about the Insight-users mailing list