Request for Changes-30: Faster resampling filter

From OTBWiki
Jump to: navigation, search

Status

Summary

This RFC introduces a new fast and scalable filter when resampling an image in the same geometry (i.e. only origin, spacing and size change).

Rationale

StreamingResampleImageFilter is a good filter when resampling images with complex transforms. It supports streaming and multithreading, however when using very simple transforms such as IdentityTransform, it is quite ineficient and does not scale up very well with the number of threads. The itk::ResampleImageFilter behave better in this case, but it does not support streaming. The proposed class is faster than the ITK one and scales up perfectly.

Implementation details

Classes and files

New otb::GridResampleImageFilter class in Filtering/ImageManipulation module :

https://git.orfeo-toolbox.org/otb.git/blob/refs/heads/grid-resampling:/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.txx

Some tips used to speed-up things:

  • This filter does not build and use instances of the Transform class
  • Fill buffer is multithreaded
  • No calls to the IsInside method, the region of computable pixels is computed beforehand
  • Use of itk::ImageScanLineIterator

Applications

BundleToPerfectSensor and Superimpose applications have been updated to use the new filter in PHR mode. RigidTransformResample has been updated to use the new filter in Identiy mode.

Tests

There is a test comparing output of this new filter to the output of the itk::ResampleImageFilter with an Identity transform and the same parameters:

https://git.orfeo-toolbox.org/otb.git/blob/dec7f0e4633f364e6d6273e0dd63286c05dab4ac:/Modules/Filtering/ImageManipulation/test/otbGridResampleImageFilter.cxx

The test does not read or write any image, it is self-contained.

Documentation

Extensive doxygen documentation of the class.

Additional notes

Branch mantis-1153 has been merged to the grid-resampling branch because it adds some new tests that needed to be updated.