private static Band findBand(final Band[] bands, final String refStr) { for (Band b : bands) { if (b.getProduct().getProductRefString().equals(refStr)) return b; } return null; } }
private boolean bandsAndGridsFromMoreThanOneProduct(Band[] allBands, TiePointGrid[] allTiePointGrids) { Set<Product> productSet = new HashSet<>(); if (allBands != null) { for (Band allBand : allBands) { productSet.add(allBand.getProduct()); } } if (allTiePointGrids != null) { for (TiePointGrid allTiePointGrid : allTiePointGrids) { productSet.add(allTiePointGrid.getProduct()); } } return productSet.size() > 1; }
@Override public void destroy() throws IOException { deleteProductNode(getProductNode().getProduct(), getProductNode().getProduct().getBandGroup(), getProductNode()); }
@Override public void writeBandRasterData(Band sourceBand, int sourceOffsetX, int sourceOffsetY, int sourceWidth, int sourceHeight, ProductData sourceBuffer, ProgressMonitor pm) throws IOException { final Product sourceProduct = sourceBand.getProduct(); final int numBands = sourceProduct.getNumBands(); boolean shouldFinalize = numBands == processedCount.get(); if (!shouldFinalize) { if (!this.processedBands.containsKey(sourceBand)) { this.processedBands.put(sourceBand, getScaledImage(sourceBand)); processedCount.incrementAndGet(); shouldFinalize = numBands == processedCount.get(); } if (shouldFinalize) { finalizeWrite(); } } }
private void writeFileHeader(PrintWriter out, Band[] bands) { ProductData.UTC utc = ProductData.UTC.create(new Date(), 0); out.printf("# Exported transect on %s%n", utc.format()); if (bands.length >= 0) { Product product = bands[0].getProduct(); out.printf("# Product name: %s%n", product.getName()); if (product.getFileLocation() != null) { out.printf("# Product file location: %s%n", product.getFileLocation().getAbsolutePath()); } } out.println(); }
public ProductNodeGroup<Placemark> getGcpGroup(final Band band) { ProductNodeGroup<Placemark> gcpGroup = bandGCPGroup.get(createKey(band)); if(gcpGroup == null) { gcpGroup = new ProductNodeGroup<>(band.getProduct(), "ground_control_points", true); bandGCPGroup.put(createKey(band), gcpGroup); } return gcpGroup; }
private String createKey(final Band band) { return band.getProduct().getName() +'_'+band.getName(); }
private Band[] getSelectedBands() { if (userSelectedBands == null || userSelectedBands.length == 0 || userSelectedBands[0].getProduct() == null) { // create defaults if (currentView != null) { final RasterDataNode currentRaster = currentView.getRaster(); if (currentRaster != null) { final Band band = currentProduct.getBand(currentRaster.getName()); if (band != null) { userSelectedBands = new Band[]{band}; } } } } return userSelectedBands; }
@Override public void actionPerformed(ActionEvent event) { final ProductNode node = SnapApp.getDefault().getSelectedProductNode(EXPLORER); if (node instanceof Band) { final Band band = (Band) node; final Product product = band.getProduct(); ScaleDataDialog dlg = new ScaleDataDialog("Scaling Data", product, band); dlg.show(); } }
@Override public void actionPerformed(ActionEvent event) { final ProductNode productNode = lkp.lookup(ProductNode.class); if (productNode != null && productNode instanceof Band) { final Band band = (Band) productNode; final Product product = band.getProduct(); final String unit = band.getUnit(); if (!unit.contains(Unit.DB)) { if (Dialogs.requestDecision("Convert to dB", "Would you like to convert band " + band.getName() + " into dB in a new virtual band?", true, null) == Dialogs.Answer.YES) { convert(product, band, true); } } else { if (Dialogs.requestDecision("Convert to linear", "Would you like to convert band " + band.getName() + " into linear in a new virtual band?", true, null) == Dialogs.Answer.YES) { convert(product, band, false); } } } }
if (productNode != null && productNode instanceof Band) { final Band band = (Band) productNode; final Product product = band.getProduct(); String bandName = band.getName(); final String unit = band.getUnit();
if (productNode != null && productNode instanceof Band) { final Band band = (Band) productNode; final Product product = band.getProduct(); String bandName = band.getName(); final String unit = band.getUnit();
public int getIndex(final Band band) { final Product product = band.getProduct(); if (StackUtils.isCoregisteredStack(product)) { ProductData.UTC slaveTime = getSlaveTime(product, band); if(slaveTime != null) { return getIndex(slaveTime); } if (foundInMaster(product, band)) { return 0; } } return getIndex(product.getStartTime()); }
if (productNode != null && productNode instanceof Band) { final Band band = (Band) productNode; final Product product = band.getProduct(); String bandName = band.getName(); final String unit = band.getUnit();
if (bandInfo != null && bandInfo.img != null) { Product product = destBand.getProduct();
final int sourceMaxY = sourceOffsetY + sourceHeight - 1; final long sourceRasterWidth = destBand.getProduct().getSceneRasterWidth();
@Override protected void readBandRasterDataImpl(int sourceOffsetX, int sourceOffsetY, int sourceWidth, int sourceHeight, int sourceStepX, int sourceStepY, Band destBand, int destOffsetX, int destOffsetY, int destWidth, int destHeight, ProductData destBuffer, ProgressMonitor pm) throws IOException { final int sourceMaxY = sourceOffsetY + sourceHeight - 1; Product product = destBand.getProduct(); final int elemSize = destBuffer.getElemSize(); final int bandIndex = product.getBandIndex(destBand.getName()); final long lineSizeInBytes = (long)metadata.getRasterWidth() * (long)metadata.getRasterPixelSize(); int numBands = product.getNumBands(); pm.beginTask("Reading band '" + destBand.getName() + "'...", sourceMaxY - sourceOffsetY); try { int destPos = 0; for (int sourceY = sourceOffsetY; sourceY <= sourceMaxY; sourceY += sourceStepY) { if (pm.isCanceled()) { break; } synchronized (sharedLock) { long lineStartPos = sourceY * numBands * lineSizeInBytes + bandIndex * lineSizeInBytes; imageInputStream.seek(lineStartPos + elemSize * sourceOffsetX); destBuffer.readFrom(destPos, destWidth, imageInputStream); destPos += destWidth; } pm.worked(1); } } finally { pm.done(); } }
Product product = destBand.getProduct(); final int elemSize = destBuffer.getElemSize();
cloudCoding.addIndex("invalid", 10000, ""); targetBandCloudShadow.setSampleCoding(cloudCoding); targetBandCloudShadow.getProduct().getIndexCodingGroup().add(cloudCoding);
Product product = computedBand.getProduct(); ProductSceneViewTopComponent topComponent = getProductSceneViewTopComponent(computedBand); if (topComponent != null) {