/** * Returns the full size, original image. Returns null if the image is not loaded. * * @return */ public PlanarImage getImage(OpManager manager) { return getImage(manager, true); }
@Override public PlanarImage getSourceRenderedImage() { if (sourceImage != null) { return sourceImage.getImage(preprocessing); } return null; }
public PlanarImage getImage() { return getImage(null); }
protected PlanarImage getPreprocessedImage(E imageElement) { return imageElement.getImage((OpManager) actionsInView.get(ActionW.PREPROCESSING.cmd())); }
public double getDoseMax() { // Initialise max dose once dose images are available if (!this.images.isEmpty() && doseMax < 0.01) { for (MediaElement me : this.images) { Core.MinMaxLocResult minMaxLoc = minMaxLoc(((ImageElement) me).getImage().toMat()); if (doseMax < minMaxLoc.maxVal) { doseMax = minMaxLoc.maxVal; } } } return doseMax; }
@Override public String getToolTips() { StringBuilder toolTips = new StringBuilder(); toolTips.append("<html>"); //$NON-NLS-1$ E media = this.getMedia(MEDIA_POSITION.MIDDLE, null, null); if (media instanceof ImageElement) { ImageElement image = (ImageElement) media; PlanarImage img = image.getImage(); if (img != null) { toolTips.append(Messages.getString("Series.img_size")); //$NON-NLS-1$ toolTips.append(StringUtil.COLON_AND_SPACE); toolTips.append(img.width()); toolTips.append('x'); toolTips.append(img.height()); } } toolTips.append("</html>"); //$NON-NLS-1$ return toolTips.toString(); }
/** * Get AcquireImageInfo from the data model and create lazily the JAI.PlanarImage if not yet available<br> * * @note All the AcquireImageInfo value objects are unique according to the imageElement URI * * @param image * @return */ // TODO be careful not to execute this method on the EDT private static AcquireImageInfo getAcquireImageInfo(ImageElement image) { if (image == null || image.getImage() == null) { return null; } AcquireImageInfo imageInfo = imagesInfoByURI.get(image.getMediaURI()); if (imageInfo == null) { imageInfo = new AcquireImageInfo(image); } return imageInfo; } }
public static ImageCV minStack(List<ImageElement> sources) { if (sources.size() > 1) { ImageElement firstImg = sources.get(0); ImageCV dstImg = new ImageCV(); PlanarImage img = firstImg.getImage(null, false); img.toMat().copyTo(dstImg); int numbSrc = sources.size(); for (int i = 1; i < numbSrc; i++) { ImageElement imgElement = sources.get(i); PlanarImage image = imgElement.getImage(null, false); if (image.width() != dstImg.width() && image.height() != dstImg.height()) { continue; } if (image instanceof Mat) { Core.min(dstImg, (Mat) image, dstImg); } } return dstImg; } return null; }
public static ImageCV maxStack(List<ImageElement> sources) { if (sources.size() > 1) { ImageElement firstImg = sources.get(0); ImageCV dstImg = new ImageCV(); PlanarImage img = firstImg.getImage(null, false); img.toMat().copyTo(dstImg); int numbSrc = sources.size(); for (int i = 1; i < numbSrc; i++) { ImageElement imgElement = sources.get(i); PlanarImage image = imgElement.getImage(null, false); if (image.width() != dstImg.width() && image.height() != dstImg.height()) { continue; } if (image instanceof Mat) { Core.max(dstImg, (Mat) image, dstImg); } } return dstImg; } return null; } }
public boolean hasSameSize(ImageElement image) { if (image != null) { PlanarImage img = getImage(); PlanarImage img2 = image.getImage(); if (img != null && img2 != null && getRescaleWidth(img.width()) == image.getRescaleWidth(img2.width()) && getRescaleHeight(img.height()) == image.getRescaleHeight(img2.height())) { return true; } } return false; }
private Predicate<AcquireImageInfo> oversizedImages() { return acqImg -> { PlanarImage img = acqImg.getImage().getImage(acqImg.getPostProcessOpManager()); return img.width() > Resolution.ULTRA_HD.maxSize || img.height() > Resolution.ULTRA_HD.maxSize; }; }
@Override public void run() { PlanarImage img = null; // Get the final that contain the thumbnail when the uncompress mode is activated File file = diskObject.getFile(); if (file != null && file.getName().endsWith(".wcv")) { //$NON-NLS-1$ File thumbFile = new File(ImageFiler.changeExtension(file.getPath(), ".jpg")); //$NON-NLS-1$ if (thumbFile.canRead()) { img = ImageProcessor.readImage(thumbFile); } } if (img == null) { img = diskObject.getRenderedImage(diskObject.getImage(null)); } if (img == null) { return; } final BufferedImage tIcon = ImageConversion .toBufferedImage((PlanarImage) ImageProcessor.buildThumbnail(img, ThumbnailRenderer.ICON_DIM, true)); // Prevent to many files open on Linux (Ubuntu => 1024) and close image stream diskObject.removeImageFromCache(); GuiExecutor.instance().execute(() -> { if (tIcon != null) { cachedThumbnails.put(diskObject.getMediaURI(), new ThumbnailIcon(tIcon)); } thumbnailList.getThumbnailListModel().notifyAsUpdated(index); }); }
if (media instanceof ImageElement) { final ImageElement image = (ImageElement) media; PlanarImage imgPl = image.getImage(opManager); if (imgPl != null) { PlanarImage img = image.getRenderedImage(imgPl);
public void drawScale(Graphics2D g2d, Rectangle bound, float fontHeight) { ImageElement image = view2DPane.getImage(); PlanarImage source = image.getImage(); if (source == null) { return;
public static ImageCV meanStack(List<ImageElement> sources) { if (sources.size() > 1) { ImageElement firstImg = sources.get(0); PlanarImage img = firstImg.getImage(null, false); for (int i = 1; i < numbSrc; i++) { ImageElement imgElement = sources.get(i); PlanarImage image = imgElement.getImage(null, false); if (image.width() != img.width() && image.height() != img.height()) { continue;
PlanarImage image = img.getImage(); if (image != null) { int elemSize = CvType.ELEM_SIZE(image.type());
PlanarImage transformedImage = imageElement.getImage(opManager, false);
@Override public void stateChanged(BoundedRangeModel model) { ViewCanvas<ImageElement> view2d = null; Series<ImageElement> series = null; SynchCineEvent mediaEvent = null; ImageElement image = null; if (selectedView2dContainer != null) { view2d = (ViewCanvas<ImageElement>) selectedView2dContainer.getSelectedImagePane(); } if (view2d != null && view2d.getSeries() instanceof Series) { series = (Series<ImageElement>) view2d.getSeries(); if (series != null) { // Model contains display value, value-1 is the index value of a sequence int index = model.getValue() - 1; image = series.getMedia(index, (Filter<ImageElement>) view2d.getActionValue(ActionW.FILTERED_SERIES.cmd()), view2d.getCurrentSortComparator()); mediaEvent = new SynchCineEvent(view2d, image, index); // Ensure to load image before calling the default preset (requires pixel min and max) if (image != null && !image.isImageAvailable()) { image.getImage(); } } } firePropertyChange(ActionW.SYNCH.cmd(), null, mediaEvent); if (image != null) { fireSeriesViewerListeners( new SeriesViewerEvent(selectedView2dContainer, series, image, EVENT.SELECT)); } }
@Override public void handleImageOpEvent(ImageOpEvent event) { OpEvent type = event.getEventType(); if (OpEvent.ImageChange.equals(type)) { setParam(P_IMAGE_ELEMENT, event.getImage()); } else if (OpEvent.ResetDisplay.equals(type) || OpEvent.SeriesChange.equals(type)) { ImageElement img = event.getImage(); setParam(P_IMAGE_ELEMENT, img); if (img != null) { if (!img.isImageAvailable()) { // Ensure to load image before calling the default preset that requires pixel min and max img.getImage(); } boolean pixelPadding = LangUtil.getNULLtoTrue((Boolean) getParam(ActionW.IMAGE_PIX_PADDING.cmd())); setParam(ActionW.WINDOW.cmd(), img.getDefaultWindow(pixelPadding)); setParam(ActionW.LEVEL.cmd(), img.getDefaultLevel(pixelPadding)); setParam(ActionW.LEVEL_MIN.cmd(), img.getMinValue(null, pixelPadding)); setParam(ActionW.LEVEL_MAX.cmd(), img.getMaxValue(null, pixelPadding)); } } }