uk.ac.starlink.splat.util
Class MedianFilter

java.lang.Object
  extended by uk.ac.starlink.splat.util.MedianFilter

public class MedianFilter
extends Object

Create a median filtered version of a data array. The median is the middle value from those in a region about the current value (i.e. this is a windowed filter).


Constructor Summary
MedianFilter(double[] data, int window)
          Create an instance, obtaining the median in a region window elements wide about each input position.
 
Method Summary
protected  double[] doCalc(double[] data, int window)
          Perform the median filtering of array using a region of size window about each position.
 double[] eval()
          Get the averaged data.
 int getWindow()
          Get the number of values used in the averaging window.
 void setData(double[] data)
          Set the data to be used for input to the averaging calculations.
 void setWindow(int window)
          Set the window to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MedianFilter

public MedianFilter(double[] data,
                    int window)
Create an instance, obtaining the median in a region window elements wide about each input position.

Parameters:
data - the array of values to be median filtered.
window - the number of positions that are used for the window. Will be increased to the nearest odd integer and has a minimum value of 3.
Method Detail

setWindow

public void setWindow(int window)
Set the window to use. The value is always set to the next highest odd value and has a minimum of 3.


getWindow

public int getWindow()
Get the number of values used in the averaging window.


setData

public void setData(double[] data)
Set the data to be used for input to the averaging calculations.


eval

public double[] eval()
Get the averaged data.


doCalc

protected double[] doCalc(double[] data,
                          int window)
Perform the median filtering of array using a region of size window about each position. The result is the median filtered array.



Copyright © 2018 Central Laboratory of the Research Councils. All Rights Reserved.