當前位置: 首頁>>代碼示例>>Java>>正文


Java RGBImageProfileManager類代碼示例

本文整理匯總了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));
        }
    }
}
 
開發者ID:bcdev,項目名稱:s3tbx-c2rcc,代碼行數:18,代碼來源:RgbProfiles.java

示例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"}));
}
 
開發者ID:senbox-org,項目名稱:s2tbx,代碼行數:14,代碼來源:S2OrthoProductReaderPlugIn.java

示例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);
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:38,代碼來源:RGBImageProfilePane.java

示例4: getProfilesDir

import org.esa.snap.core.datamodel.RGBImageProfileManager; //導入依賴的package包/類
private File getProfilesDir() {
    if (lastDir != null) {
        return lastDir;
    } else {
        return RGBImageProfileManager.getProfilesDir();
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:8,代碼來源:RGBImageProfilePane.java

示例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" }));
}
 
開發者ID:senbox-org,項目名稱:s2tbx,代碼行數:5,代碼來源:RapidEyeL3ReaderPlugin.java

示例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" }));
}
 
開發者ID:senbox-org,項目名稱:s2tbx,代碼行數:5,代碼來源:RapidEyeL1ReaderPlugin.java

示例7: registerRGBProfile

import org.esa.snap.core.datamodel.RGBImageProfileManager; //導入依賴的package包/類
@Override
protected void registerRGBProfile() {
    RGBImageProfileManager.getInstance().addProfile(new RGBImageProfile("Pleaides", Constants.RGB_PROFILE));
}
 
開發者ID:senbox-org,項目名稱:s2tbx,代碼行數:5,代碼來源:PleiadesProductReaderPlugin.java

示例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" }));
}
 
開發者ID:senbox-org,項目名稱:s2tbx,代碼行數:5,代碼來源:DeimosProductReaderPlugin.java

示例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" }));
}
 
開發者ID:senbox-org,項目名稱:s2tbx,代碼行數:5,代碼來源:SpotTake5ProductReaderPlugin.java

示例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));
}
 
開發者ID:senbox-org,項目名稱:s2tbx,代碼行數:5,代碼來源:Spot6ProductReaderPlugin.java

示例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);
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:63,代碼來源:RGBImageProfilePane.java


注:本文中的org.esa.snap.core.datamodel.RGBImageProfileManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。