public class Binarise extends BasicKernel
This type of Kernel
sets values in the output array to either
0
or 1
, based on whether the corresponding values
in the input array are above or below a user-defined threshold
.
Note: running Binarise(1) on the result of Uniform(n).applyTo() yields the same result as Binarise(n).applyTo().
Binarise.TestPolicy
Modifier and Type | Class and Description |
---|---|
static class |
Binarise.TestPolicy
TestPolicy controls the kind of test the
Kernel performs
on the threshold . |
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_THRESHOLD |
static java.lang.String |
GUI_NAME |
static boolean |
HAS_DELAY |
static boolean |
HAS_OOBP |
static boolean |
HAS_WIDTH |
static int |
NR_EXTRA_FIELDS |
static java.lang.String |
SHORT_NAME |
DEFAULT_OOB_POLICY, DEFAULT_WIDTH
Constructor and Description |
---|
Binarise(int theWidth)
Constructs a Binarise
Kernel . |
Modifier and Type | Method and Description |
---|---|
double[] |
applyTo(double[] theInput)
Deprecated.
|
double[] |
applyTo(double[] theInput,
int theDelay)
Apply the kernel to the specified array, with the specified delay.
|
java.lang.String |
getGuiText()
Deprecated.
|
boolean |
getHasDelay()
Deprecated.
|
boolean |
getHasOOBP()
Deprecated.
|
boolean |
getHasWidth()
Deprecated.
|
int |
getNrExtraFields()
Deprecated.
|
java.lang.String |
getShortText()
Deprecated.
|
Binarise |
setTestPolicy(Binarise.TestPolicy theTestPolicy)
Sets the TestPolicy to be used by this
Kernel . |
Binarise |
setThreshold(double theThreshold)
Sets the
threshold used by this Kernel to
determine whether a value is set to either 0 or
1 , based on the TestPolicy . |
java.lang.String |
toString()
Returns the
String representation of this
Kernel . |
getInfo, getKernel, isValidWidth, setOutOfBoundsPolicy, setWidth
public static final java.lang.String GUI_NAME
public static final java.lang.String SHORT_NAME
public static final boolean HAS_WIDTH
public static final boolean HAS_OOBP
public static final boolean HAS_DELAY
public static final int NR_EXTRA_FIELDS
public static final double DEFAULT_THRESHOLD
public Binarise(int theWidth)
Kernel
.theWidth
- The width
of the Kernel
.setThreshold(double)
,
Binarise.TestPolicy
public Binarise setThreshold(double theThreshold)
threshold
used by this Kernel
to
determine whether a value is set to either 0
or
1
, based on the TestPolicy
.theThreshold
- The threshold
to use.Kernel
.Binarise.TestPolicy
public Binarise setTestPolicy(Binarise.TestPolicy theTestPolicy)
Kernel
.theTestPolicy
- The new TestPolicy
to use.Kernel
.Binarise.TestPolicy
@Deprecated public double[] applyTo(double[] theInput)
BasicKernel
Kernel
to some input array.
Values for which it is not possible to apply the whole
Kernel
are set based on the OutOfBoundsPolicy
.
Note: this method assumes the Kernel
has a positive odd
width
.applyTo
in class BasicKernel
theInput
- The array on which to apply the Kernel
.theInput
,
containing the result of applying the Kernel
to
theInput
, or an empty array if theInput
is
null
.OutOfBoundsPolicy
,
BasicKernel.setWidth(int)
public double[] applyTo(double[] theInput, int theDelay)
AbstractKernel
The delay may be 0
, positive or negative.
For a delay of 0
the values in the return array map
directly to the input array.
For a positive delay of n
the values in the input array
are 'shifted' n
indices to the right.
For a negative delay this 'shift' is to the left.
In general, for kernels for which AbstractKernel.getHasWidth()
returns
true
, the application of the kernel to the head and
tail of the input array is undefined.
This method will fill in the values for which this condition
applies by using the OutOfBoundsPolicy
set for the kernel.
applyTo
in class BasicKernel
theInput
- The array to apply the kernel to.theDelay
- The delay to use.double[]
with the result.@Deprecated public java.lang.String getGuiText()
AbstractKernel
For most kernels this method returns the same result as a call to
kernel.class.getSimpleName()
.
For some, the returned String
will include some
white spaces that beak up the various words, such that it forms
regular text.
getGuiText
in class BasicKernel
String
.@Deprecated public java.lang.String getShortText()
AbstractKernel
getShortText
in class BasicKernel
String
indicative of the class name.@Deprecated public boolean getHasWidth()
AbstractKernel
This is true
for a DiscreteKernel
, and
false
for a ContinuousKernel
.
getHasWidth
in class BasicKernel
true
iff the kernel has a width,
false
otherwise.ContinuousKernel
,
DiscreteKernel
@Deprecated public boolean getHasOOBP()
AbstractKernel
OutOfBoundsPolicy
.
This is true
for a DiscreteKernel
, and
false
for a ContinuousKernel
.
getHasOOBP
in class BasicKernel
true
iff the kernel has an out of
bounds policy, false
otherwise.OutOfBoundsPolicy
,
ContinuousKernel
,
DiscreteKernel
@Deprecated public boolean getHasDelay()
AbstractKernel
This is true
for almost all kernels, but not for
MovingAverage
.
getHasDelay
in class BasicKernel
true
iff a delay can be set for the
kernel, false
otherwise.@Deprecated public int getNrExtraFields()
AbstractKernel
Extra fields hold kernel specific configuration settings, not shared with other kernels.
getNrExtraFields
in class BasicKernel
public java.lang.String toString()
String
representation of this
Kernel
.
In order the items between the braces represent the:
width
, OutOfBoundsPolicy
,
threshold
and TestPolicy
used for this
Kernel
.toString
in class BasicKernel
String
representation of the
Kernel
.