private Band findReferenceBand(Product product, int width) { Band referenceBand = null; for (Band band : product.getBands()) { if (band.getRasterWidth() == width) { referenceBand = band; break; } } return referenceBand; }
private Band findReferenceBand(Product product, int width) { Band referenceBand = null; for (Band band : product.getBands()) { if (band.getRasterWidth() == width) { referenceBand = band; break; } } return referenceBand; }
public WriteMaskTilesComputing(Band band, int tileWidth, int tileHeight, Path temporaryParentFolder) throws IOException { super(band.getRasterWidth(), band.getRasterHeight(), tileWidth, tileHeight, temporaryParentFolder); this.band = band; }
private void updateReferenceBandTargetWidthAndHeight() { if (referenceBandNameBox.getSelectedItem() != null) { final String bandName = referenceBandNameBox.getSelectedItem().toString(); final Band band = sourceProducts[0].getBand(bandName); referenceBandTargetWidthLabel.setText("" + band.getRasterWidth()); referenceBandTargetHeightLabel.setText("" + band.getRasterHeight()); } }
/** * The only (package protected) constructor of the cell. * A cell is not intended to be created but only by a <code>BandMatrix</code> object. * * @param band The associated band * @param origin The origin point (coordinates expressed in meters) of the image * @param stepX The horizontal pixel size (in meters) * @param stepY The vertical pixel size (in meters) */ BandMatrixCell(Band band, Point2D origin, double stepX, double stepY) { this.band = band; this.origin = origin; this.dX = stepX; this.dY = stepY; if (band != null) { this.cellPixelWidth = band.getRasterWidth(); this.cellPixelHeight = band.getRasterHeight(); } this.cellWidth = (double) cellPixelWidth * dX; this.cellHeight = (double) cellPixelHeight * dY; }
private void updateReferenceBandTargetWidthAndHeight() { if (referenceBandNameBox.getSelectedItem() != null) { final String bandName = referenceBandNameBox.getSelectedItem().toString(); final Band band = ioParametersPanel.getSourceProductSelectorList().get(0).getSelectedProduct().getBand(bandName); referenceBandTargetWidthLabel.setText("" + band.getRasterWidth()); referenceBandTargetHeightLabel.setText("" + band.getRasterHeight()); } }
protected void writeEnviHeader(Band band) throws IOException { EnviHeader.createPhysicalFile(getEnviHeaderFile(band), band, band.getRasterWidth(), band.getRasterHeight(), 0); }
private void writeEnviHeader(Band band) throws IOException { EnviHeader.createPhysicalFile(getEnviHeaderFile(band), band, band.getRasterWidth(), band.getRasterHeight()); }
private String createToolTip(final Band band) { StringBuilder tooltip = new StringBuilder(); append(tooltip, band.getDescription()); if (band.getSpectralWavelength() > 0.0) { append(tooltip, String.format("%s nm", band.getSpectralWavelength())); if (band.getSpectralBandwidth() > 0.0) { append(tooltip, String.format("+/-%s nm", 0.5 * band.getSpectralBandwidth())); } } append(tooltip, String.format("%d x %d pixels", band.getRasterWidth(), band.getRasterHeight())); if (band instanceof VirtualBand) { append(tooltip, String.format("Expr.: %s", ((VirtualBand) band).getExpression())); } if (band.getUnit() != null) { append(tooltip, String.format(" (%s)", band.getUnit())); } return tooltip.toString(); }
private synchronized void writeProjectedDEM() { if(projectedDEMWritten) return; try { writeHeader(projectedDEMInfo); final Band elevationBand = projectedDEM.getElevationBand(); final Rectangle trgRect = new Rectangle(0, 0, elevationBand.getRasterWidth(), elevationBand.getRasterHeight()); projectedDEM.computeTile(trgRect); final ProductData rawSamples = elevationBand.getData(); projectedDEMInfo.productWriter.writeBandRasterData(elevationBand, trgRect.x, trgRect.y, trgRect.width, trgRect.height, rawSamples, ProgressMonitor.NULL); } catch (Exception e) { e.printStackTrace(); } projectedDEMWritten = true; }
private synchronized void writeTile(final SubsetInfo info, final Rectangle trgRect) throws IOException { if (info.written) return; for(Band trgBand : info.subsetProduct.getBands()) { final String oldBandName = info.newBandNamingMap.get(trgBand.getName()); final Tile sourceTile = getSourceTile(sourceProduct.getBand(oldBandName), trgRect); final ProductData rawSamples = sourceTile.getRawSamples(); //final String newBandName = StackUtils.getBandNameWithoutDate(bandName); info.productWriter.writeBandRasterData(trgBand, 0, 0, trgBand.getRasterWidth(), trgBand.getRasterHeight(), rawSamples, ProgressMonitor.NULL); } info.written = true; }
private float[][] getSpectrum(final int currentRec, final boolean getReal) throws Exception { final Band rasterNode = getBand(currentRec, getReal); rasterNode.loadRasterData(); final float[] dataset = new float[rasterNode.getRasterWidth() * rasterNode.getRasterHeight()]; rasterNode.getPixels(0, 0, rasterNode.getRasterWidth(), rasterNode.getRasterHeight(), dataset); minValue = (float) rasterNode.getStx().getMinimum(); maxValue = (float) rasterNode.getStx().getMaximum(); final float spectrum[][] = new float[numDirBins][numWLBins]; int index = 0; for (int i = 0; i < numDirBins; i++) { for (int j = 0; j < numWLBins; j++) { spectrum[i][j] = dataset[index++]; } } return spectrum; }
private GeoCoding addTiePointGridGeo(Kompsat2Metadata metadata, Band targetBand) { float[][] cornerLonsLats = metadata.getMetadataComponent().getTiePointGridPoints(); int sceneWidth = targetBand.getRasterWidth(); int sceneHeight = targetBand.getRasterHeight(); TiePointGrid latGrid = createTiePointGrid(Kompsat2Constants.LAT_DS_NAME, 2, 2, 0, 0, sceneWidth , sceneHeight, cornerLonsLats[0]); TiePointGrid lonGrid = createTiePointGrid(Kompsat2Constants.LON_DS_NAME, 2, 2, 0, 0, sceneWidth, sceneHeight, cornerLonsLats[1]); return new TiePointGeoCoding(latGrid, lonGrid); }
private synchronized void writeTile(final SubsetInfo info, final String bandName, final Rectangle trgRect) throws IOException { final Tile sourceTile = getSourceTile(sourceProduct.getBand(bandName), trgRect); final ProductData rawSamples = sourceTile.getRawSamples(); final Band trgBand = info.product.getBand(bandName); info.productWriter.writeBandRasterData(trgBand, 0, 0, trgBand.getRasterWidth(), trgBand.getRasterHeight(), rawSamples, ProgressMonitor.NULL); }
/** * Returns the rotation angle of otherCell relative to the current cell. * @param otherCell The second cell to get the rotation from. * @return The angle value (radians) */ public double rotation(BandMatrixCell otherCell) { Assert.notNull(otherCell); Assert.notNull(otherCell.band); double angle = 0.0; GeoCoding otherGeoCoding = otherCell.band.getGeoCoding(); if (otherGeoCoding != null) { GeoPos brCorner = new GeoPos(); otherGeoCoding.getGeoPos(new PixelPos(otherCell.band.getRasterWidth() - 1, otherCell.band.getRasterHeight() - 1), brCorner); angle = (brCorner.getLat() - otherCell.origin.getY()) / (brCorner.getLon() - otherCell.origin.getX()); } return angle; } }
public static void createVirtualIntensityBand(final Product product, final Band band, final String countStr) { final String expression = band.getName() + " * " + band.getName(); final VirtualBand virtBand = new VirtualBand("Intensity" + countStr, ProductData.TYPE_FLOAT32, band.getRasterWidth(), band.getRasterHeight(), expression); virtBand.setUnit(Unit.INTENSITY); virtBand.setDescription("Intensity from complex data"); virtBand.setNoDataValueUsed(true); product.addBand(virtBand); }
public static void convert(final Product product, final String iBandName, final String qBandName, final String phaseBandName) { final Band iBand = product.getBand(iBandName); final String expression = "atan2(" + qBandName + ',' + iBandName + ')'; final VirtualBand virtBand = new VirtualBand(phaseBandName, ProductData.TYPE_FLOAT32, iBand.getRasterWidth(), iBand.getRasterHeight(), expression); virtBand.setUnit(Unit.PHASE); virtBand.setDescription("Phase from complex data"); virtBand.setNoDataValueUsed(true); virtBand.setOwner(product); product.addBand(virtBand); }
public static void convert(final Product product, final String iBandName, final String qBandName, final String targetBandName) { final Band iBand = product.getBand(iBandName); final String expression = iBandName + " * " + iBandName + " + " + qBandName + " * " + qBandName; final VirtualBand virtBand = new VirtualBand(targetBandName, ProductData.TYPE_FLOAT32, iBand.getRasterWidth(), iBand.getRasterHeight(), expression); virtBand.setUnit(Unit.INTENSITY); virtBand.setDescription("Intensity from complex data"); virtBand.setNoDataValueUsed(true); virtBand.setOwner(product); product.addBand(virtBand); }
ReprojectionSettingsProvider(ImageGeometry targetImageGeometry) { boolean rastersEqualInSize=true; if (ProductUtils.areRastersEqualInSize(sourceProduct.getBands())) { for(Band sourceBand:sourceProduct.getBands()){ if(sourceBand.getRasterHeight() != sourceProduct.getSceneRasterHeight()|| sourceBand.getRasterWidth() != sourceProduct.getSceneRasterWidth() ){ rastersEqualInSize = false; } } if(rastersEqualInSize) { provider = new DefaultReprojectionSettingsProvider(targetImageGeometry); }else{ provider = new MultiResolutionReprojectionSettingsProvider(); } } else { provider = new MultiResolutionReprojectionSettingsProvider(); } }
private Band createTargetBand(int levels,String[] bandNames, int index, HashMap<Product, String> tiles, TileComponent tileComp) { Band targetBand = new Band(bandNames[index], this.bandDataType, tileComp.getNumColumns(), tileComp.getNumRows()); Band band = setInputSpecificationBand(tiles, index); final Dimension tileSize = JAIUtils.computePreferredTileSize(band.getRasterWidth(), band.getRasterHeight(), 1); setBandProperties(targetBand, band); initBandsGeoCoding(targetBand,tileComp); Map<Band, String> srcBands = getBandTiles(tiles, index); MosaicMultiLevelSource bandSource = new MosaicMultiLevelSource(srcBands, targetBand.getRasterWidth(), targetBand.getRasterHeight(), tileSize.width, tileSize.height, levels,tileComp, targetBand.getGeoCoding() != null ? Product.findImageToModelTransform(targetBand.getGeoCoding()) : Product.findImageToModelTransform(product.getSceneGeoCoding())); targetBand.setSourceImage(new DefaultMultiLevelImage(bandSource)); return targetBand; }