[Insight-developers] New ImageScanlineIterator
    Bradley Lowekamp 
    blowekamp at mail.nih.gov
       
    Mon Apr 29 09:31:08 EDT 2013
    
    
  
Hello,
I am seeking suggestions for additional places where this new iterator could be beneficial.
I have just merged an new image iterator, which has given up to 3.5x ( VS8 in 256x256 image ) performance improvement in basic binary functor image filters such as the AddImageFilter. 
https://github.com/Kitware/ITK/commit/ab29cc59095d7448a1dbf1e09f96947036d2b118
The way to use the new iterator is basically like this:
    while ( !inputIt1.IsAtEnd() )
      {
      while ( !inputIt1.IsAtEndOfLine() )
        {
        outputIt.Set( m_Functor( inputIt1.Get(), inputIt2.Get() ) );
        ++inputIt2;
        ++inputIt1;
        ++outputIt;
        }
      inputIt1.NextLine();
      inputIt2.NextLine();
      outputIt.NextLine();
      progress.CompletedPixel();
      }
The performance gain is from the removal of any conditionals in the inner loop which enable additional compiler optimizations and only updating the progress on a per line basis.
If anyone knows of the filters with tight looks which could benefit from this new iterator please let me know!
Thanks,
Brad
    
    
More information about the Insight-developers
mailing list