Package com.xinapse.image
Enum Class BoundaryCondition
- All Implemented Interfaces:
Serializable
,Comparable<BoundaryCondition>
,Constable
An enumeration of possible boundary conditions when applying, for example, spatial filters and
interpolators.
The
BoundaryCondition
determines the behaviour when accessing values outside the
array of pixel values (e.g., when filtering images, it determines the filtered pixel values
that are near the boundary of the image).
The examples given for each boundary condition illustrate the behaviour for 1-D kernel filter with a kernel of width 5. An array of pixel values on the left behaves as the array on the right when that boundary condition is applied.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionUse a fixed value, for example if zero is used: [1 2 3 4 5] → [0 0 1 2 3 4 5 0 0].Use the value at the boundary: [1 2 3 4 5] → [1 1 1 2 3 4 5 5 5].Periodically replicate the array: [1 2 3 4 5] → [4 5 1 2 3 4 5 1 2].Reflect the array at the boundary: [1 2 3 4 5] → [2 1 1 2 3 4 5 5 4]. -
Method Summary
Modifier and TypeMethodDescriptionint
getIndex
(int i, int size) For thisBoundaryCondition
, returns the index into an array of values for an index that is possibly outside the array of values.static BoundaryCondition
getInstance
(String bc) Returns theBoundaryCondition
corresponding to the supplied string.static void
Runs the self-test for this class.static BoundaryCondition
Returns the enum constant of this class with the specified name.static BoundaryCondition[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NEAREST
Use the value at the boundary: [1 2 3 4 5] → [1 1 1 2 3 4 5 5 5]. -
PERIODIC
Periodically replicate the array: [1 2 3 4 5] → [4 5 1 2 3 4 5 1 2]. Also known as a "circulant" boundary condition. -
REFLECT
Reflect the array at the boundary: [1 2 3 4 5] → [2 1 1 2 3 4 5 5 4]. -
FIXED
Use a fixed value, for example if zero is used: [1 2 3 4 5] → [0 0 1 2 3 4 5 0 0].
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
getInstance
Returns theBoundaryCondition
corresponding to the supplied string.- Parameters:
bc
- aString
which is one of "NEAREST", "PERIODIC", "REFLECT", or "FIXED".- Returns:
- the
BoundaryCondition
corresponding to the supplied string. - Throws:
IllegalArgumentException
- ifbc
does not match any of these,
-
getIndex
public int getIndex(int i, int size) For thisBoundaryCondition
, returns the index into an array of values for an index that is possibly outside the array of values.- Parameters:
i
- the index.size
- the size of the array.- Returns:
- the index that is inside the array of values according to the
BoundaryCondition
. ForFIXED
, -1 is returned if the the supplied index is less than zero, or size if the the supplied index is greater than or equal tosize
. - Throws:
IllegalArgumentException
- ifsize
is not positive.
-
main
Runs the self-test for this class.- Parameters:
args
- ignored.
-