Enum ChannelType
- java.lang.Object
-
- java.lang.Enum<ChannelType>
-
- science.aist.imaging.api.domain.wrapper.ChannelType
-
- All Implemented Interfaces:
Serializable
,Comparable<ChannelType>
public enum ChannelType extends Enum<ChannelType>
Enum with pixel channel types
- Since:
- 1.0
- Author:
- Christoph Praschl
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BGR
BGRA
BINARY
GREYSCALE
HSV
LUV
RGB
RGBA
UNKNOWN
UNKNOWN_2_CHANNEL
UNKNOWN_3_CHANNEL
UNKNOWN_4_CHANNEL
YUV
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getMaxVal(int channel)
Get the max val of the given channeldouble
getMinVal(int channel)
Get the min val of the given channelboolean
isValidValue(double val, int channel)
Checks if the given value is valid for the given channel in this ChannelTypestatic ChannelType
makeChannelType(int channels)
Creates a ChannelType out of the numbers of channelsdouble
scaleFromChannel(double value, int channel, double newMin, double newMax)
Scales the given pixel value of this Channeltype to a new range definedstatic double
scaleToChannel(double value, double oldMin, double oldMax, double newMin, double newMax)
Scales the given pixel value to a new range defineddouble
scaleToChannel(double value, int channel, double oldMin, double oldMax)
Scales the given pixel value to a new range definedstatic ChannelType
valueOf(String name)
Returns the enum constant of this type with the specified name.static ChannelType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
UNKNOWN
public static final ChannelType UNKNOWN
-
UNKNOWN_2_CHANNEL
public static final ChannelType UNKNOWN_2_CHANNEL
-
UNKNOWN_3_CHANNEL
public static final ChannelType UNKNOWN_3_CHANNEL
-
UNKNOWN_4_CHANNEL
public static final ChannelType UNKNOWN_4_CHANNEL
-
GREYSCALE
public static final ChannelType GREYSCALE
-
BINARY
public static final ChannelType BINARY
-
BGR
public static final ChannelType BGR
-
RGB
public static final ChannelType RGB
-
HSV
public static final ChannelType HSV
-
BGRA
public static final ChannelType BGRA
-
RGBA
public static final ChannelType RGBA
-
LUV
public static final ChannelType LUV
-
YUV
public static final ChannelType YUV
-
-
Method Detail
-
values
public static ChannelType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ChannelType c : ChannelType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ChannelType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-
makeChannelType
public static ChannelType makeChannelType(int channels)
Creates a ChannelType out of the numbers of channels- Parameters:
channels
- the number of channels- Returns:
- the channel type matching the number of channels
-
isValidValue
public boolean isValidValue(double val, int channel)
Checks if the given value is valid for the given channel in this ChannelType- Parameters:
val
- to be checkedchannel
- in which channel is checked- Returns:
- true iff value is valid for the channel
-
getMinVal
public double getMinVal(int channel)
Get the min val of the given channel- Parameters:
channel
- channel to get value- Returns:
- the min value for the channel
-
getMaxVal
public double getMaxVal(int channel)
Get the max val of the given channel- Parameters:
channel
- channel to get value- Returns:
- the max value for the channel
-
scaleToChannel
public double scaleToChannel(double value, int channel, double oldMin, double oldMax)
Scales the given pixel value to a new range defined- Parameters:
value
- current value to be scaledchannel
- channel position of the valueoldMin
- min value of the old range associated with the current valueoldMax
- max value of the old range associated with the current value- Returns:
- pixel value within the current ChannelType definition
- Since:
- 2.0
-
scaleFromChannel
public double scaleFromChannel(double value, int channel, double newMin, double newMax)
Scales the given pixel value of this Channeltype to a new range defined- Parameters:
value
- current value to be scaledchannel
- channel position of the valuenewMin
- min value of the target range associated with the resulting valuenewMax
- max value of the target range associated with the resulting value- Returns:
- pixel value within the current ChannelType definition
- Since:
- 2.0
-
scaleToChannel
public static double scaleToChannel(double value, double oldMin, double oldMax, double newMin, double newMax)
Scales the given pixel value to a new range defined- Parameters:
value
- current value to be scaledoldMin
- min value of the old range associated with the current valueoldMax
- max value of the old range associated with the current valuenewMin
- min value of the new range associated with the resulting valuenewMax
- max value of the new range associated with the resulting value- Returns:
- pixel value within the given target range
- Since:
- 2.0
-
-