本文整理汇总了Java中org.esa.snap.core.datamodel.RGBImageProfileManager类的典型用法代码示例。如果您正苦于以下问题:Java RGBImageProfileManager类的具体用法?Java RGBImageProfileManager怎么用?Java RGBImageProfileManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RGBImageProfileManager类属于org.esa.snap.core.datamodel包,在下文中一共展示了RGBImageProfileManager类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: installRgbProfiles
import org.esa.snap.core.datamodel.RGBImageProfileManager; //导入依赖的package包/类
public static void installRgbProfiles(String productType, String redExpr, String greenExpr, String blueExpr) {
RGBImageProfileManager profileManager = RGBImageProfileManager.getInstance();
RGBImageProfile[] allProfiles = profileManager.getAllProfiles();
for (String bandName : RGB_BAND_NAMES) {
String profileName = productType + " " + bandName;
Stream<RGBImageProfile> profileStream = Arrays.stream(allProfiles);
boolean profileExists = profileStream.anyMatch(rgbImageProfile -> rgbImageProfile.getName().equals(profileName));
if (!profileExists) {
String[] rgbaExpressions = {
String.format(redExpr, bandName),
String.format(greenExpr, bandName),
String.format(blueExpr, bandName)};
String[] pattern = {productType, "", ""};
profileManager.addProfile(new RGBImageProfile(profileName, rgbaExpressions, pattern));
}
}
}
示例2: S2OrthoProductReaderPlugIn
import org.esa.snap.core.datamodel.RGBImageProfileManager; //导入依赖的package包/类
public S2OrthoProductReaderPlugIn() {
RGBImageProfileManager manager = RGBImageProfileManager.getInstance();
manager.addProfile(new RGBImageProfile("Sentinel 2 MSI Natural Colors", new String[]{"B4", "B3", "B2"}));
manager.addProfile(new RGBImageProfile("Sentinel 2 MSI False-color Infrared", new String[]{"B8", "B4", "B3"}));
manager.addProfile(new RGBImageProfile("Sentinel 2 MSI False-color Urban", new String[]{"B12", "B11", "B4"}));
manager.addProfile(new RGBImageProfile("Sentinel 2 MSI Agriculture", new String[]{"B11", "B8", "B2"}));
manager.addProfile(new RGBImageProfile("Sentinel 2 MSI Atmospheric penetration", new String[]{"B12", "B11", "B8A"}));
manager.addProfile(new RGBImageProfile("Sentinel 2 MSI Healthy Vegetation", new String[]{"B8", "B11", "B2"}));
manager.addProfile(new RGBImageProfile("Sentinel 2 MSI Land/Water", new String[]{"B8", "B11", "B4"}));
manager.addProfile(new RGBImageProfile("Sentinel 2 MSI Natural with Atmospherical Removal", new String[]{"B12", "B8", "B3"}));
manager.addProfile(new RGBImageProfile("Sentinel 2 MSI Shortwave Infrared", new String[]{"B12", "B8", "B4"}));
manager.addProfile(new RGBImageProfile("Sentinel 2 MSI Vegetation Analysis", new String[]{"B11", "B8", "B4"}));
}
示例3: performSaveAs
import org.esa.snap.core.datamodel.RGBImageProfileManager; //导入依赖的package包/类
private void performSaveAs() {
File file = promptForSaveFile();
if (file == null) {
return;
}
String[] rgbaExpressions = getRgbaExpressions();
Set<Integer> productRefs = new HashSet<>();
for (String expression : rgbaExpressions) {
if (!StringUtils.isNullOrEmpty(expression)) {
if (expression.startsWith("$")) {
productRefs.add(Integer.parseInt(expression.substring(1, expression.indexOf('.'))));
} else {
productRefs.add(0);
}
}
}
boolean shouldReplace = productRefs.size() == 1 && !productRefs.contains(0);
for (int i = 0; i < rgbaExpressions.length; i++) {
if (shouldReplace) {
rgbaExpressions[i] = rgbaExpressions[i].replace(BandArithmetic.getProductNodeNamePrefix(this.product), "");
}
}
RGBImageProfile profile = new RGBImageProfile(FileUtils.getFilenameWithoutExtension(file),
rgbaExpressions);
try {
profile.store(file);
} catch (IOException e) {
AbstractDialog.showErrorDialog(this,
"Failed to save RGB-profile '" + file.getName() + "':\n"
+ e.getMessage(),
"Open RGB-Image Profile");
return;
}
RGBImageProfileManager.getInstance().addProfile(profile);
addNewProfile(profile);
}
示例4: getProfilesDir
import org.esa.snap.core.datamodel.RGBImageProfileManager; //导入依赖的package包/类
private File getProfilesDir() {
if (lastDir != null) {
return lastDir;
} else {
return RGBImageProfileManager.getProfilesDir();
}
}
示例5: registerRGBProfile
import org.esa.snap.core.datamodel.RGBImageProfileManager; //导入依赖的package包/类
@Override
protected void registerRGBProfile() {
RGBImageProfileManager.getInstance().addProfile(new RGBImageProfile("RapidEye L3", new String[] { "red", "green", "blue" }));
}
示例6: registerRGBProfile
import org.esa.snap.core.datamodel.RGBImageProfileManager; //导入依赖的package包/类
@Override
protected void registerRGBProfile() {
RGBImageProfileManager.getInstance().addProfile(new RGBImageProfile("RapidEye L1", new String[] { "red", "green", "blue" }));
}
示例7: registerRGBProfile
import org.esa.snap.core.datamodel.RGBImageProfileManager; //导入依赖的package包/类
@Override
protected void registerRGBProfile() {
RGBImageProfileManager.getInstance().addProfile(new RGBImageProfile("Pleaides", Constants.RGB_PROFILE));
}
示例8: registerRGBProfile
import org.esa.snap.core.datamodel.RGBImageProfileManager; //导入依赖的package包/类
@Override
protected void registerRGBProfile() {
RGBImageProfileManager.getInstance().addProfile(new RGBImageProfile("DEIMOS-1", new String[] { "Red", "Green", "NIR" }));
}
示例9: registerRGBProfile
import org.esa.snap.core.datamodel.RGBImageProfileManager; //导入依赖的package包/类
@Override
protected void registerRGBProfile() {
RGBImageProfileManager.getInstance().addProfile(new RGBImageProfile("SPOT", new String[] { "XS1", "XS2", "XS3" }));
}
示例10: registerRGBProfile
import org.esa.snap.core.datamodel.RGBImageProfileManager; //导入依赖的package包/类
@Override
protected void registerRGBProfile() {
RGBImageProfileManager.getInstance().addProfile(new RGBImageProfile("SPOT 6/7", Spot6Constants.SPOT6_RGB_PROFILE));
}
示例11: performOpen
import org.esa.snap.core.datamodel.RGBImageProfileManager; //导入依赖的package包/类
private void performOpen() {
final SnapFileChooser snapFileChooser = new SnapFileChooser(getProfilesDir());
snapFileChooser.setFileFilter(
new SnapFileFilter("RGB-PROFILE", RGBImageProfile.FILENAME_EXTENSION, "RGB-Image Profile Files"));
final int status = snapFileChooser.showOpenDialog(this);
if (snapFileChooser.getSelectedFile() == null) {
return;
}
final File file = snapFileChooser.getSelectedFile();
lastDir = file.getParentFile();
if (status != SnapFileChooser.APPROVE_OPTION) {
return;
}
final RGBImageProfile profile;
try {
profile = RGBImageProfile.loadProfile(file);
String[] rgbaExpressions = profile.getRgbaExpressions();
// If profile was saved with a single product index reference, it may not match the current product index,
// so try to replace it. If it contains multiple indices, then keep them.
Set<Integer> productRefs = new HashSet<>();
for (String expression : rgbaExpressions) {
if (!StringUtils.isNullOrEmpty(expression)) {
if (expression.startsWith("$")) {
productRefs.add(Integer.parseInt(expression.substring(1, expression.indexOf('.'))));
} else {
productRefs.add(0);
}
}
}
boolean shouldReplace = productRefs.size() == 1 && !productRefs.contains(0);
for (int i = 0; i < rgbaExpressions.length; i++) {
if (shouldReplace) {
if (!StringUtils.isNullOrEmpty(rgbaExpressions[i])) {
rgbaExpressions[i] = rgbaExpressions[i].substring(rgbaExpressions[i].indexOf('.') + 1);
}
}
}
profile.setRgbaExpressions(rgbaExpressions);
} catch (IOException e) {
AbstractDialog.showErrorDialog(this,
String.format("Failed to open RGB-profile '%s':\n%s", file.getName(), e.getMessage()),
"Open RGB-Image Profile");
return;
}
if (profile == null) {
AbstractDialog.showErrorDialog(this,
String.format("Invalid RGB-Profile '%s'.", file.getName()),
"Open RGB-Image Profile");
return;
}
RGBImageProfileManager.getInstance().addProfile(profile);
if (product != null && !profile.isApplicableTo(product)) {
AbstractDialog.showErrorDialog(this,
String.format("The selected RGB-Profile '%s'\nis not applicable to the current product.",
profile.getName()),
"Open RGB-Image Profile");
return;
}
addNewProfile(profile);
}