Skip to content

Improve image median

David Gobbi requested to merge dgobbi/vtk:faster-image-median into master

The vtkImageMedian3D filter had two problems:

  1. It used a O(n^2) algorithm to compute the median, and the code was much more complex than necessary. This new code uses an O(n) algorithm provided by the stl.

  2. When computing the median of an even number of elements, it did not take the average of the two middle elements (which is the usual definition of the median of an even number of elements).

Merge request reports