RandomIterFactory.create(renderedImage, new Rectangle(0, 0, width, height));
/** * Create a {@link WritableRaster} from a double matrix. * * @param matrix the matrix to take the data from. * @param matrixIsRowCol a flag to tell if the matrix has rowCol or colRow order. * @return the produced raster. */ public static WritableRaster createWritableRasterFromMatrix( double[][] matrix, boolean matrixIsRowCol) { int height = matrix.length; int width = matrix[0].length; if (!matrixIsRowCol) { int tmp = height; height = width; width = tmp; } WritableRaster writableRaster = createDoubleWritableRaster(width, height, null, null, null); WritableRandomIter disckRandomIter = RandomIterFactory.createWritable(writableRaster, null); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { if (matrixIsRowCol) { disckRandomIter.setSample(x, y, 0, matrix[y][x]); } else { disckRandomIter.setSample(x, y, 0, matrix[x][y]); } } } disckRandomIter.done(); return writableRaster; }
public DestinationImage(String imageName, WritableRenderedImage image) { this.imageName = imageName; this.image = image; this.iterator = RandomIterFactory.createWritable(image, null); }
iter = RandomIterFactory.create(inputRI, null);
public DestinationImage(String imageName, WritableRenderedImage image) { this.imageName = imageName; this.image = image; this.iterator = RandomIterFactory.createWritable(image, null); }
public void loadData() throws KlabException { if (_loaded) return; /* * get rid of old image if we had one */ if (image != null) { image = null; } image = coverage.getRenderedImage(); itera = RandomIterFactory.create(image, null); _loaded = true; }
WritableRandomIter destIter = RandomIterFactory.createWritable(destImage, null); segmentsPending = new LinkedList<ScanSegment>(); segmentsFilled = new ArrayList<ScanSegment>();
public void loadData() throws KlabException { checkCoverage(); /* * get rid of old image if we had one */ if (image != null) { image = null; } image = coverage.getRenderedImage(); itera = RandomIterFactory.create(image, null); _loaded = true; }
WritableRandomIter destIter = RandomIterFactory.createWritable(destImage, null); segmentsPending = new LinkedList<ScanSegment>(); segmentsFilled = new ArrayList<ScanSegment>();
this.srcIter = RandomIterFactory.create(sourceImage, null);
this.srcIter = RandomIterFactory.create(sourceImage, null);
/** * If the mouse cursor is over the image, get the value of the image * pixel from band 0 */ public void mouseMoved(MouseEvent ev) { if (dataImage != null) { Point imagePos = getImageCoords(ev.getPoint(), null); if (imageBounds.contains(imagePos)) { if (dataImageIter == null) { dataImageIter = RandomIterFactory.create(dataImage, imageBounds); } if (integralImageDataType) { dataImageIter.getPixel(imagePos.x, imagePos.y, intData); frame.setCursorInfo(imagePos, intData); } else { dataImageIter.getPixel(imagePos.x, imagePos.y, doubleData); frame.setCursorInfo(imagePos, doubleData); } } else { frame.setStatusText(""); } } }
/** * If the mouse cursor is over the image, get the value of the image * pixel from band 0 */ public void mouseMoved(MouseEvent ev) { if (dataImage != null) { Point imagePos = getImageCoords(ev.getPoint(), null); if (imageBounds.contains(imagePos)) { if (dataImageIter == null) { dataImageIter = RandomIterFactory.create(dataImage, imageBounds); } if (integralImageDataType) { dataImageIter.getPixel(imagePos.x, imagePos.y, intData); frame.setCursorInfo(imagePos, intData); } else { dataImageIter.getPixel(imagePos.x, imagePos.y, doubleData); frame.setCursorInfo(imagePos, doubleData); } } else { frame.setStatusText(""); } } }
private void extendAsDouble(WritableRaster raster, PlanarImage sourceImage) { Rectangle bounds = sourceImage.getBounds(); Rectangle samplingBounds = new Rectangle(0, 0, 2 * maxDistance + 1, 2 * maxDistance + 1); RandomIter srcIter = RandomIterFactory.create(sourceImage, bounds); double[] pixel = new double[raster.getNumBands()]; for (int y = raster.getMinY(), ny = 0; ny < raster.getHeight(); y++, ny++) { for (int x = raster.getMinX(), nx = 0; nx < raster.getWidth(); x++, nx++) { if (!bounds.contains(x, y)) { samplingBounds.setLocation(x - maxDistance, y - maxDistance); Rectangle sourceSamplingBounds = samplingBounds.intersection(bounds); int sx = rand.nextInt(sourceSamplingBounds.width) + sourceSamplingBounds.x; int sy = rand.nextInt(sourceSamplingBounds.height) + sourceSamplingBounds.y; srcIter.getPixel(sx, sy, pixel); raster.setPixel(x, y, pixel); } } } }
/** * If the mouse cursor is over the image, get the value of the image * pixel from band 0 */ public void mouseMoved(MouseEvent ev) { if (dataImage != null) { Point imagePos = getImageCoords(ev.getPoint(), null); if (imageBounds.contains(imagePos)) { if (dataImageIter == null) { dataImageIter = RandomIterFactory.create(dataImage, imageBounds); } if (integralImageDataType) { dataImageIter.getPixel(imagePos.x, imagePos.y, intData); frame.setCursorInfo(imagePos, intData); } else { dataImageIter.getPixel(imagePos.x, imagePos.y, doubleData); frame.setCursorInfo(imagePos, doubleData); } } else { frame.setStatusText(""); } } }
/** * If the mouse cursor is over the image, get the value of the image * pixel from band 0 */ public void mouseMoved(MouseEvent ev) { if (dataImage != null) { Point imagePos = getImageCoords(ev.getPoint(), null); if (imageBounds.contains(imagePos)) { if (dataImageIter == null) { dataImageIter = RandomIterFactory.create(dataImage, imageBounds); } if (integralImageDataType) { dataImageIter.getPixel(imagePos.x, imagePos.y, intData); frame.setCursorInfo(imagePos, intData); } else { dataImageIter.getPixel(imagePos.x, imagePos.y, doubleData); frame.setCursorInfo(imagePos, doubleData); } } else { frame.setStatusText(""); } } }
private void extendAsFloat(WritableRaster raster, PlanarImage sourceImage) { Rectangle bounds = sourceImage.getBounds(); Rectangle samplingBounds = new Rectangle(0, 0, 2 * maxDistance + 1, 2 * maxDistance + 1); RandomIter srcIter = RandomIterFactory.create(sourceImage, bounds); float[] pixel = new float[raster.getNumBands()]; for (int y = raster.getMinY(), ny = 0; ny < raster.getHeight(); y++, ny++) { for (int x = raster.getMinX(), nx = 0; nx < raster.getWidth(); x++, nx++) { if (!bounds.contains(x, y)) { samplingBounds.setLocation(x - maxDistance, y - maxDistance); Rectangle sourceSamplingBounds = samplingBounds.intersection(bounds); int sx = rand.nextInt(sourceSamplingBounds.width) + sourceSamplingBounds.x; int sy = rand.nextInt(sourceSamplingBounds.height) + sourceSamplingBounds.y; srcIter.getPixel(sx, sy, pixel); raster.setPixel(x, y, pixel); } } } }
private void extendAsDouble(WritableRaster raster, PlanarImage sourceImage) { Rectangle bounds = sourceImage.getBounds(); Rectangle samplingBounds = new Rectangle(0, 0, 2 * maxDistance + 1, 2 * maxDistance + 1); RandomIter srcIter = RandomIterFactory.create(sourceImage, bounds); double[] pixel = new double[raster.getNumBands()]; for (int y = raster.getMinY(), ny = 0; ny < raster.getHeight(); y++, ny++) { for (int x = raster.getMinX(), nx = 0; nx < raster.getWidth(); x++, nx++) { if (!bounds.contains(x, y)) { samplingBounds.setLocation(x - maxDistance, y - maxDistance); Rectangle sourceSamplingBounds = samplingBounds.intersection(bounds); int sx = rand.nextInt(sourceSamplingBounds.width) + sourceSamplingBounds.x; int sy = rand.nextInt(sourceSamplingBounds.height) + sourceSamplingBounds.y; srcIter.getPixel(sx, sy, pixel); raster.setPixel(x, y, pixel); } } } }
private void extendAsInt(WritableRaster raster, PlanarImage sourceImage) { Rectangle bounds = sourceImage.getBounds(); Rectangle samplingBounds = new Rectangle(0, 0, 2 * maxDistance + 1, 2 * maxDistance + 1); RandomIter srcIter = RandomIterFactory.create(sourceImage, bounds); int[] pixel = new int[raster.getNumBands()]; for (int y = raster.getMinY(), ny = 0; ny < raster.getHeight(); y++, ny++) { for (int x = raster.getMinX(), nx = 0; nx < raster.getWidth(); x++, nx++) { if (!bounds.contains(x, y)) { samplingBounds.setLocation(x - maxDistance, y - maxDistance); Rectangle sourceSamplingBounds = samplingBounds.intersection(bounds); int sx = rand.nextInt(sourceSamplingBounds.width) + sourceSamplingBounds.x; int sy = rand.nextInt(sourceSamplingBounds.height) + sourceSamplingBounds.y; srcIter.getPixel(sx, sy, pixel); raster.setPixel(x, y, pixel); } } } }