List of usage examples for java.awt.image RenderedImage getSources
Vector<RenderedImage> getSources();
From source file:org.esa.beam.visat.toolviews.diag.TileCacheMonitor.java
private void dumpImageTree(Collection<CachedTile> tiles) { final Map<RenderedImage, Integer> ownerMap = new HashMap<RenderedImage, Integer>(100); final Map<RenderedImage, Long> sizeMap = new HashMap<RenderedImage, Long>(100); for (CachedTile sct : tiles) { RenderedImage owner = sct.getOwner(); if (owner == null) { continue; }//from w w w . j a v a 2 s.c o m Integer count = ownerMap.get(owner); if (count == null) { ownerMap.put(owner, Integer.valueOf(1)); } else { ownerMap.put(owner, Integer.valueOf(count.intValue() + 1)); } Long size = sizeMap.get(owner); if (size == null) { sizeMap.put(owner, Long.valueOf(sct.getTileSize())); } else { sizeMap.put(owner, Long.valueOf(size + sct.getTileSize())); } } Set<RenderedImage> rootEntries = new HashSet<RenderedImage>(ownerMap.keySet()); for (RenderedImage image : ownerMap.keySet()) { Vector<RenderedImage> sources = image.getSources(); eleminateSources(sources, rootEntries); } for (RenderedImage image : rootEntries) { printImage(image, ownerMap.get(image), sizeMap.get(image)); printSources("", image.getSources(), ownerMap, sizeMap); } System.out.println("======================================"); }
From source file:org.esa.beam.visat.toolviews.diag.TileCacheMonitor.java
private void eleminateSources(Vector<RenderedImage> sources, Set<RenderedImage> rootEntries) { if (sources != null) { for (RenderedImage renderedImage : sources) { if (rootEntries.contains(renderedImage)) { rootEntries.remove(renderedImage); }// w w w . ja va 2 s . c om eleminateSources(renderedImage.getSources(), rootEntries); } } }
From source file:org.esa.beam.visat.toolviews.diag.TileCacheMonitor.java
private void printSources(String prefix, Vector<RenderedImage> sources, Map<RenderedImage, Integer> ownerMap, Map<RenderedImage, Long> sizeMap) { if (sources != null) { for (RenderedImage image : sources) { System.out.print(prefix + "->"); if (ownerMap.containsKey(image)) { printImage(image, ownerMap.get(image), sizeMap.get(image)); } else { printImage(image, 0, 0L); }/*from w w w . j av a2 s . co m*/ printSources("--" + prefix, image.getSources(), ownerMap, sizeMap); } } }
From source file:org.photovault.image.PhotovaultImage.java
/** Find the last cached rendering of a certain phase of image processing pipeline. The name is stored in JAI property "org.photovault.opname". <p>/*from w w w . j a v a2s . com*/ This function makes a depth-first search to the sources of given node and returns the first node that has the name. @param op The "sink" node of the image processing graph that is searched @param The name @return First node found with given name or <code>NULL</codel> if no such node is found. */ RenderedImage findNamedRendering(RenderedImage op, String name) { if (op != null) { Object imgName = op.getProperty("org.photovault.opname"); if (imgName.equals(name)) { return op; } Vector sources = op.getSources(); if (sources == null) { // Apparently we arrived at the leaf node without finding the // correct rendering. return null; } for (Object o : sources) { if (o != null && o instanceof RenderedImage) { RenderedImage candidate = findNamedRendering((RenderedImage) o, name); if (candidate != null) { return candidate; } } } } return null; }
From source file:org.photovault.image.PhotovaultImage.java
private void debugPrintGraph(RenderedImage img, String prefix) { Object opName = img.getProperty("org.photovault.opname"); if (opName != null && opName instanceof String) { System.out.println(prefix + opName + " (" + img.getClass().getName() + ")"); } else {/*from www .j a v a 2 s .c om*/ System.out.println(prefix + "unnamed image" + " (" + img.getClass().getName() + ")"); } System.out.println(prefix + " " + img.toString()); if (img instanceof RenderedOp) { RenderedOp op = (RenderedOp) img; System.out.println(prefix + " operation name" + op.getOperationName()); ParameterBlock pb = op.getParameterBlock(); if (pb instanceof ParameterBlockJAI) { ParameterBlockJAI pbj = (ParameterBlockJAI) pb; String[] paramNames = pbj.getParameterListDescriptor().getParamNames(); Vector params = pbj.getParameters(); for (int n = 0; n < paramNames.length; n++) { System.out.println(prefix + " " + paramNames[n] + params.get(n)); } } } Vector<RenderedImage> sources = img.getSources(); if (sources == null) { return; } for (RenderedImage parent : sources) { debugPrintGraph(parent, prefix + " "); } }