Package org.esa.snap.core.datamodel
Class RGBImageProfile
- java.lang.Object
-
- org.esa.snap.core.datamodel.RGBImageProfile
-
- All Implemented Interfaces:
ConfigurableExtension
public class RGBImageProfile extends Object implements ConfigurableExtension
A profile used for the creation of RGB images. The profile comprises the band arithmetic expressions for the computation of red, green, blue and alpha (optional) channels of the resulting image.
-
-
Field Summary
Fields Modifier and Type Field Description static StringALPHA_BAND_NAMEThe default name for the band providing input for the alpha image channel.static StringBLUE_BAND_NAMEThe default name for the band providing input for the blue image channel.static StringFILENAME_EXTENSIONstatic StringGREEN_BAND_NAMEThe default name for the band providing input for the green image channel.static StringPROPERTY_KEY_ALPHAstatic StringPROPERTY_KEY_BLUEstatic StringPROPERTY_KEY_GREENstatic StringPROPERTY_KEY_INTERNALstatic StringPROPERTY_KEY_NAMEstatic StringPROPERTY_KEY_PREFIX_RGB_PROFILEPreferences key for RGB profile entriesstatic StringPROPERTY_KEY_REDstatic StringRED_BAND_NAMEThe default name for the band providing input for the red image channel.static String[]RGB_BAND_NAMESAn array of 3 strings containing the names for the default red, green and blue bands.static String[]RGBA_BAND_NAMESAn array of 4 strings containing the names for the default red, green, blue and alpha bands.
-
Constructor Summary
Constructors Constructor Description RGBImageProfile(String name, String[] rgbaExpressions)RGBImageProfile(String name, String[] rgbaExpressions, String[] pattern)RGBImageProfile(String name, String[] rgbaExpressions, String[] pattern, Range[] valueRanges)Creates a new RGB profile.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidconfigure(ConfigurationElement config)Deprecated.Not in use anymore.booleanequalExpressions(String[] rgbaExpressions)Deprecated.booleanequalExpressions(RGBImageProfile profile)booleanequals(Object obj)StringgetAlphaExpression()StringgetBlueExpression()RangegetBlueMinMax()static RGBImageProfilegetCurrentProfile(Product product)StringgetGreenExpression()RangegetGreenMinMax()StringgetName()String[]getPattern()voidgetProperties(Properties properties)Sets profile properties and accordingly sets them in the given property map.StringgetRedExpression()RangegetRedMinMax()String[]getRgbaExpressions()RGBChannelDefgetRgbChannelDef()String[]getRgbExpressions()booleanhasAlpha()inthashCode()booleanisApplicableTo(Product product)Tests whether this profile is applicable to the given product.booleanisInternal()booleanisValid()Tests if one of the R,G,B expressions are non-empty strings.static RGBImageProfileloadProfile(File file)Loads a profile from the given file using the Java properties file formatstatic RGBImageProfileloadProfile(URL url)Loads a profile from the given url using the Java properties file formatvoidsetAlphaExpression(String expression)voidsetBlueExpression(String expression)voidsetBlueMinMax(Range range)voidsetGreenExpression(String expression)voidsetGreenMinMax(Range range)voidsetInternal(boolean internal)voidsetName(String name)voidsetPattern(String[] pattern)voidsetProperties(Properties properties)Sets profile properties from the given property map.voidsetRedExpression(String expression)voidsetRedMinMax(Range range)voidsetRgbaExpressions(String[] rgbaExpressions)voidsetRgbExpressions(String[] rgbExpressions)voidstore(File file)Stores this profile in the given file using the Java properties file formatstatic voidstoreRgbaExpressions(Product product, String[] rgbaExpressions)static voidstoreRgbaExpressions(Product product, String[] rgbaExpressions, String[] bandNames)StringtoString()
-
-
-
Field Detail
-
RED_BAND_NAME
public static final String RED_BAND_NAME
The default name for the band providing input for the red image channel.- See Also:
- Constant Field Values
-
GREEN_BAND_NAME
public static final String GREEN_BAND_NAME
The default name for the band providing input for the green image channel.- See Also:
- Constant Field Values
-
BLUE_BAND_NAME
public static final String BLUE_BAND_NAME
The default name for the band providing input for the blue image channel.- See Also:
- Constant Field Values
-
ALPHA_BAND_NAME
public static final String ALPHA_BAND_NAME
The default name for the band providing input for the alpha image channel.- See Also:
- Constant Field Values
-
RGB_BAND_NAMES
public static final String[] RGB_BAND_NAMES
An array of 3 strings containing the names for the default red, green and blue bands.
-
RGBA_BAND_NAMES
public static final String[] RGBA_BAND_NAMES
An array of 4 strings containing the names for the default red, green, blue and alpha bands.
-
FILENAME_EXTENSION
public static final String FILENAME_EXTENSION
- See Also:
- Constant Field Values
-
PROPERTY_KEY_NAME
public static final String PROPERTY_KEY_NAME
- See Also:
- Constant Field Values
-
PROPERTY_KEY_RED
public static final String PROPERTY_KEY_RED
- See Also:
- Constant Field Values
-
PROPERTY_KEY_GREEN
public static final String PROPERTY_KEY_GREEN
- See Also:
- Constant Field Values
-
PROPERTY_KEY_BLUE
public static final String PROPERTY_KEY_BLUE
- See Also:
- Constant Field Values
-
PROPERTY_KEY_ALPHA
public static final String PROPERTY_KEY_ALPHA
- See Also:
- Constant Field Values
-
PROPERTY_KEY_INTERNAL
public static final String PROPERTY_KEY_INTERNAL
- See Also:
- Constant Field Values
-
PROPERTY_KEY_PREFIX_RGB_PROFILE
public static final String PROPERTY_KEY_PREFIX_RGB_PROFILE
Preferences key for RGB profile entries- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RGBImageProfile
public RGBImageProfile(String name, String[] rgbaExpressions, String[] pattern, Range[] valueRanges)
Creates a new RGB profile. In the pattern you can simply use '*' for a sequence of characters or use '?' for a single character. For Example:new String[]{ "MER_*_2*", "MER_*_2*", ""}- Parameters:
name- The name of the profilergbaExpressions- the expressions for the RGBA channels. Only RGB expressions are mandatory, the one for the alpha channel can be missingpattern- Pattern to check if this profile can be applied to a certain product. Three patterns need to be provided. 1. Will be matched against the product type 2. Will be matched against the product name 3. Will be matched against the description of the product
-
-
Method Detail
-
getName
public String getName()
-
setName
public void setName(String name)
-
getRgbChannelDef
public RGBChannelDef getRgbChannelDef()
-
isInternal
public boolean isInternal()
-
setInternal
public void setInternal(boolean internal)
-
equalExpressions
public boolean equalExpressions(RGBImageProfile profile)
-
equalExpressions
@Deprecated public boolean equalExpressions(String[] rgbaExpressions)
Deprecated.This API function exposes internal structure. please use equalExpressions(RGBImageProfile profile)
-
isValid
public boolean isValid()
Tests if one of the R,G,B expressions are non-empty strings.- Returns:
- true, if so
-
getRgbExpressions
public String[] getRgbExpressions()
-
setRgbExpressions
public void setRgbExpressions(String[] rgbExpressions)
-
getRgbaExpressions
public String[] getRgbaExpressions()
-
setRgbaExpressions
public void setRgbaExpressions(String[] rgbaExpressions)
-
getRedExpression
public String getRedExpression()
-
setRedExpression
public void setRedExpression(String expression)
-
getGreenExpression
public String getGreenExpression()
-
setGreenExpression
public void setGreenExpression(String expression)
-
getBlueExpression
public String getBlueExpression()
-
setBlueExpression
public void setBlueExpression(String expression)
-
getAlphaExpression
public String getAlphaExpression()
-
setAlphaExpression
public void setAlphaExpression(String expression)
-
hasAlpha
public boolean hasAlpha()
-
getPattern
public String[] getPattern()
-
setPattern
public void setPattern(String[] pattern)
-
isApplicableTo
public boolean isApplicableTo(Product product)
Tests whether this profile is applicable to the given product. With other words, the method tests if an RGB image can be created from the given product.- Parameters:
product- the product- Returns:
- true, if so
-
getCurrentProfile
public static RGBImageProfile getCurrentProfile(Product product)
-
loadProfile
public static RGBImageProfile loadProfile(File file) throws IOException
Loads a profile from the given file using the Java properties file format- Parameters:
file- the file- Returns:
- the profile, never null
- Throws:
IOException- if an I/O error occurs- See Also:
setProperties(java.util.Properties)
-
loadProfile
public static RGBImageProfile loadProfile(URL url) throws IOException
Loads a profile from the given url using the Java properties file format- Parameters:
url- the url- Returns:
- the profile, never null
- Throws:
IOException- if an I/O error occurs- See Also:
setProperties(java.util.Properties)
-
store
public void store(File file) throws IOException
Stores this profile in the given file using the Java properties file format- Parameters:
file- the file- Throws:
IOException- if an I/O error occurs- See Also:
getProperties(java.util.Properties)
-
getProperties
public void getProperties(Properties properties)
Sets profile properties and accordingly sets them in the given property map.- Parameters:
properties- the property map which receives the properties of this profiles
-
setProperties
public void setProperties(Properties properties)
Sets profile properties from the given property map.- Parameters:
properties- the property map which provides the properties for this profiles
-
storeRgbaExpressions
public static void storeRgbaExpressions(Product product, String[] rgbaExpressions)
-
storeRgbaExpressions
public static void storeRgbaExpressions(Product product, String[] rgbaExpressions, String[] bandNames)
-
configure
@Deprecated public void configure(ConfigurationElement config) throws CoreException
Deprecated.Not in use anymore. Was used in BEAM. Might be removed in the future. Deprecated since SNAP 9.Description copied from interface:ConfigurableExtensionConfigures this extension with the supplied configuration data.- Specified by:
configurein interfaceConfigurableExtension- Parameters:
config- The configuration data.- Throws:
CoreException- if an error occurred during configuration.
-
setRedMinMax
public void setRedMinMax(Range range)
-
getRedMinMax
public Range getRedMinMax()
-
setGreenMinMax
public void setGreenMinMax(Range range)
-
getGreenMinMax
public Range getGreenMinMax()
-
setBlueMinMax
public void setBlueMinMax(Range range)
-
getBlueMinMax
public Range getBlueMinMax()
-
-